[Git][reproducible-builds/diffoscope][master] Use dumppdf from python3-pdfminer if we do not see any other differences from...

Chris Lamb gitlab at salsa.debian.org
Thu Mar 5 22:01:37 UTC 2020



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
abd13635 by Chris Lamb at 2020-03-05T14:00:48-08:00
Use dumppdf from python3-pdfminer if we do not see any other differences from pdftext, etc. (Closes: reproducible-builds/diffoscope#92)

- - - - -


4 changed files:

- debian/control
- debian/tests/control
- diffoscope/comparators/pdf.py
- diffoscope/external_tools.py


Changes:

=====================================
debian/control
=====================================
@@ -61,6 +61,7 @@ Build-Depends:
  python3-debian <!nocheck>,
  python3-distro <!nocheck>,
  python3-docutils,
+ python3-dumppdf <!nocheck>,
  python3-guestfs <!nocheck>,
  python3-jsondiff <!nocheck>,
  python3-libarchive-c,


=====================================
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, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, imagemagick, jsbeautifier, libarchive-tools, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, pgpdump, poppler-utils, procyon-decompiler, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, unzip, wabt, xmlbeans, xxd | vim-common, xz-utils, zip, zstd, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf2, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
+Depends: python3-all, diffoscope, black, python3-pytest, file, linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, apktool [!ppc64el !s390x], binutils-multiarch, bzip2, caca-utils, colord, db-util, default-jdk-headless | default-jdk | java-sdk, device-tree-compiler, docx2txt, e2fsprogs, enjarify, ffmpeg, fontforge-extras, fp-utils [!ppc64el !s390x], genisoimage, gettext, ghc, ghostscript, giflib-tools, gnumeric, gnupg, gnupg-utils, imagemagick, jsbeautifier, libarchive-tools, llvm, lz4 | liblz4-tool, mono-utils, ocaml-nox, odt2txt, oggvideotools [!s390x], openssh-client, pgpdump, poppler-utils, procyon-decompiler, python3-pdfminer, r-base-core, rpm2cpio, sng, sqlite3, squashfs-tools, tcpdump, unzip, wabt, xmlbeans, xxd | vim-common, xz-utils, zip, zstd, python3-argcomplete, python3-binwalk, python3-defusedxml, python3-distro, python3-guestfs, python3-jsondiff, python3-progressbar, python3-pypdf2, python3-debian, python3-pyxattr, python3-rpm, python3-tlsh
 
 Tests: pytest
 Depends: python3-all, diffoscope, python3-pytest, file, python3-tlsh


=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -38,6 +38,12 @@ class Pdftotext(Command):
         return ['pdftotext', self.path, '-']
 
 
+class Dumppdf(Command):
+    @tool_required('dumppdf')
+    def cmdline(self):
+        return ['dumppdf', '-adt', self.path]
+
+
 class PdfFile(File):
     DESCRIPTION = "PDF documents"
     FILE_TYPE_RE = re.compile(r'^PDF document\b')
@@ -62,6 +68,11 @@ class PdfFile(File):
 
         xs.append(Difference.from_command(Pdftotext, self.path, other.path))
 
+        # Don't include verbose dumppdf output unless we won't see any any
+        # differences without it.
+        if not any(xs):
+            xs.append(Difference.from_command(Dumppdf, self.path, other.path))
+
         return xs
 
     @staticmethod


=====================================
diffoscope/external_tools.py
=====================================
@@ -28,6 +28,7 @@ EXTERNAL_TOOLS = {
         'FreeBSD': 'libarchive',
         'guix': 'libarchive',
     },
+    'dumppdf': {'debian': 'python3-pdfminer'},
     'bzip2': {'debian': 'bzip2', 'arch': 'bzip2', 'guix': 'bzip2'},
     'cbfstool': {},
     'cd-iccdump': {



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/abd1363563f1e04a136f59302a16d2634dad7dce

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/commit/abd1363563f1e04a136f59302a16d2634dad7dce
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/20200305/15ce04a2/attachment.htm>


More information about the rb-commits mailing list