summaryrefslogtreecommitdiffhomepage
path: root/gbp
diff options
context:
space:
mode:
authorMathieu Parent <math.parent@gmail.com>2018-07-15 09:55:56 +0200
committerGuido Günther <agx@sigxcpu.org>2018-08-24 08:32:39 +0200
commit03accd298de99757077bf72f8d6f3b76a6b3f6a7 (patch)
tree953e3106bbbc8c961cec0e34eeab09e1978d4f2b /gbp
parent7ce98d64b3e505c09ad785a561f59815ca26d20d (diff)
import-orig: Allow to import the requested version with --uscan
Closes: #741148
Diffstat (limited to 'gbp')
-rw-r--r--gbp/deb/uscan.py10
-rw-r--r--gbp/scripts/import_orig.py6
2 files changed, 8 insertions, 8 deletions
diff --git a/gbp/deb/uscan.py b/gbp/deb/uscan.py
index 0416587a..4eb70a6b 100644
--- a/gbp/deb/uscan.py
+++ b/gbp/deb/uscan.py
@@ -174,16 +174,16 @@ class Uscan(object):
msg = "Uscan failed - debug by running 'uscan --verbose'"
raise UscanError(msg)
- def scan(self, destdir='..'):
+ def scan(self, destdir='..', download_version=None):
"""
Invoke uscan to fetch a new upstream version
@returns: C{True} if a new version was downloaded
"""
- p = subprocess.Popen(['uscan', '--symlink', '--destdir=%s' % destdir,
- '--dehs'],
- cwd=self._dir,
- stdout=subprocess.PIPE)
+ cmd = ['uscan', '--symlink', '--destdir=%s' % destdir, '--dehs']
+ if download_version:
+ cmd += ['--download-debversion', download_version]
+ p = subprocess.Popen(cmd, cwd=self._dir, stdout=subprocess.PIPE)
out = p.communicate()[0].decode()
# uscan exits with 1 in case of uptodate and when an error occurred.
# Don't fail in the uptodate case:
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 298e7e7b..3d974e93 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -133,7 +133,7 @@ def detect_name_and_version(repo, source, options):
return (sourcepackage, version)
-def find_upstream(use_uscan, args):
+def find_upstream(use_uscan, args, version=None):
"""Find the main tarball to import - either via uscan or via command line argument
@return: upstream source filename or None if nothing to import
@rtype: string
@@ -161,7 +161,7 @@ def find_upstream(use_uscan, args):
uscan = Uscan()
gbp.log.info("Launching uscan...")
try:
- if not uscan.scan():
+ if not uscan.scan(download_version=version):
gbp.log.info("package is up to date, nothing to do.")
return None
except UscanError as e:
@@ -422,7 +422,7 @@ def main(argv):
if options.download:
upstream = download_orig(args[0])
else:
- upstream = find_upstream(options.uscan, args)
+ upstream = find_upstream(options.uscan, args, options.version)
if not upstream:
return ExitCodes.uscan_up_to_date