Package: git-buildpackage Version: 0.4.65 Severity: wishlist Tags: patch X-Debbugs-CC: Federico Ceratto <federico.cera...@gmail.com>
Hello, it would be nice if git-import-orig could be integrated with uscan(1) -- something similar to svn-upgrade's -u option (which launches uscan, and then uses the tarball). I made a patch against the git repository, please find it attached. Kindly, David -- . ''`. Debian developer | http://wiki.debian.org/DavidPaleino : :' : Linuxer #334216 --|-- http://www.hanskalabs.net/ `. `'` GPG: 1392B174 ----|---- `- 2BAB C625 4E66 E7B8 450A C3E1 E6AA 9017 1392 B174
From 2dea909f30fa2ea764dfe90fb18158bf0fa6e0b3 Mon Sep 17 00:00:00 2001 From: David Paleino <da...@debian.org> Date: Sun, 11 Apr 2010 11:06:41 +0200 Subject: [PATCH] Add --uscan command-line option: launch uscan and use the tarball, if there's a new upstream version. --- git-import-orig | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/git-import-orig b/git-import-orig index 6ee6228..13efd55 100755 --- a/git-import-orig +++ b/git-import-orig @@ -202,6 +202,8 @@ def main(argv): # Accepted for compatibility parser.add_option("--no-dch", dest='no_dch', action="store_true", default=False, help="deprecated - don't use.") + parser.add_option("--uscan", dest='uscan', action="store_true", + default=False, help="use uscan(1) to download the new tarball.") (options, args) = parser.parse_args(argv[1:]) @@ -214,6 +216,51 @@ 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... ", + p = subprocess.Popen(["uscan", "--dehs"], stdout=subprocess.PIPE) + out = p.communicate()[0].split('\n') + if "<status>up to date</status>" in out: + # nothing to do. + print >>sys.stderr, "package is up to date, nothing to do." + sys.exit(0) + else: + # ok, we've got it + from urllib2 import urlopen + #r = re.compile(">(.*)</") + d = {} + for row in out: + for n in ("package", "upstream-version", "upstream-url"): + m = re.match("<%s>(.*)</%s>" % (n,n), row) + if m: + d[n] = m.group(1) + else: + continue + print >>sys.stderr, "new version %s available." % d["upstream-version"] + + d["ext"] = os.path.splitext(d["upstream-url"])[1] + + path = "../%(package)s_%(upstream-version)s.orig.tar%(ext)s" % d + try: + orig = open(path, "wb") + + try: + print >>sys.stderr, "Downloading %s in %s... " % (d["upstream-url"], path), + stuff = urlopen(d["upstream-url"]).read() + orig.write(stuff) + print >>sys.stderr, "done." + except: + print >>sys.stderr, "Failed downloading %s." % d["upstream-url"] + orig.close() + except IOError: + print >>sys.stderr, "Failed opening %s for writing." % path + + if args: + args[0] = path + else: + args.append(path) + try: if len(args) != 1: parser.print_help() -- 1.7.0.4
signature.asc
Description: This is a digitally signed message part.