diff options
author | Mathieu Parent <math.parent@gmail.com> | 2018-07-15 09:55:56 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2018-08-24 08:32:39 +0200 |
commit | 03accd298de99757077bf72f8d6f3b76a6b3f6a7 (patch) | |
tree | 953e3106bbbc8c961cec0e34eeab09e1978d4f2b | |
parent | 7ce98d64b3e505c09ad785a561f59815ca26d20d (diff) |
import-orig: Allow to import the requested version with --uscan
Closes: #741148
-rw-r--r-- | docs/manpages/gbp-import-orig.xml | 10 | ||||
-rw-r--r-- | gbp/deb/uscan.py | 10 | ||||
-rw-r--r-- | gbp/scripts/import_orig.py | 6 |
3 files changed, 14 insertions, 12 deletions
diff --git a/docs/manpages/gbp-import-orig.xml b/docs/manpages/gbp-import-orig.xml index 7eccf6aa..b3ca7027 100644 --- a/docs/manpages/gbp-import-orig.xml +++ b/docs/manpages/gbp-import-orig.xml @@ -70,8 +70,8 @@ </listitem> <listitem> <para> - <option>--uscan</option>: The latest upstream version is fetched - via &uscan; relying on <filename>debian/watch</filename>. + <option>--uscan</option>: The latest upstream or specified version is + fetched via &uscan; relying on <filename>debian/watch</filename>. </para> </listitem> </orderedlist> @@ -112,7 +112,8 @@ <term><option>-u</option><replaceable>version</replaceable></term> <listitem> <para> - The upstream version number + The upstream version number. With <option>--uscan</option>, passed to + uscan as <option>--download-debversion</option> </para> </listitem> </varlistentry> @@ -333,7 +334,8 @@ <term><option>--uscan</option></term> <listitem> <para> - Use &uscan; to fetch new upstream version. + Use &uscan; to fetch new upstream version. The version can be + specified with <option>--upstream-version</option> </para> </listitem> </varlistentry> 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 |