When importing packages that were built and signed a long time ago (>20 years),
gbp import-dsc fails to determine correcly the version for the package (and for
upstream).
This prevents me from importing all my old history of packages in one go to
GIT. I found a workaround by importing manually one DSC file at a time and then
fixing the git tags manually.
Take, for example, the following situation. Compartment, which is a package of over 20 years, with the following DSC files:
jfs@silicio:compartment$ ls -ltr ../*dsc
-rw-r--r-- 1 jfs jfs 681 ene 6 2003 ../compartment_1.1-2.dsc
-rw-r--r-- 1 jfs jfs 681 ene 6 2003 ../compartment_1.1-1.dsc
-rw-r--r-- 1 jfs jfs 682 ene 6 2003 ../compartment_1.1-3.dsc
-rw-r--r-- 1 jfs jfs 682 may 27 2003 ../compartment_1.1-4.dsc
-rw-r--r-- 1 jfs jfs 682 oct 28 2003 ../compartment_1.1-5.dsc
-rw-r--r-- 1 jfs jfs 688 dic 24 2003 ../compartment_1.1.0-1.dsc
-rw-r--r-- 1 jfs jfs 700 feb 25 2005 ../compartment_1.1.0-2.dsc
-rw-r--r-- 1 jfs jfs 700 abr 30 2006 ../compartment_1.1.0-3.dsc
-rw-r--r-- 1 jfs jfs 972 may 31 2008 ../compartment_1.1.0-4.dsc
-rw-r--r-- 1 jfs jfs 1725 ene 4 2017 ../compartment_1.1.0-5.dsc
The oldest one uses the format from GnuPG at the time which has a Version: header which is as follows:
-----BEGIN PGP SIGNED MESSAGE-----
Format: 1.0
Source: compartment
Version: 1.1-1
Binary: compartment
Maintainer: Javier Fernandez-Sanguino Pena <jfs@computer.org>
Architecture: any
Standards-Version: 3.1.0
Build-Depends: debhelper
Files:
e97310bc577ee033c5c7fa753ba5d7d1 23942 compartment_1.1.orig.tar.gz
58cf68a70f34e6df2f6f61ec44ea8ff6 2261 compartment_1.1-1.diff.gz
iQCVAwUBPNB9SPtEPvakNq0lAQEm/gQAtdE0pWwH0XWzV4BDm6kumzgIvx+y3HHZ
2Erbyv3/9trVmVwaCgCa2XS3hbzCxGqJJU8ysO005BgnKen9rNLfe4rZYzhVbprD
otIlkhZzkKsDooIRpR862ZVPytAuBxiBymp3pUv5wEh6T/hsmPY57Hd5335W3wsw
RW+SynTqrC8=
=+bMW
-----END PGP SIGNATURE-----
The dscs from version 1.1.0-2 and later have a PGP signature header with the following content:
iQCVAwUBQh5wrPtEPvakNq0lAQI1oQQAgoaGTvODCDqMbp7aLx4FEb+xhmYWRLYG
c1TJ5ukhXC57H8rqQsSrNCAopW1QvDKQt/GZZkj+OR9SZib2kKhCEJHYNuSpTQeb
5npdKDQLrisWaEd6LOIdKxFSDIgG/20wUayPpg6behqTCnFzdcBI8wjh5CU2JulO
G7SKvG7D4RI=
=5vpc
-----END PGP SIGNATURE-----
If I try to import them all using import-dscs into a single GIT repository, the following happens:
jfs@silicio:compartment-test$ gbp import-dscs /home/jfs/debian/security/compartment/*dsc
gbp:info: Version '1.1.0-2' imported under '/tmp/compartment-test'
gbp:info: Version '1.1.0-3' imported under '/tmp/compartment-test'
gbp:info: Version '1.1.0-4' imported under '/tmp/compartment-test'
gbp:info: Version '1.1.0-5' imported under '/tmp/compartment-test'
gbp:info: Version '2.6.3ia' imported under '/tmp/compartment-test'
gbp:warning: Version 2.6.3ia already imported.
gbp:warning: Version 2.6.3ia already imported.
gbp:warning: Version 2.6.3ia already imported.
gbp:warning: Version 2.6.3ia already imported.
gbp:warning: Version 2.6.3ia already imported.
gbp:info: Everything imported under /tmp/compartment-test
And the following is the result on tags:
jfs@silicio:compartment-test$ git tag
debian/1.1.0-2
debian/1.1.0-3
debian/1.1.0-4
debian/1.1.0-5
debian/2.6.3ia
upstream/1.1.0
upstream/2.6.3ia
As you can see, a tag 'debian/2.6.3ia' has been created as well as a
'upstream/2.6.3ia'. This appears to be due to import-dsc misinterpreting the Version: header
used in the PGP signature footer.
The attached proposed patch skips the section of the DSCs files that contain
the PGP signature, to avoid the parsing of the headers in that section of the
DSC file.
It seems to work find when bulk importing. With this patch, gbp import-dscs now works fine in my case:
jfs@silicio:compartment-test-fix$ gbp import-dscs /home/jfs/debian/security/compartment/*dsc
gbp:info: Version '1.1-1' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1-2' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1-3' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1-4' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1-5' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1.0-1' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1.0-2' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1.0-3' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1.0-4' imported under '/tmp/compartment-test-fix'
gbp:info: Version '1.1.0-5' imported under '/tmp/compartment-test-fix'
gbp:info: Everything imported under /tmp/compartment-test-fix
jfs@silicio:compartment-test-fix$ git tag
debian/1.1-1
debian/1.1-2
debian/1.1-3
debian/1.1-4
debian/1.1-5
debian/1.1.0-1
debian/1.1.0-2
debian/1.1.0-3
debian/1.1.0-4
debian/1.1.0-5
upstream/1.1
upstream/1.1.0
Could you please review and upload this fix to the new release?
Thanks!
Javier