Control: tag -1 + patch

Hello,

Here is a quick (i.e not a git-am) patch to pass "--upstream-version" to uscan.

Works for me...

Regards

-- 
Mathieu Parent
diff -ur ../gbp/deb/uscan.py /usr/lib/python3/dist-packages/gbp/deb/uscan.py
--- ../gbp/deb/uscan.py 2017-11-28 08:13:55.000000000 +0100
+++ /usr/lib/python3/dist-packages/gbp/deb/uscan.py     2018-01-10 
23:15:11.618821062 +0100
@@ -174,16 +174,16 @@
             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-version', 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 -ur ../gbp/scripts/import_orig.py 
/usr/lib/python3/dist-packages/gbp/scripts/import_orig.py
--- ../gbp/scripts/import_orig.py       2017-11-28 12:22:49.000000000 +0100
+++ /usr/lib/python3/dist-packages/gbp/scripts/import_orig.py   2018-01-10 
23:19:35.634064363 +0100
@@ -264,7 +264,7 @@
     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
@@ -292,7 +292,7 @@
         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:
@@ -553,7 +553,7 @@
         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
 

Reply via email to