diff options
author | Guido Günther <agx@sigxcpu.org> | 2016-12-04 19:35:28 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2016-12-04 19:51:42 +0100 |
commit | a10c77b515de0b92740a38f7d4fbe58b1b4cc9f6 (patch) | |
tree | 1d65de72c919f1ffd4b28a6dcf73177696542666 /gbp | |
parent | f631e64845e1d6584b94dd18da2b5e91d4c71d67 (diff) |
import_srpm: allow for more than one argument
otherwise giving a target dir always raises an error
(introduced by 03276df5b9391dc877521cd6c3553ca071157991)
Diffstat (limited to 'gbp')
-rwxr-xr-x | gbp/scripts/import_srpm.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gbp/scripts/import_srpm.py b/gbp/scripts/import_srpm.py index 64a636a5..bd234c6c 100755 --- a/gbp/scripts/import_srpm.py +++ b/gbp/scripts/import_srpm.py @@ -122,7 +122,7 @@ def build_parser(name): parser = GbpOptionParserRpm(command=os.path.basename(name), prefix='', usage='%prog [options] /path/to/package' - '.src.rpm [<target>]') + '.src.rpm [target]') except GbpError as err: gbp.log.err(err) return None @@ -208,7 +208,13 @@ def main(argv): if not options: return ExitCodes.parse_error - if len(args) != 1: + if len(args) == 1: + srpm = args[0] + target = None + elif len(args) == 2: + srpm = args[0] + target = args[1] + else: gbp.log.err("Need to give exactly one package to import. Try --help.") return 1 try: @@ -217,7 +223,6 @@ def main(argv): gbp.log.err(err) return 1 try: - srpm = args[0] if options.download: srpm = download_source(srpm) @@ -261,7 +266,7 @@ def main(argv): except GitRepositoryError: gbp.log.info("No git repository found, creating one.") is_empty = True - target = args[1] if len(args) == 2 else spec.name + target = target or spec.name repo = RpmGitRepository.create(target) os.chdir(repo.path) |