Your message dated Sun, 29 May 2022 15:08:29 +0000
with message-id <[email protected]>
and subject line Bug#875305: fixed in python-debian 0.1.44
has caused the Debian Bug report #875305,
regarding Support for finding changelog.Debian.gz in perl-base
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
875305: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=875305
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: python3-debian
Version: 0.1.30
Severity: normal
Tags: patch

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 <[email protected]>
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/   [email protected]
Debian Developer   http://www.debian.org/         [email protected]
GPG fingerprint    90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7
>From 5b47de7a0a8d06dad94681998721e88ccae99895 Mon Sep 17 00:00:00 2001
From: Simon Ruggier <[email protected]>
Date: Wed, 14 Jun 2017 14:44:53 -0400
Subject: [PATCH 1/3] Remove trailing whitespace from debfile.py

---
 lib/debian/debfile.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/debian/debfile.py b/lib/debian/debfile.py
index 718159f..6f611a7 100644
--- a/lib/debian/debfile.py
+++ b/lib/debian/debfile.py
@@ -44,7 +44,7 @@ class DebError(ArError):
 
 class DebPart(object):
     """'Part' of a .deb binary package.
-    
+
     A .deb package is considered as made of 2 parts: a 'data' part
     (corresponding to the possibly compressed 'data.tar' archive embedded
     in a .deb) and a 'control' part (the 'control.tar.gz' archive). Each of
@@ -215,7 +215,7 @@ class DebControl(DebPart):
     def debcontrol(self):
         """ Return the debian/control as a Deb822 (a Debian-specific dict-like
         class) object.
-        
+
         For a string representation of debian/control try
         .get_content('control') """
 
-- 
2.11.0

>From 185a922b5d5bb755c174f49b85d7b80f84561c80 Mon Sep 17 00:00:00 2001
From: Simon Ruggier <[email protected]>
Date: Wed, 14 Jun 2017 14:45:09 -0400
Subject: [PATCH 2/3] debfile: Use with statement to open GzipFile object

---
 lib/debian/debfile.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/lib/debian/debfile.py b/lib/debian/debfile.py
index 6f611a7..ff080bb 100644
--- a/lib/debian/debfile.py
+++ b/lib/debian/debfile.py
@@ -333,9 +333,8 @@ class DebFile(ArFile):
         for fname in [ CHANGELOG_DEBIAN % self.__pkgname,
                 CHANGELOG_NATIVE % self.__pkgname ]:
             if self.data.has_file(fname):
-                gz = gzip.GzipFile(fileobj=self.data.get_file(fname))
-                raw_changelog = gz.read()
-                gz.close()
+                with gzip.GzipFile(fileobj=self.data.get_file(fname)) as gz:
+                    raw_changelog = gz.read()
                 return Changelog(raw_changelog)
         return None
 
-- 
2.11.0

>From 09788135d4ff73e4783f9e3478c3e21393f97196 Mon Sep 17 00:00:00 2001
From: Simon Ruggier <[email protected]>
Date: Wed, 14 Jun 2017 15:26:43 -0400
Subject: [PATCH 3/3] Try finding changelog files via the source package name
 as well

---
 lib/debian/debfile.py | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/lib/debian/debfile.py b/lib/debian/debfile.py
index ff080bb..bd3a94b 100644
--- a/lib/debian/debfile.py
+++ b/lib/debian/debfile.py
@@ -296,14 +296,20 @@ class DebFile(ArFile):
                 compressed_part_name(CTRL_PART)))
         self.__parts[DATA_PART] = DebData(self.getmember(
                 compressed_part_name(DATA_PART)))
-        self.__pkgname = None   # updated lazily by __updatePkgName
+
+        # updated lazily by __updatePkgName
+        self.__pkgname = None
+        self.__srcpkgname = None
 
         f = self.getmember(INFO_PART)
         self.__version = f.read().strip()
         f.close()
 
     def __updatePkgName(self):
-        self.__pkgname = self.debcontrol()['package']
+        debcontrol = self.debcontrol()
+        self.__pkgname = debcontrol['package']
+        if 'source' in debcontrol:
+            self.__srcpkgname = self.debcontrol()['source']
 
     version = property(lambda self: self.__version)
     data = property(lambda self: self.__parts[DATA_PART])
@@ -330,8 +336,15 @@ class DebFile(ArFile):
         if self.__pkgname is None:
             self.__updatePkgName()
 
-        for fname in [ CHANGELOG_DEBIAN % self.__pkgname,
-                CHANGELOG_NATIVE % self.__pkgname ]:
+        fnames = [CHANGELOG_DEBIAN % self.__pkgname]
+        # Try the source package name as well, if applicable
+        if self.__srcpkgname:
+            fnames.append(CHANGELOG_DEBIAN % self.__srcpkgname)
+        fnames.append(CHANGELOG_NATIVE % self.__pkgname)
+        if self.__srcpkgname:
+            fnames.append(CHANGELOG_NATIVE % self.__srcpkgname)
+
+        for fname in fnames:
             if self.data.has_file(fname):
                 with gzip.GzipFile(fileobj=self.data.get_file(fname)) as gz:
                     raw_changelog = gz.read()
-- 
2.11.0


--- End Message ---
--- Begin Message ---
Source: python-debian
Source-Version: 0.1.44
Done: Stuart Prescott <[email protected]>

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 [email protected],
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Stuart Prescott <[email protected]> (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 [email protected])


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

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 
<[email protected]>
Changed-By: Stuart Prescott <[email protected]>
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-----

--- End Message ---
-- 
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-python-debian-maint

Reply via email to