[Git][reproducible-builds/diffoscope][master] 5 commits: autopkgtest: only install appt and dexdump on architectures where they are available

Mattia Rizzolo (@mattia) gitlab at salsa.debian.org
Tue Feb 28 17:39:09 UTC 2023



Mattia Rizzolo pushed to branch master at Reproducible Builds / diffoscope


Commits:
61f7c2b3 by Mattia Rizzolo at 2023-02-28T16:38:00+01:00
autopkgtest: only install appt and dexdump on architectures where they are available

Closes: #1031297
Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
6eb8d06f by Mattia Rizzolo at 2023-02-28T17:01:15+01:00
pdf: drop backward compatibility assignment

This is not really a public API

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
8f710cd5 by Mattia Rizzolo at 2023-02-28T18:14:52+01:00
pdf: fix flake warnings

In particular, just reading the code I suspect that pyPDF 1.x support
was broken (as PdfReader was referenced incorrectly)

1.x support is untested.

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
4b31ba63 by Mattia Rizzolo at 2023-02-28T18:19:20+01:00
Release diffoscope version 237

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -
2559c286 by Mattia Rizzolo at 2023-02-28T18:38:15+01:00
Open new changelog entry for version 238.

Signed-off-by: Mattia Rizzolo <mattia at debian.org>

- - - - -


6 changed files:

- debian/changelog
- debian/tests/control
- debian/tests/control.sh
- debian/tests/pytest
- diffoscope/__init__.py
- diffoscope/comparators/pdf.py


Changes:

=====================================
debian/changelog
=====================================
@@ -1,8 +1,19 @@
-diffoscope (237) UNRELEASED; urgency=medium
+diffoscope (238) UNRELEASED; urgency=medium
 
-  * WIP (generated upon release).
+  * WIP (Generated on release).
+  * Please target 238 to experimental!
 
- -- Chris Lamb <lamby at debian.org>  Fri, 17 Feb 2023 08:49:40 -0800
+ -- Mattia Rizzolo <mattia at debian.org>  Tue, 28 Feb 2023 18:37:09 +0100
+
+diffoscope (237) unstable; urgency=medium
+
+  * autopkgtest: only install appt and dexdump on architectures where they are
+    available. (Closes: #1031297)
+  * compartors/pdf:
+    + Drop backward compatibility assignment.
+    + Fix flake warnings, potentially reinstating PyPDF 1.x support (untested).
+
+ -- Mattia Rizzolo <mattia at debian.org>  Tue, 28 Feb 2023 18:16:09 +0100
 
 diffoscope (236) unstable; urgency=medium
 


=====================================
debian/tests/control
=====================================
@@ -7,7 +7,7 @@
 #   $ mv debian/tests/control.tmp debian/tests/control
 
 Tests: pytest-with-recommends
-Depends: python3-all, diffoscope, black, python3-pytest, python3-h5py, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], aapt, abootimg, acl, apksigcopier, apksigner, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, coreboot-utils, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, dexdump, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fonttools, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, hdf5-tools, html2text, imagemagick, jsbeautifier, libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, lzip, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, openssl, pgpdump, poppler-utils, procyon-decompiler, python3-pdfminer, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, u-boot-tools, unzip, wabt, xmlbeans, xxd, xz-utils, zip, zstd, androguard, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
+Depends: python3-all, diffoscope, black, python3-pytest, python3-h5py, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], aapt [amd64 arm64 armel armhf i386 mips64el mipsel], abootimg, acl, apksigcopier, apksigner, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, coreboot-utils, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, dexdump [amd64 arm64 armhf i386], docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fonttools, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, hdf5-tools, html2text, imagemagick, jsbeautifier, libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, lzip, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, openssl, pgpdump, poppler-utils, procyon-decompiler, python3-pdfminer, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, u-boot-tools, unzip, wabt, xmlbeans, xxd, xz-utils, zip, zstd, androguard, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
 
 Tests: pytest
 Depends: python3-all, diffoscope, python3-pytest, python3-h5py, file, python3-tlsh


=====================================
debian/tests/control.sh
=====================================
@@ -23,3 +23,5 @@ sed -i "s,apktool,apktool [!ppc64el !s390x]," debian/tests/control.tmp
 sed -i "s,fp-utils,fp-utils [!ppc64el !s390x]," debian/tests/control.tmp
 sed -i "s,oggvideotools,oggvideotools [!s390x]," debian/tests/control.tmp
 sed -i "s,python3-androguard,androguard," debian/tests/control.tmp
