gbp import-orig --uscan for the non-trivial cases
Hi,
I am slowly converting my packages that have a serious upstream to
preserving upstream's git history in the upstream/latest branch. Otto's
excellent article on
https://optimizedbyotto.com/post/debian-packaging-from-git/ explains how
to do this for a new package, and a properly configured git-buildpackage
will (in gbp import-orig --uscan) automatically do the right thing for
already existing packages. sudo
(https://salsa.debian.org/sudo-team/sudo) has been converted with Otto's
help.
https://salsa.debian.org/debian/entr/-/blob/debian/latest/debian/README.source.md?ref_type=heads
gives advice how to work with such packages
However, I have two packages which need a level of debian/watch foo that
is beyond my current knowledge and I would ask for help and mentoring
here.
Exhibit A is sniproxy, a package I have recently taken over. Upstream
does proper releases, but seldomly. Last proper release was in 2023.
trixy, forky and sid have a git snapshot packaged in 2024. With the goal
of packaging a current git snapshot while preserving upstream's history
in Debian's git, I tried the following combination of the "Github" and
the "direct access to the git repository (HEAD)" recipe from
debian-watch(5):
| Version: 5
|
| Template: Github
| Owner: dlundquist
| Project: sniproxy
|
| Source: https://github.com/dlundquist/sniproxy.git
| Matching-Pattern: HEAD
| Mode: git
| Filename-Mangle: s/^(@PACKAGE@)-0\.0/$1-0.6.2/
| Repack: yes
| Compression: xz
With that, I hoped that gbp import-orig --scan would build an upstream
tarball from git and use that for packaging. But it doesn't.
| $ gbp import-orig --uscan --verbose
| 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/latest']
| gbp:debug: ['git', 'status', '--porcelain']
| gbp:info: Launching uscan...
| uscan warn: more than one main upstream tarballs listed.
| Newest version of sniproxy on remote site is 0.6.2~git20240702.2d99653, local version is 0.6.1+git20250616
| => Newer package available from:
| => https://github.com/dlundquist/sniproxy.git HEAD
| gbp:error: Couldn't find source in uscan output
| $
| $ uscan --debug
| uscan info: Scan watch files in .
| uscan debug: Found ./debian
| uscan info: Check debian/watch and debian/changelog in .
| uscan info: package="sniproxy" version="0.6.1+git20250616-1~" (as seen in debian/changelog)
| uscan info: package="sniproxy" version="0.6.1+git20250616" (no epoch/revision)
| uscan info: ./debian/changelog sets package="sniproxy" version="0.6.1+git20250616"
| uscan info: Process watch file at: debian/watch
| package = sniproxy
| version = 0.6.1+git20250616
| pkg_dir = .
| uscan debug: parse options: << ==EOF==
| Template: Github
| Owner: dlundquist
| Project: sniproxy
|
| ==EOF==
| uscan info: Parsing downloadurlmangle: s%(api.github.com/repos/[^/]+/[^/]+)/git/refs/%$1/tarball/refs/%g
| uscan info: Parsing filenamemangle: s%.*/(?:[^/]+\-)?(?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*))%sniproxy-$1.tar.gz%
| uscan info: Parsing pgpmode: none
| uscan info: Parsing searchmode: plain
| uscan debug: $self->{'pgpmode'}=none, $self->{'pgpsigurlmangle'}=undef
| uscan info: Last orig.tar.* tarball version (from debian/changelog): 0.6.1+git20250616
| uscan info: Last orig.tar.* tarball version (dversionmangled): 0.6.1+git20250616
| uscan debug: watch file has:
| $base = https://api.github.com/repos/dlundquist/sniproxy/git/matching-refs/tags/
| $filepattern = https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/(?:[^/]+\-)?(?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*))
| $lastversion = 0.6.1+git20250616
| $action =
| mode = http
| pgpmode = none
| versionmode = newer
| $site = https://api.github.com
| $basedir = /repos/dlundquist/sniproxy/git/matching-refs/tags/
| uscan debug: line: search()
| uscan info: Requesting URL:
| https://api.github.com/repos/dlundquist/sniproxy/git/matching-refs/tags/
| uscan info: Found the following matching files on the web page (newest first):
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1 (0.6.1) index=0.6.1-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.0 (0.6.0) index=0.6.0-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.5.0 (0.5.0) index=0.5.0-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.4.0 (0.4.0) index=0.4.0-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.6 (0.3.6) index=0.3.6-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.5 (0.3.5) index=0.3.5-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.4 (0.3.4) index=0.3.4-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.3 (0.3.3) index=0.3.3-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.2 (0.3.2) index=0.3.2-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3.1 (0.3.1) index=0.3.1-0
| https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.3 (0.3) index=0.3-0
| uscan info: Looking at $base = https://api.github.com/repos/dlundquist/sniproxy/git/matching-refs/tags/ with
| $filepattern = https://api.github.com/repos/[^/]+/[^/]+/git/refs/tags/(?:[^/]+\-)?(?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*)) found
| $newfile = https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1
| $mangled_newversion = 0.6.1
| $newversion = 0.6.1
| $lastversion = 0.6.1+git20250616
| uscan debug: line: get_upstream_url()
| uscan info: Matching target for downloadurlmangle: https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1
| uscan debug: safe_replace input="https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1"
| uscan debug: safe_replace with regexp="(api.github.com/repos/[^/]+/[^/]+)/git/refs/", replacement="$1/tarball/refs/", and flags="g"
| uscan debug: After downloadurlmangle: https://api.github.com/repos/dlundquist/sniproxy/tarball/refs/tags/0.6.1
| uscan info: Upstream URL(+tag) to download is identified as https://api.github.com/repos/dlundquist/sniproxy/tarball/refs/tags/0.6.1
| uscan debug: line: get_newfile_base()
| uscan info: Matching target for filenamemangle: https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1
| uscan debug: safe_replace input="https://api.github.com/repos/dlundquist/sniproxy/git/refs/tags/0.6.1"
| uscan debug: safe_replace with regexp=".*/(?:[^/]+\-)?(?:[-_]?[Vv]?(\d[\-+\.:\~\da-zA-Z]*))", replacement="sniproxy-$1.tar.gz", and flags=""
| uscan debug: After filenamemangle: sniproxy-0.6.1.tar.gz
| uscan info: Filename (filenamemangled) for downloaded file: sniproxy-0.6.1.tar.gz
| uscan debug: line: cmp_versions()
| uscan info: Newest version of sniproxy on remote site is 0.6.1, local version is 0.6.1+git20250616
| uscan info: => Only older package available from:
| => https://api.github.com/repos/dlundquist/sniproxy/tarball/refs/tags/0.6.1
| uscan debug: line: download_file_and_sig()
| uscan debug: line: mkorigtargz()
| uscan debug: parse options: << ==EOF==
| Source: https://github.com/dlundquist/sniproxy.git
| Matching-Pattern: HEAD
| Mode: git
| Filename-Mangle: s/^(sniproxy)-0\.0/$1-0.6.2/
| Repack: yes
| Compression: xz
|
| ==EOF==
| uscan info: Parsing compression: xz
| uscan info: Parsing filenamemangle: s/^(sniproxy)-0\.0/$1-0.6.2/
| uscan info: Parsing mode: git
| uscan info: Parsing repack: yes
| uscan debug: $self->{'pgpmode'}=default, $self->{'pgpsigurlmangle'}=undef
| uscan warn: more than one main upstream tarballs listed. [Devscripts::Uscan::WatchSource: 614]
| uscan info: Last orig.tar.* tarball version (from debian/changelog): 0.6.1+git20250616
| uscan info: Last orig.tar.* tarball version (dversionmangled): 0.6.1+git20250616
| uscan debug: watch file has:
| $base = https://github.com/dlundquist/sniproxy.git
| $filepattern = HEAD
| $lastversion = 0.6.1+git20250616
| $action =
| mode = git
| pgpmode = default
| versionmode = newer
| $site = https://github.com/dlundquist/sniproxy.git
| $basedir =
| uscan debug: line: search()
| uscan debug: Execute: git clone --bare --depth=1 https://github.com/dlundquist/sniproxy.git ../sniproxy-temporary.358789.git...
| Cloning into bare repository '../sniproxy-temporary.358789.git'...
| remote: Enumerating objects: 107, done.
| remote: Counting objects: 100% (107/107), done.
| remote: Compressing objects: 100% (94/94), done.
| remote: Total 107 (delta 27), reused 27 (delta 1), pack-reused 0 (from 0)
| Receiving objects: 100% (107/107), 103.52 KiB | 3.98 MiB/s, done.
| Resolving deltas: 100% (27/27), done.
| uscan debug: git log -1 --date=format-local:%Y%m%d --no-show-signature --pretty=0.0~git%cd.%h
| uscan info: Looking at $base = https://github.com/dlundquist/sniproxy.git with
| $filepattern = HEAD found
| $newfile = HEAD
| $mangled_newversion = 0.0~git20240702.2d99653
| $newversion = 0.0~git20240702.2d99653
| $lastversion = 0.6.1+git20250616
| uscan debug: line: get_upstream_url()
| uscan info: Upstream URL(+tag) to download is identified as https://github.com/dlundquist/sniproxy.git HEAD
| uscan debug: line: get_newfile_base()
| uscan info: Matching target for filenamemangle: sniproxy-0.0~git20240702.2d99653.tar.xz
| uscan debug: safe_replace input="sniproxy-0.0~git20240702.2d99653.tar.xz"
| uscan debug: safe_replace with regexp="^(sniproxy)-0\.0", replacement="$1-0.6.2", and flags=""
| uscan debug: After filenamemangle: sniproxy-0.6.2~git20240702.2d99653.tar.xz
| uscan info: Newest upstream tarball version from the filenamemangled filename: 0.6.2~git20240702.2d99653
| uscan info: Filename (filenamemangled) for downloaded file: sniproxy-0.6.2~git20240702.2d99653.tar.xz
| uscan debug: line: cmp_versions()
| Newest version of sniproxy on remote site is 0.6.2~git20240702.2d99653, local version is 0.6.1+git20250616
| => Newer package available from:
| => https://github.com/dlundquist/sniproxy.git HEAD
| uscan debug: line: download_file_and_sig()
| uscan debug: line: mkorigtargz()
| uscan debug: Keep git repo (../sniproxy-temporary.358789.git)
| uscan info: Scan finished
| $
can somebody explain this output to me? It looks like it finds git HEAD,
builds the intended version number from it, decides that it is more
current than the most recent release, and then aborts (because there is
no upstream tarball?).
Am I supposed to build the upstream tarball myself wit git archive?
Exhibit B is console-log, a package that is non-native for historical
reasons and which has no upstream. I am the upstream author, and I
maintain the "upstream" sources on salsa in the main branch. I have a
single "upstream" release tag, v2.0, and my debian/watch,
| version: 5
|
| Source: https://salsa.debian.org/debian/console-log.git
| Matching-Pattern: refs/tags/v@ANY_VERSION@
| Git-Mode: full
| Mode: git
at least finishes successfully. Is that the correct way to do it? Does
this only work because I built an upstream tarball manually (that was
before Debconf, I didn't know about Otto's way to do it back then)?
I would like to hear your opinion and maybe even take a step forward
towards my goals.
Greetings
Marc
--
-----------------------------------------------------------------------------
Marc Haber | "I don't trust Computers. They | Mailadresse im Header
Leimen, Germany | lose things." Winona Ryder | Fon: *49 6224 1600402
Nordisch by Nature | How to make an American Quilt | Fax: *49 6224 1600421
Reply to: