Package: git-buildpackage
Version: 0.9.39
Severity: normal
Tags: patch
X-Debbugs-Cc: [email protected]

Dear Maintainer,

The recent addition of retry with --download-debversion if --download-version
failed [1] to gbp import-orig is a great idea. However, there is a bug in the
implementation. When uscan --download-version=foo fails, gbp is supposed to
call uscan --download-debversion=foo, but it instead calls uscan without
specifying any version. This results in uscan downloading the latest
version of the tarball available and gbp then renames that tarball to
the specified version. This is very confusing.

I've attached a patch that ensures gbp import-orig passes the correct
version in the fallback. I would also suggest that the manpage be
updated to reflect this behaviour, as it is not currently documented.
The option is currently described as:

       --upstream-version=version, -uversion
              The upstream version number. With --uscan, passed to uscan as 
--download-version

and perhaps it should be:

       --upstream-version=version, -uversion
              The upstream version number. With --uscan, passed to uscan as 
--download-version,
              or as --download-debversion if not found by the former.

I've attached the verbose output of attempting to import version
7.1.0+ds of the src:rocm package. This fails, due to the +ds suffix,
and the latest version (currently 7.2.0+ds) is then downloaded and
renamed to 7.1.0+ds.

Sincerely,
Cory Bloor

[1]: 
https://salsa.debian.org/agx/git-buildpackage/-/commit/7d509bf8948e66e08b8bdd505b86ac5e4c374eae.patch

-- System Information:
Debian Release: forky/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.17.13+deb13-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: unable to detect

Versions of packages git-buildpackage depends on:
ii  devscripts        2.26.5
ii  git               1:2.51.0-1
ii  man-db            2.13.1-1
ii  python3           3.13.9-3
ii  python3-dateutil  2.9.0-4
ii  python3-yaml      6.0.3-1
ii  sensible-utils    0.0.26

Versions of packages git-buildpackage recommends:
ii  cowbuilder        0.90
ii  pbuilder          0.231.3
ii  pristine-tar      1.50+nmu2
ii  python3-requests  2.32.5+dfsg-1

Versions of packages git-buildpackage suggests:
pn  python3-notify2  <none>
ii  sudo             1.9.17p2-4
ii  unzip            6.0-29

-- no debconf information

Attachment: 0001-uscan-Fix-retry-with-download-debversion.patch
Description: application/mbox

# gbp import-orig --verbose --uscan --pristine-tar --upstream-version=7.1.0+ds
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'for-each-ref', '--format=%(refname:short)', 'refs/heads/']
gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/upstream']
gbp:debug: ['git', 'status', '--porcelain']
gbp:info: Launching uscan for 7.1.0+ds...
uscan warn: In debian/watch no matching files for version 7.1.0+ds in watch line
Newest version of rocm on remote site is 7.2.0, local version is 6.4.3+ds
       (mangled local version is 6.4.3)
 => Newer package available from:
        => https://github.com/ROCm/ROCm/archive/refs/tags/rocm-7.2.0.tar.gz
Successfully repacked ../rocm-7.2.0.tar.gz as ../rocm_7.2.0+ds.orig.tar.xz, 
deleting 199 files from it.
gbp:info: Using uscan downloaded tarball ../rocm_7.2.0+ds.orig.tar.xz
gbp:debug: ['git', 'tag', '-l', 'upstream/7.1.0+ds']
gbp:debug: tar ['-C', '/root/rocm/tmpm90h50zf', '-a', '-xf', 
'../rocm_7.2.0+ds.orig.tar.xz'] []
gbp:debug: Unpacked '../rocm_7.2.0+ds.orig.tar.xz' to 
'/root/rocm/tmpm90h50zf/ROCm-rocm-7.2.0'
gbp:info: <DebianUpstreamSource path='../rocm_7.2.0+ds.orig.tar.xz' 
signaturefile=None>
gbp:info: Importing '../rocm_7.2.0+ds.orig.tar.xz' to branch 'upstream'...
gbp:info: Source package is rocm
gbp:info: Upstream version is 7.1.0+ds
gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/upstream']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 'upstream']
gbp:debug: ['git', 'add', '-f', '.']
gbp:debug: ['git', 'write-tree']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 'upstream']
gbp:debug: ['git', 'commit-tree', '3d93e8d46dd4ac7255bd0607d75a9c813629da47', 
'-p', '25f0b337a9eb51ca5a1f2cc86b82e3988621df3b']
gbp:debug: ['git', 'update-ref', '-m', 'gbp: New upstream version 7.1.0+ds', 
'refs/heads/upstream', '6fc11be4e1b0420ab8687472d42f263f829a8ad7', 
'25f0b337a9eb51ca5a1f2cc86b82e3988621df3b']
gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/pristine-tar']
gbp:debug: ['git', 'ls-tree', '-z', 'upstream', '--']
gbp:debug: ['git', 'mktree', '-z']
gbp:debug: pristine-tar [] ['commit', '../rocm_7.1.0+ds.orig.tar.xz', 
'3d93e8d46dd4ac7255bd0607d75a9c813629da47']
branch 'pristine-tar' set up to track 'origin/pristine-tar'.
gbp:debug: ['git', 'tag', '-m', 'Upstream version 7.1.0+ds', '--no-sign', 
'upstream/7.1.0+ds', '6fc11be4e1b0420ab8687472d42f263f829a8ad7']
gbp:debug: ['git', 'show-ref', '--verify', 'refs/heads/master']
gbp:debug: ['git', 'rev-parse', '--quiet', '--verify', 'master']
gbp:debug: ['git', 'show', '--pretty=medium', 'master:debian/source/format']
gbp:debug: 3.0 (quilt) package, replacing debian/ dir
gbp:info: Replacing upstream source on 'master'
gbp:debug: ['git', 'ls-tree', '-z', 'upstream/7.1.0+ds^{tree}', '--']
gbp:debug: ['git', 'ls-tree', '-z', 'master^{tree}', '--']
gbp:debug: Using 4b6a9f33f2b5c8ad0551b2f97d9fd57a7de84350 as debian/ tree
gbp:debug: ['git', 'mktree', '-z']
gbp:debug: ['git', 'commit-tree', '4ca5bccf2c32c04011a1c86e0bab9cdabcb5e0ab', 
'-p', 'master^{commit}', '-p', 'upstream/7.1.0+ds^{commit}']
gbp:debug: ['git', 'update-ref', '-m', 'gbp: Updating master after import of 
upstream/7.1.0+ds', 'refs/heads/master', 
'6491bce61e4ffc09beb8dab30c9c4be3d4bb298c']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/master']
gbp:debug: ['git', 'reset', '--quiet', '--hard', 
'6491bce61e4ffc09beb8dab30c9c4be3d4bb298c', '--']
gbp:debug: ['git', 'symbolic-ref', 'HEAD']
gbp:debug: ['git', 'show-ref', 'refs/heads/master']
gbp:debug: rm ['-rf', '/root/rocm/tmpm90h50zf'] []
gbp:info: Successfully imported version 7.1.0+ds of ../rocm_7.1.0+ds.orig.tar.xz

Reply via email to