+sed -i "s,dexdump,dexdump [amd64 arm64 armhf i386]," debian/tests/control.tmp
+sed -i "s,aapt,aapt [amd64 arm64 armel armhf i386 mips64el mipsel]," debian/tests/control.tmp


=====================================
debian/tests/pytest
=====================================
@@ -9,7 +9,7 @@ fi
 
 export LIBGUESTFS_MEMSIZE=128
 if [ "$(basename "$0")" = "pytest-with-recommends" ]; then
-    export DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS="apktool zipinfo pedump oggDump ppudump otool lipo radare2"
+    export DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS="aapt apktool dexdump zipinfo pedump oggDump ppudump otool lipo radare2"
 fi
 
 for py in $(py3versions -s); do


=====================================
diffoscope/__init__.py
=====================================
@@ -17,4 +17,4 @@
 # You should have received a copy of the GNU General Public License
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
-VERSION = "236"
+VERSION = "237"


=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -3,6 +3,7 @@
 #
 # Copyright © 2014-2015 Jérémy Bobbio <lunar at debian.org>
 # Copyright © 2015-2016, 2018-2023 Chris Lamb <lamby at debian.org>
+# Copyright © 2023 Mattia Rizzolo <mattia at debian.org>
 #
 # diffoscope is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,16 +36,21 @@ logger = logging.getLogger(__name__)
 
 try:
     try:
+        # PyPDF 3.x
         import pypdf
     except ImportError:
+        # PyPDF2 1.x-2.x
         import PyPDF2 as pypdf
 
     try:
+        # pyPDF 2.x-3.x
         import pypdf.PdfReader as PdfReader
     except ImportError:
+        # PyPDF2 1.x
         import pypdf.PdfFileReader as PdfReader
 
     try:
+        # PyPDF 3.x
         from pypdf.errors import PdfReadError
     except ImportError:
         try:
@@ -82,7 +88,8 @@ class PdfFile(File):
             pkg = get_package_provider("pypdf")
             infix = f" from the '{pkg}' package " if pkg else " "
             self.add_comment(
-                f"Installing the 'pypdf' Python module{infix}may produce a better output."
+                f"Installing the 'pypdf' Python module{infix}"
+                "may produce a better output."
             )
         else:
             difference = Difference.from_text(
@@ -118,7 +125,7 @@ class PdfFile(File):
 
     def dump_pypdf_metadata(self, file):
         try:
-            pdf = pypdf.PdfReader(file.path)
+            pdf = PdfReader(file.path)
             document_info = pdf.metadata
 
             if document_info is None:
@@ -130,17 +137,16 @@ class PdfFile(File):
 
             return "\n".join(xs)
         except PdfReadError as e:
-            msg = f"Could not extract pypdf metadata from {os.path.basename(file.name)}: {e}"
+            msg = "Could not extract pypdf metadata from {}: {}".format(
+                os.path.basename(file.name), e
+            )
             self.add_comment(msg)
             logger.error(msg)
             return ""
 
-    # for backward compatibility:
-    dump_pypdf2_metadata = dump_pypdf_metadata
-
     def dump_pypdf_annotations(self, file):
         try:
-            pdf = pypdf.PdfReader(file.path)
+            pdf = PdfReader(file.path)
 
             xs = []
             for x in range(len(pdf.pages)):
@@ -151,15 +157,14 @@ class PdfFile(File):
                         subtype = annot.getObject()["/Subtype"]
                         if subtype == "/Text":
                             xs.append(annot.getObject()["/Contents"])
-                except:
+                except KeyError:
                     pass
 
             return "\n".join(xs)
         except PdfReadError as e:
-            msg = f"Could not extract pypdf annotations from {os.path.basename(file.name)}: {e}"
+            msg = "Could not extract pypdf annotations from {}: {}".format(
+                os.path.basename(file.name), e
+            )
             file.add_comment(msg)
             logger.error(msg)
             return ""
-
-    # for backward compatibility:
-    dump_pypdf2_annotations = dump_pypdf_annotations



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/68464b1fcc5d27484307025cd3f23a2550516261...2559c2865535623dbaa0eccb14485e9f1cf5af93

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/68464b1fcc5d27484307025cd3f23a2550516261...2559c2865535623dbaa0eccb14485e9f1cf5af93
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20230228/1869efd9/attachment.htm>


More information about the rb-commits mailing list