Optimize program configuration and fix archive argument checking.

This commit is contained in:
Bastian Kleineidam 2012-05-11 21:16:29 +02:00
parent 42ad896171
commit 6882f93b49
1 changed files with 17 additions and 10 deletions

View File

@ -99,19 +99,21 @@ ArchivePrograms = {
'list': ('nomarch',), 'list': ('nomarch',),
}, },
'bzip2': { 'bzip2': {
'extract': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), None: ('7z', '7za'),
'test': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), 'extract': ('pbzip2', 'lbzip2', 'bzip2'),
'create': ('pbzip2', 'lbzip2', 'bzip2', '7z', '7za'), 'test': ('pbzip2', 'lbzip2', 'bzip2'),
'list': ('7z', '7za', 'echo',), 'create': ('pbzip2', 'lbzip2', 'bzip2'),
'list': ('echo',),
}, },
'tar': { 'tar': {
None: ('tar', 'star',), None: ('tar', 'star',),
}, },
'zip': { 'zip': {
'extract': ('unzip', '7z', '7za'), None: ('7z', '7za'),
'list': ('unzip', '7z', '7za'), 'extract': ('unzip',),
'test': ('unzip', '7z', '7za'), 'list': ('unzip',),
'create': ('zip', '7z', '7za'), 'test': ('unzip',),
'create': ('zip',),
}, },
'gzip': { 'gzip': {
None: ('pigz', 'gzip', '7z', '7za'), None: ('pigz', 'gzip', '7z', '7za'),
@ -404,11 +406,16 @@ def check_archive_arguments (archive, command, *args):
elif command == 'repack': elif command == 'repack':
util.check_existing_filename(archive) util.check_existing_filename(archive)
if not args: if not args:
raise PatoolError("missing target archive filename for repack") raise util.PatoolError("missing target archive filename for repack")
util.check_new_filename(args[0]) util.check_new_filename(args[0])
if util.is_same_filename(archive, args[0]): if util.is_same_filename(archive, args[0]):
msg = "cannot repack identical archives `%s' and `%s'" msg = "cannot repack identical archives `%s' and `%s'"
raise util.PatoolError(msg % (archive1, archive2)) raise util.PatoolError(msg % (archive, args[0]))
elif command == 'diff':
util.check_existing_filename(archive)
if not args:
raise util.PatoolError("missing second archive filename for diff")
util.check_existing_filename(args[0])
else: else:
util.check_existing_filename(archive) util.check_existing_filename(archive)