Refactoring of package metadata regex matching

Lets compile the pattern into one regex instead of calling 4 different
patterns.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Refactor resetting of uid/gid so that it is reusable

We need this for the topmost directory but we don't want to have the
pattern matching active at that time.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Fix handling of --include option

In most cases the --include option was not working correctly. Especially it
broke backward compatibility when the argument is not a pattern.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Fix handling of --exclude option

In most cases the --exclude option was not working correctly. Especially it
broke backward compatibility when the argument is not a pattern.

Signed-off-by: Jan Blunck <jblunck@infradead.org>
Refactor subdir handling of tarchecker's to prevent code duplication

This way the knowledge of what directory entries are present in the
sub-directory is kept in one place instead of three.

Signed-off-by: Jan Blunck <jblunck@infradead.org>