aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2010-04-26 19:00:21 +0200
committerGuido Günther <agx@sigxcpu.org>2010-04-26 19:02:44 +0200
commitf7a085abb2f604376a4c6f6513fba5f972bf18bd (patch)
tree6ade3ba3d0794f34521bf9e887cf670c6e49c67c
parent6646d63a6884cb15f0af1db4f06bb8a9c35a5043 (diff)
Make --uscan more robust
by not throwing exceptions onto the console and catching download errors.
-rwxr-xr-xgit-import-orig41
1 files changed, 22 insertions, 19 deletions
diff --git a/git-import-orig b/git-import-orig
index a3a58fc5..76934f37 100755
--- a/git-import-orig
+++ b/git-import-orig
@@ -147,7 +147,7 @@ def main(argv):
try:
parser = GbpOptionParser(command=os.path.basename(argv[0]), prefix='',
- usage='%prog [-u version] /path/to/upstream-version.tar.gz')
+ usage='%prog [options] /path/to/upstream-version.tar.gz | --uscan')
except ConfigParser.ParsingError, err:
print >>sys.stderr, err
return 1
@@ -216,26 +216,29 @@ def main(argv):
if options.filters:
turn_off_fastimport(options, "Import filters currently not supported with fastimport.")
- if options.uscan:
- # use uscan
- print >>sys.stderr, "Launching uscan... ",
- status, tarball = do_uscan()
-
- if not status:
- print >>sys.stderr, "package is up to date, nothing to do."
- sys.exit(0)
- elif status and not tarball:
- print >>sys.stderr, "uscan didn't download anything, and no tarball was found in ../"
- sys.exit(1)
- elif status and tarball:
- print >>sys.stderr, "using %s" % tarball
-
- if args:
- raise GbpError, "you can't pass both --uscan and a filename."
- else:
- args.append(tarball)
+
try:
+ if options.uscan: # uscan mode
+ if args:
+ raise GbpError, "you can't pass both --uscan and a filename."
+
+ print "Launching uscan...",
+ try:
+ status, tarball = do_uscan()
+ except KeyError:
+ raise GbpError, "error running uscan - debug by running uscan --verbose"
+
+ if not status and not tarball:
+ print "package is up to date, nothing to do."
+ return 0
+ elif status and not tarball:
+ raise GbpError, "uscan didn't download anything, and no tarball was found in ../"
+ elif status and tarball:
+ print "using %s" % tarball
+ args.append(tarball)
+
+ # tarball specified
if len(args) != 1:
parser.print_help()
raise GbpError