On 2/28/23 20:26, gregor herrmann wrote:
On Tue, 28 Feb 2023 07:39:15 +0400, Yadd wrote:
thanks for this powerful tool. When using `dpt prepare` on a package
that have backports, it shows the difference with last backport, not
last unstable upload. You can try for example with lemonldap-ng.
Indeed, I've encountered this too, and it's annoying :)
Any help in finding an improvement is very welcome.
In lib/dpt-lib.sh, maybe you could replace
TAG=$(git rev-list -n1 --tags)
or simply
TAG=$(git describe --abbrev=0)
I have a hunch that this doesn't work in all cases, and before
testing it, I even hit another issue:
Example: libsql-translator-perl
% git tag | grep debian/1\.
archive/debian/1.60-1
archive/debian/1.61-1
archive/debian/1.62-1
debian/1.60-1
debian/1.61-1
debian/1.62-1
debian/1.62-2
debian/1.62-3
% git rev-list -n1 --tags=debian
ed7aa767edfdb042a5bbc4a19722236e17afd891
[matches tag: debian/1.62-3]
% git describe --abbrev=0
archive/debian/1.62-1
Ehm, no; first we don't want the archive/debian/* tag (from a
previous dgit upload) -- although maybe they are the same in
practice? -- , and second we want the -3 upload.
Maybe like this:
% git describe --abbrev=0 --tags
debian/1.62-3
Not like this:
% git describe --abbrev=0 --match "debian/*"
debian/1.62-1
But maybe this:
% git describe --abbrev=0 --match "debian/*" --tags
debian/1.62-3
Anyway, now to my actual question:
This gitddiff function is used for 2 purposes / on 2 occasions in the
dpt-* code:
- before working on a package, for whatever reason, after pulling,
to check what happened in the repo since the last upload;
that's the dpt-prepare case
- after importing a new upstream release, to see all changes since
the last upload and to know what we need to change (that's in
dpt-import-orig)
- (I also have a git alias:
ddiff = "!git diff --ignore-space-at-eol $(if [ \"$(dpkg-source --print-format .)\" !=
\"3.0 (native)\" ]; then git rev-list -n1 --tags=debian; else git rev-list -n1 --tags; fi)"
so `git ddiff' does basically the same at any time)
I'm wondering that `git describe …' will do after `dpt-import-orig',
so let's try with our example package libsql-translator-perl:
`dpt import-orig' …
% git rev-list -n1 --tags=debian
ed7aa767edfdb042a5bbc4a19722236e17afd891
(still the same debian/1.62-3)
% git describe --abbrev=0
upstream/1.63
Ha, that's what I suspected :)
% git describe --abbrev=0 --tags
upstream/1.63
Same …
But this works:
% git describe --abbrev=0 --match "debian/*" --tags # [1]
debian/1.62-3
So this looks quite well.
Maybe, in order to git rid of the separation between native and
non-native package, something funky as
% git describe --abbrev=0 --match "$(gbp config DEFAULT.debian-tag | sed -e
's/%(version)s/*/g;')" --tags # [2]
debian/1.62-3
:)
Alright, maybe we all try out either [1] or [2] a bit?
I've updated my .gitconfig and my local version of
scripts/lib/dpt-lib.sh to use [2].
Hi,
I tried also [2], perfect with all Perl packages I've locally + 1500
nodejs packages, works perfectly!
Cheers,
Yadd