#875305 Support for finding changelog.Debian.gz in perl-base

#875305#5
Date:
2017-09-10 14:19:15 UTC
From:
To:
So that this good idea and suggested patch don't get lost.
--------------- Forwarded message (begin)

Subject: Support for finding changelog.Debian.gz in perl-base
From: Simon Ruggier <simon80@gmail.com>
Date: Wed, 14 Jun 2017 20:08:41 -0400

Hi all, thanks for making it easy to manipulate Debian packages in Python
code. Debian's perl packages in testing have an unusual layout: the perl
package has only an upstream changelog, while the changelog.Debian.gz is at
/usr/share/doc/perl/changelog.Debian.gz within the perl-base package. Right
now, DebFile fails to find the changelog, because it's looking for it at
/usr/share/doc/perl-base/changelog.Debian.gz.

To support this configuration without adding a special case for perl-base,
I propose checking /usr/share/doc/<source package name>/changelog.Debian.gz
before checking the native changelog path.

In the future, if any packages are more unusual than this, I think the next
step would be to iterate over all of the files in the package looking for
/usr/share/doc/*/changelog.Debian.gz, but I didn't want to potentially harm
performance, so I didn't go that far.

I've attached two patches with cleanups near the code involved, as well as
a third patch that implements this suggestion. I've tested the updated code
on my system and successfully parsed changelog files out of both perl-base
and other packages that implement normal changelog parsing.

Cheers,
Simon
--------------- Forwarded message (end)
-- 
Stuart Prescott    http://www.nanonanonano.net/   stuart@nanonanonano.net
Debian Developer   http://www.debian.org/         stuart@debian.org
GPG fingerprint    90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7

#875305#10
Date:
2020-12-05 07:51:51 UTC
From:
To:
I've rolled the patches attached to this bug into a merge request on salsa
(with some minor updates as debfile.py itself has changed slightly since they
were submitted).

https://salsa.debian.org/python-debian-team/python-debian/-/merge_requests/32

However, looking carefully at Policy §12.7, searching in /usr/share/doc/
$source/ would be the wrong thing to do.

https://www.debian.org/doc/debian-policy/ch-docs.html#changelog-files-and-release-notes

Non-native packages are required to have /usr/share/doc/$package/
changelog.Debian.gz but the directory (or perhaps the file) can be a symlink;
this is the case for perl-base that is cited in the bug report.

$ dpkg -S /usr/share/doc/perl-base
perl-base: /usr/share/doc/perl-base

$ ls -l /usr/share/doc/perl-base
lrwxrwxrwx 1 root root 4 Nov 10  2017 /usr/share/doc/perl-base -> perl/

$ dpkg -L perl-base | grep changelog
/usr/share/doc/perl/changelog.Debian.gz

and therefore "/usr/share/doc/perl-base/changelog.Debian.gz" exists, but only
via a symlink.

The correct approach to finding the changelog is probably not to look at source
package names, but to try to follow symlinks within the .deb

#875305#13
Date:
2022-05-28 07:09:16 UTC
From:
To:
Hello,

Bug #875305 in python-debian reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/python-debian-team/python-debian/-/commit/ca2bcd1bcb02b8c0b0eedd1b6d3cef9aff75d252
------------------------------------------------------------------------
Follow symlinks inside DebFile to find files

When trying to find files within a .deb, optionally try to follow symlinks
within the same .deb. This allows, for example, changelogs to be located when
/usr/share/doc/$package is a symlink.

Closes: #875305
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/875305

#875305#20
Date:
2022-05-29 15:08:29 UTC
From:
To:
We believe that the bug you reported is fixed in the latest version of
python-debian, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 875305@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stuart Prescott <stuart@debian.org> (supplier of updated python-debian package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
Format: 1.8
Date: Sun, 29 May 2022 12:06:57 +1000
Source: python-debian
Architecture: source
Version: 0.1.44
Distribution: unstable
Urgency: medium
Maintainer: Debian python-debian Maintainers <pkg-python-debian-maint@lists.alioth.debian.org>
Changed-By: Stuart Prescott <stuart@debian.org>
Closes: 875305
Changes:
 python-debian (0.1.44) unstable; urgency=medium
 .
   [ Simon Chopin ]
   * Add support for zstd compression in .deb files (LP: #1923845) with thanks
     also to Athos Ribeiro and Quirin Pamp for contributions to this feature.
 .
   [ Jelmer Vernooij ]
   * Use logging.warning rather than warnings for data problems.
 .
   [ Stuart Prescott ]
   * Support for finding files (including changelog.Debian.gz) that are beyond
     a symlink within the package (Closes: #875305).
   * Update packaging for zstd compressed .deb code.
   * Annotate binutils build-dep with <!nocheck>.
   * Update Standards-Version to 4.6.1 (no changes required).
 .
   [ Niels Thykier ]
   * Various improvements to the round-trip-safe deb822 parser.
Checksums-Sha1:
 d07f3fbcac502baf59cc116af51e6eb5871fd890 2246 python-debian_0.1.44.dsc
 078545d834703d1cfc8a638e358676cb66996ddc 179372 python-debian_0.1.44.tar.xz
 2ae014e6a34ccf1f31033f60748b9db8888226d8 7150 python-debian_0.1.44_amd64.buildinfo
Checksums-Sha256:
 e7316a837285321e18967473b2f9a12eab73d23f8512486064a74912b79bdb2d 2246 python-debian_0.1.44.dsc
 cc71205d3ebedbce97ef81e8da0c7c31cca62589683623b54497561d7b34430d 179372 python-debian_0.1.44.tar.xz
 5e76db62293281c9c0cd3e528ba369f7cc1d0c1617871c967f3800d1feee63f2 7150 python-debian_0.1.44_amd64.buildinfo
Files:
 3cea58b57e59eadded0c6326f9f021f6 2246 python optional python-debian_0.1.44.dsc
 fcff9b3aebaa7b2ce48802225d9f8db2 179372 python optional python-debian_0.1.44.tar.xz
 46697afbabd39150859bc65c8ded1471 7150 python optional python-debian_0.1.44_amd64.buildinfo
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEkOLSwa0Uaht+u4kdu8F+uxOW8vcFAmKS1ekACgkQu8F+uxOW
8ve3FQ//fTkybDE63DWMN3rOPpsBP4a0IGyu+84+QKqa1BAMNcsrNRV9XTK9a6TH
laMbciySyGVelKMjKS/BbqHX4Z1T8tGXJhgX0fIE0u9QOoR5GKsp7g2fKHawgOUH
IAz3UQ6Og28W0CyaPHMN/S8t6B53G1T2bda0j5y/lce8756b4W9yshGREK1RKLKX
xTjysYmI1xCK5TbBfvLTswd8RZLVGSwx4CEoYcve9TUulOI+xKR4LhudBT1AuPd2
SPQpH0lA8qh6U9xNwAWeo4kUTSZyFZAo/bMcj0PG3Kxo/vUHhtNDjHxkZ3g63Qpr
Nudo+JvbNZNR4VD/WnmbID2I6w7j1GIqb2f2bteNaFc6gtfl0dYBPyIUVYEjI91g
1adAHSVBbagv4eQvHV6OnVnyl3a7ol+PqfepnlOlo8OcK7WDJvp0R0cwZ7zHyxRF
PcThHLk7Cz+mmy9TSkrHOlfT8dwZwAtsiZ3sXGsH0dxCerN3A8hqsF9EhCJMVps9
Sv45Pty8y5HTvtZ7+H/AifDh5iX/qPzCV8+gp0QGce3cvGt1H429hem3uP51wEl+
AMLpJuBekaju2CLM1VB5Hc+eKZsB1ZTO4LeCT+N9gxpWMzGeKQBOzyT//bGCabDg
6z1C3LBYh4KjcH9kXbjJKwMOkKJ/sis2gRfilVpmXeae65APBZo=
=gDSN
-----END PGP SIGNATURE-----