Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package diffoscope for openSUSE:Factory 
checked in at 2022-06-28 15:22:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/diffoscope (Old)
 and      /work/SRC/openSUSE:Factory/.diffoscope.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "diffoscope"

Tue Jun 28 15:22:59 2022 rev:35 rq:985550 version:216

Changes:
--------
--- /work/SRC/openSUSE:Factory/diffoscope/diffoscope.changes    2022-06-03 
14:17:03.501347049 +0200
+++ /work/SRC/openSUSE:Factory/.diffoscope.new.1548/diffoscope.changes  
2022-06-28 15:23:18.310025938 +0200
@@ -1,0 +2,33 @@
+Tue Jun 21 09:09:17 UTC 2022 - Sebastian Wagner <sebix+novell....@sebix.at>
+
+- update to version 216:
+ - Print profile output if we were called with --profile and we receive a
+   TERM signal.
+ - Emit a warning if/when we are handling a TERM signal.
+ - Clarify in the code in what situations the main "finally" block gets
+   called, especially in relation to handling TERM signals.
+ - Clarify and tidy some unconditional control flow in diffoscope.profiling.
+- update to version 215:
+ - Bug fixes:
+   - Also catch IndexError (in addition to ValueError) when parsing .pyc
+     files. (Closes: #1012258)
+   - Strip "sticky" etc. from "x.deb: sticky Debian binary package [???]".
+     Thanks to David Pr??vot for the report. (Closes: #1011635)
+   - Correctly package diffoscope's scripts/ directory, fixing the extraction
+     of vmlinuz kernel images. (Closes: reproducible-builds/diffoscope#305)
+   - Correct the logic for supporting different versions of argcomplete in
+     debian/rules.
+ - New features:
+   - Support both PyPDF 1.x and 2.x.
+ - Codebase improvements:
+   - Don't call re.compile and then call .sub on the result; just call
+     re.sub directly.
+   - Clarify the logic around the difference between --usage and --help.
+ - Testsuite improvements:
+   - Integrate test coverage with GitLab's concept of artifacts.
+   - Re-enable Gnumeric tests as its now available again.
+   - Test --help and --usage, and additionally test that --help includes
+     the programmatically-generated file format list as well.
+ - Bump Standards Version field in debian/control to 4.6.1.
+
+-------------------------------------------------------------------

Old:
----
  diffoscope-214.tar.bz2
  diffoscope-214.tar.bz2.asc

New:
----
  diffoscope-216.tar.bz2
  diffoscope-216.tar.bz2.asc

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ diffoscope.spec ++++++
--- /var/tmp/diff_new_pack.TOZxAS/_old  2022-06-28 15:23:18.930026864 +0200
+++ /var/tmp/diff_new_pack.TOZxAS/_new  2022-06-28 15:23:18.938026876 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           diffoscope
-Version:        214
+Version:        216
 Release:        0
 Summary:        In-depth comparison of files, archives, and directories
 License:        GPL-3.0-or-later

++++++ diffoscope-214.tar.bz2 -> diffoscope-216.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/MANIFEST.in 
new/diffoscope-216/MANIFEST.in
--- old/diffoscope-214/MANIFEST.in      2022-05-27 07:53:07.000000000 +0200
+++ new/diffoscope-216/MANIFEST.in      2022-06-10 08:01:00.000000000 +0200
@@ -2,5 +2,4 @@
 include README.rst
 include CONTRIBUTING.md
 include pyproject.toml
-graft scripts
 graft tests
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/changelog 
new/diffoscope-216/debian/changelog
--- old/diffoscope-214/debian/changelog 2022-05-27 07:53:07.000000000 +0200
+++ new/diffoscope-216/debian/changelog 2022-06-10 08:01:00.000000000 +0200
@@ -1,3 +1,46 @@
+diffoscope (216) unstable; urgency=medium
+
+  * Print profile output if we were called with --profile and we receive a
+    TERM signal.
+  * Emit a warning if/when we are handling a TERM signal.
+  * Clarify in the code in what situations the main "finally" block gets
+    called, especially in relation to handling TERM signals.
+  * Clarify and tidy some unconditional control flow in diffoscope.profiling.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 10 Jun 2022 07:00:54 +0100
+
+diffoscope (215) unstable; urgency=medium
+
+  [ Chris Lamb ]
+  * Bug fixes:
+    - Also catch IndexError (in addition to ValueError) when parsing .pyc
+      files. (Closes: #1012258)
+    - Strip "sticky" etc. from "x.deb: sticky Debian binary package [???]".
+      Thanks to David Pr??vot for the report. (Closes: #1011635)
+    - Correctly package diffoscope's scripts/ directory, fixing the extraction
+      of vmlinuz kernel images. (Closes: reproducible-builds/diffoscope#305)
+    - Correct the logic for supporting different versions of argcomplete in
+      debian/rules.
+
+  * New features:
+    - Support both PyPDF 1.x and 2.x.
+
+  * Codebase improvements:
+    - Don't call re.compile and then call .sub on the result; just call
+      re.sub directly.
+    - Clarify the logic around the difference between --usage and --help.
+
+  * Testsuite improvements:
+    - Integrate test coverage with GitLab's concept of artifacts.
+    - Re-enable Gnumeric tests as its now available again.
+    - Test --help and --usage, and additionally test that --help includes
+      the programmatically-generated file format list as well.
+
+  [ Holger Levsen ]
+  * Bump Standards Version field in debian/control to 4.6.1.
+
+ -- Chris Lamb <la...@debian.org>  Fri, 03 Jun 2022 06:54:48 +0100
+
 diffoscope (214) unstable; urgency=medium
 
   [ Chris Lamb ]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/control 
new/diffoscope-216/debian/control
--- old/diffoscope-214/debian/control   2022-05-27 07:53:07.000000000 +0200
+++ new/diffoscope-216/debian/control   2022-06-10 08:01:00.000000000 +0200
@@ -32,8 +32,7 @@
  ghc <!nocheck>,
  ghostscript <!nocheck>,
  giflib-tools <!nocheck>,
-# drop gnumeric because it's not in testing currently (2022-04-27)
-# gnumeric <!nocheck>,
+ gnumeric <!nocheck>,
  gnupg-utils <!nocheck>,
  hdf5-tools <!nocheck>,
  help2man,
@@ -91,7 +90,7 @@
  zstd <!nocheck>,
 Build-Conflicts:
  graphicsmagick-imagemagick-compat,
-Standards-Version: 4.6.0
+Standards-Version: 4.6.1
 Rules-Requires-Root: no
 Homepage: https://diffoscope.org
 Vcs-Git: https://salsa.debian.org/reproducible-builds/diffoscope.git
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/rules 
new/diffoscope-216/debian/rules
--- old/diffoscope-214/debian/rules     2022-05-27 07:53:07.000000000 +0200
+++ new/diffoscope-216/debian/rules     2022-06-10 08:01:00.000000000 +0200
@@ -38,7 +38,7 @@
        $(MAKE) -C doc $*.1
 
 debian/diffoscope-minimal.bash-completion:
-       register-python-argcomplete diffoscope || register-python-argcomplete3 
diffoscope > $@
+       (register-python-argcomplete diffoscope || register-python-argcomplete3 
diffoscope) > $@
 
 execute_after_dh_auto_build: debian/diffoscope-minimal.bash-completion
        dh_auto_build -O--buildsystem=makefile -Ddoc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/tests/control 
new/diffoscope-216/debian/tests/control
--- old/diffoscope-214/debian/tests/control     2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/debian/tests/control     2022-06-10 08:01:00.000000000 
+0200
@@ -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], abootimg, acl, 
apksigner, 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, gnupg, gnupg-utils, hdf5-tools, imagemagick, jsbeautifier, 
libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, 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 
| vim-common, xz-utils, zip, zstd, androguard, 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, python3-h5py, file, 
linux-image-amd64 [amd64] | linux-image-generic [amd64], abootimg, acl, 
apksigner, 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, hdf5-tools, imagemagick, 
jsbeautifier, libarchive-tools, libxmlb-dev, llvm, lz4 | liblz4-tool, 
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 | vim-common, xz-utils, zip, zstd, androguard, 
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, python3-h5py, file, 
python3-tlsh
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/tests/control.sh 
new/diffoscope-216/debian/tests/control.sh
--- old/diffoscope-214/debian/tests/control.sh  2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/debian/tests/control.sh  2022-06-10 08:01:00.000000000 
+0200
@@ -19,8 +19,6 @@
 
 # Don't test-depend on radare2; not in bullseye for security reasons. (#950372)
 sed -i "s#radare2, ##" debian/tests/control.tmp
-# Drop gnumeric as it's not in testing currently (2022-04-27)
-sed -i "s#gnumeric, ##" debian/tests/control.tmp
 
 sed -i "s,python3-python-debian,python3-debian," debian/tests/control.tmp
 sed -i "s,python3-rpm-python,python3-rpm," debian/tests/control.tmp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/debian/tests/pytest 
new/diffoscope-216/debian/tests/pytest
--- old/diffoscope-214/debian/tests/pytest      2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/debian/tests/pytest      2022-06-10 08:01:00.000000000 
+0200
@@ -9,8 +9,7 @@
 
 export LIBGUESTFS_MEMSIZE=128
 if [ "$(basename "$0")" = "pytest-with-recommends" ]; then
-    # ssconvert because gnumeric is not currently in testing (2022-04-27)
-    export DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS="apktool zipinfo pedump 
oggDump ppudump cbfstool otool lipo radare2 ssconvert"
+    export DIFFOSCOPE_FAIL_TESTS_ON_MISSING_TOOLS="apktool zipinfo pedump 
oggDump ppudump cbfstool otool lipo radare2"
 fi
 
 for py in $(py3versions -s); do
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/__init__.py 
new/diffoscope-216/diffoscope/__init__.py
--- old/diffoscope-214/diffoscope/__init__.py   2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/diffoscope/__init__.py   2022-06-10 08:01:00.000000000 
+0200
@@ -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 = "214"
+VERSION = "216"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/comparators/pdf.py 
new/diffoscope-216/diffoscope/comparators/pdf.py
--- old/diffoscope-214/diffoscope/comparators/pdf.py    2022-05-27 
07:53:07.000000000 +0200
+++ new/diffoscope-216/diffoscope/comparators/pdf.py    2022-06-10 
08:01:00.000000000 +0200
@@ -27,6 +27,14 @@
 
 try:
     import PyPDF2
+
+    try:
+        # PyPDF 2.x
+        from PyPDF2.errors import PdfReadError
+    except ImportError:
+        # PyPDF 1.x
+        from PyPDF2.utils import PdfReadError
+
 except ImportError:  # noqa
     python_module_missing("PyPDF2")
     PyPDF2 = None
@@ -92,7 +100,7 @@
         try:
             pdf = PyPDF2.PdfFileReader(file.path)
             document_info = pdf.getDocumentInfo()
-        except PyPDF2.utils.PdfReadError as e:
+        except PdfReadError as e:
             return f"(Could not extract metadata: {e})"
 
         if document_info is None:
@@ -108,7 +116,7 @@
     def dump_pypdf2_annotations(file):
         try:
             pdf = PyPDF2.PdfFileReader(file.path)
-        except PyPDF2.utils.PdfReadError as e:
+        except PdfReadError as e:
             return f"(Could not open file: {e})"
 
         xs = []
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/comparators/python.py 
new/diffoscope-216/diffoscope/comparators/python.py
--- old/diffoscope-214/diffoscope/comparators/python.py 2022-05-27 
07:53:07.000000000 +0200
+++ new/diffoscope-216/diffoscope/comparators/python.py 2022-06-10 
08:01:00.000000000 +0200
@@ -53,7 +53,7 @@
                     source="Python bytecode",
                 )
             ]
-        except ValueError as exc:
+        except (ValueError, IndexError) as exc:
             self.add_comment("Could not decompile bytecode: {}".format(exc))
             return []
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/comparators/utils/file.py 
new/diffoscope-216/diffoscope/comparators/utils/file.py
--- old/diffoscope-214/diffoscope/comparators/utils/file.py     2022-05-27 
07:53:07.000000000 +0200
+++ new/diffoscope-216/diffoscope/comparators/utils/file.py     2022-06-10 
08:01:00.000000000 +0200
@@ -400,9 +400,11 @@
         # gzip compressed data as this is just a symptom of the contents itself
         # changing that will be reflected elsewhere.
         if val.startswith("gzip compressed data"):
-            val = re.compile(r", original size modulo 2\^\d+ \d+$").sub(
-                "", val
-            )
+            val = re.sub(r", original size modulo 2\^\d+ \d+$", "", val)
+
+        # Strip "sticky" etc. from "x.deb: sticky Debian binary package [???]"
+        # See (#1011635)
+        val = re.sub(r"^(sticky|setuid|setgid)\s", "", val)
 
         return val
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/comparators/vmlinuz.py 
new/diffoscope-216/diffoscope/comparators/vmlinuz.py
--- old/diffoscope-214/diffoscope/comparators/vmlinuz.py        2022-05-27 
07:53:07.000000000 +0200
+++ new/diffoscope-216/diffoscope/comparators/vmlinuz.py        2022-06-10 
08:01:00.000000000 +0200
@@ -46,7 +46,7 @@
         logger.debug("extracting vmlinuz to %s", dest_path)
 
         # Locate extract-vmlinux script
-        script = pathlib.Path(__file__).parent.parent.parent.joinpath(
+        script = pathlib.Path(__file__).parent.parent.joinpath(
             "scripts", "extract-vmlinux"
         )
         with open(dest_path, "wb") as f:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/main.py 
new/diffoscope-216/diffoscope/main.py
--- old/diffoscope-214/diffoscope/main.py       2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/diffoscope/main.py       2022-06-10 08:01:00.000000000 
+0200
@@ -487,7 +487,8 @@
     def format_help(self, *args, **kwargs):
         val = super().format_help(*args, **kwargs)
 
-        # Only append the file formats if --help is passed.
+        # Only append the file formats (etc.) if --help is passed; otherwise we
+        # are being called via --usage
         if not set(sys.argv) & {"--help", "-h"}:
             return val
 
@@ -725,7 +726,10 @@
 
 
 def sigterm_handler(signo, stack_frame):
+    logger.warning("Received TERM signal; cleaning up temp files...")
     clean_all_temp_files()
+    ProfileManager().finish()
+    logger.warning("Exiting...")
     os._exit(2)
 
 
@@ -780,6 +784,9 @@
             pdb.post_mortem()
         sys.exit(2)
     finally:
+        # Note that this is block is not called if the sigterm_handler method
+        # is a) called, and b) executes successfully.
+
         # Helps our tests run more predictably - some of them call main()
         # which sets Config() values.
         Config().reset()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/profiling.py 
new/diffoscope-216/diffoscope/profiling.py
--- old/diffoscope-214/diffoscope/profiling.py  2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/diffoscope/profiling.py  2022-06-10 08:01:00.000000000 
+0200
@@ -60,16 +60,25 @@
         self.data[namespace][key]["time"] += time.time() - start
         self.data[namespace][key]["count"] += 1
 
-    def finish(self, parsed_args):
+    def finish(self, parsed_args=None):
         from .presenters.utils import make_printer
 
+        # We are being called in the TERM handler so we don't have access to
+        # parsed_args. Print the profiling output to stderr if we have been
+        # collecting it.
+        if parsed_args is None:
+            if _ENABLED:
+                self.output(lambda x: print(x, file=sys.stderr))
+            return
+
         # Include profiling in --debug output if --profile is not set.
         if parsed_args.profile_output is None:
             with setup_logging(parsed_args.debug, None) as logger:
                 self.output(lambda x: logger.debug(x.strip("\n")))
-        else:
-            with make_printer(parsed_args.profile_output) as fn:
-                self.output(fn)
+            return
+
+        with make_printer(parsed_args.profile_output) as fn:
+            self.output(fn)
 
     def output(self, print_fn):
         title = "# Profiling output for: {}".format(" ".join(sys.argv))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/diffoscope/scripts/extract-vmlinux 
new/diffoscope-216/diffoscope/scripts/extract-vmlinux
--- old/diffoscope-214/diffoscope/scripts/extract-vmlinux       1970-01-01 
01:00:00.000000000 +0100
+++ new/diffoscope-216/diffoscope/scripts/extract-vmlinux       2022-06-10 
08:01:00.000000000 +0200
@@ -0,0 +1,64 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-only
+# ----------------------------------------------------------------------
+# extract-vmlinux - Extract uncompressed vmlinux from a kernel image
+#
+# Inspired from extract-ikconfig
+# (c) 2009,2010 Dick Streefland <d...@streefland.net>
+#
+# (c) 2011      Corentin Chary <corentin.ch...@gmail.com>
+#
+# ----------------------------------------------------------------------
+
+check_vmlinux()
+{
+       # Use readelf to check if it's a valid ELF
+       # TODO: find a better to way to check that it's really vmlinux
+       #       and not just an elf
+       readelf -h $1 > /dev/null 2>&1 || return 1
+
+       cat $1
+       exit 0
+}
+
+try_decompress()
+{
+       # The obscure use of the "tr" filter is to work around older versions of
+       # "grep" that report the byte offset of the line instead of the pattern.
+
+       # Try to find the header ($1) and decompress from here
+       for     pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
+       do
+               pos=${pos%%:*}
+               tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
+               check_vmlinux $tmp
+       done
+}
+
+# Check invocation:
+me=${0##*/}
+img=$1
+if     [ $# -ne 1 -o ! -s "$img" ]
+then
+       echo "Usage: $me <kernel-image>" >&2
+       exit 2
+fi
+
+# Prepare temp files:
+tmp=$(mktemp /tmp/vmlinux-XXX)
+trap "rm -f $tmp" 0
+
+# That didn't work, so retry after decompression.
+try_decompress '\037\213\010' xy    gunzip
+try_decompress '\3757zXZ\000' abcde unxz
+try_decompress 'BZh'          xy    bunzip2
+try_decompress '\135\0\0\0'   xxx   unlzma
+try_decompress '\211\114\132' xy    'lzop -d'
+try_decompress '\002!L\030'   xxx   'lz4 -d'
+try_decompress '(\265/\375'   xxx   unzstd
+
+# Finally check for uncompressed images or objects:
+check_vmlinux $img
+
+# Bail out:
+echo "$me: Cannot find vmlinux." >&2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/scripts/extract-vmlinux 
new/diffoscope-216/scripts/extract-vmlinux
--- old/diffoscope-214/scripts/extract-vmlinux  2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/scripts/extract-vmlinux  1970-01-01 01:00:00.000000000 
+0100
@@ -1,64 +0,0 @@
-#!/bin/sh
-# SPDX-License-Identifier: GPL-2.0-only
-# ----------------------------------------------------------------------
-# extract-vmlinux - Extract uncompressed vmlinux from a kernel image
-#
-# Inspired from extract-ikconfig
-# (c) 2009,2010 Dick Streefland <d...@streefland.net>
-#
-# (c) 2011      Corentin Chary <corentin.ch...@gmail.com>
-#
-# ----------------------------------------------------------------------
-
-check_vmlinux()
-{
-       # Use readelf to check if it's a valid ELF
-       # TODO: find a better to way to check that it's really vmlinux
-       #       and not just an elf
-       readelf -h $1 > /dev/null 2>&1 || return 1
-
-       cat $1
-       exit 0
-}
-
-try_decompress()
-{
-       # The obscure use of the "tr" filter is to work around older versions of
-       # "grep" that report the byte offset of the line instead of the pattern.
-
-       # Try to find the header ($1) and decompress from here
-       for     pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
-       do
-               pos=${pos%%:*}
-               tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
-               check_vmlinux $tmp
-       done
-}
-
-# Check invocation:
-me=${0##*/}
-img=$1
-if     [ $# -ne 1 -o ! -s "$img" ]
-then
-       echo "Usage: $me <kernel-image>" >&2
-       exit 2
-fi
-
-# Prepare temp files:
-tmp=$(mktemp /tmp/vmlinux-XXX)
-trap "rm -f $tmp" 0
-
-# That didn't work, so retry after decompression.
-try_decompress '\037\213\010' xy    gunzip
-try_decompress '\3757zXZ\000' abcde unxz
-try_decompress 'BZh'          xy    bunzip2
-try_decompress '\135\0\0\0'   xxx   unlzma
-try_decompress '\211\114\132' xy    'lzop -d'
-try_decompress '\002!L\030'   xxx   'lz4 -d'
-try_decompress '(\265/\375'   xxx   unzstd
-
-# Finally check for uncompressed images or objects:
-check_vmlinux $img
-
-# Bail out:
-echo "$me: Cannot find vmlinux." >&2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/setup.py new/diffoscope-216/setup.py
--- old/diffoscope-214/setup.py 2022-05-27 07:53:07.000000000 +0200
+++ new/diffoscope-216/setup.py 2022-06-10 08:01:00.000000000 +0200
@@ -45,6 +45,8 @@
     license="GPL-3+",
     url="https://diffoscope.org/";,
     packages=find_packages(exclude=["tests", "tests.*"]),
+    package_data={"diffoscope": ["scripts/*"]},
+    include_package_data=True,
     tests_require=["pytest"],
     cmdclass={"test": PyTest},
     entry_points={
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/diffoscope-214/tests/test_main.py 
new/diffoscope-216/tests/test_main.py
--- old/diffoscope-214/tests/test_main.py       2022-05-27 07:53:07.000000000 
+0200
+++ new/diffoscope-216/tests/test_main.py       2022-06-10 08:01:00.000000000 
+0200
@@ -2,7 +2,7 @@
 # diffoscope: in-depth comparison of files, archives, and directories
 #
 # Copyright ?? 2015 J??r??my Bobbio <lu...@debian.org>
-# Copyright ?? 2016-2020 Chris Lamb <la...@debian.org>
+# Copyright ?? 2016-2022 Chris Lamb <la...@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
@@ -18,6 +18,7 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import os
+import sys
 import pytest
 import signal
 import tempfile
@@ -173,3 +174,20 @@
 
     assert ret == 0
     assert out == err == ""
+
+
+def test_help(capsys, monkeypatch):
+    # Fake --help in sys.argv so that we include out file formats in the output
+    monkeypatch.setattr(sys, "argv", ["diffoscope", "--help"])
+
+    ret, out, err = run(capsys, "--help")
+
+    assert err == ""
+    assert "file formats supported:" in out
+
+
+def test_usage(capsys):
+    ret, out, err = run(capsys, "--usage")
+
+    assert out == ""
+    assert "usage:" in err

Reply via email to