[Git][reproducible-builds/diffoscope][master] 3 commits: Mask stderr from extract-vmlinux script.

Chris Lamb (@lamby) gitlab at salsa.debian.org
Mon Jul 21 16:17:30 UTC 2025



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
35b0dbb4 by Chris Lamb at 2025-07-21T09:16:58-07:00
Mask stderr from extract-vmlinux script.

- - - - -
510945b7 by Chris Lamb at 2025-07-21T09:16:58-07:00
Make it more explicit that we return 'success' in this case.

- - - - -
c7283818 by Chris Lamb at 2025-07-21T09:16:58-07:00
Use Difference.from_operation in an attempt to pipeline the output of scripts/extract-vmlinux, potentially avoiding it all in memory. (Re: #eproducible-builds/try.diffoscope.org#28)

- - - - -


2 changed files:

- diffoscope/comparators/vmlinuz.py
- diffoscope/scripts/extract-vmlinux


Changes:

=====================================
diffoscope/comparators/vmlinuz.py
=====================================
@@ -1,7 +1,7 @@
 #
 # diffoscope: in-depth comparison of files, archives, and directories
 #
-# Copyright © 2022 Chris Lamb <lamby at debian.org>
+# Copyright © 2022, 2025 Chris Lamb <lamby 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
@@ -17,49 +17,35 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import logging
-import os.path
 import pathlib
 import re
-import subprocess
 
-from diffoscope.tools import tool_required
+from diffoscope.difference import Difference
 
 from .utils.file import File
-from .utils.archive import Archive
+from .utils.command import Command
 
-logger = logging.getLogger(__name__)
-
-
-class VmlinuzContainer(Archive):
-    def open_archive(self):
-        return self
-
-    def close_archive(self):
-        pass
 
-    def get_member_names(self):
-        return [self.get_compressed_content_name(".vmlinuz")]
+logger = logging.getLogger(__name__)
 
-    @tool_required("readelf")
-    def extract(self, member_name, dest_dir):
-        dest_path = os.path.join(dest_dir, member_name)
-        logger.debug("extracting vmlinuz to %s", dest_path)
 
+class ExtractVmlinux(Command):
+    def cmdline(self):
         # Locate extract-vmlinux script
-        script = pathlib.Path(__file__).parent.parent.joinpath(
-            "scripts", "extract-vmlinux"
-        )
-        with open(dest_path, "wb") as f:
-            subprocess.check_call(
-                [script, self.source.path],
-                stdout=f,
-                stderr=None,
+        script = str(
+            pathlib.Path(__file__).parent.parent.joinpath(
+                "scripts", "extract-vmlinux"
             )
+        )
 
-        return dest_path
+        return [script, self.path]
 
 
 class VmlinuzFile(File):
     DESCRIPTION = "Linux kernel images"
-    CONTAINER_CLASSES = [VmlinuzContainer]
     FILE_TYPE_RE = re.compile(r"^Linux kernel\b")
+
+    def compare_details(self, other, source=None):
+        return [
+            Difference.from_operation(ExtractVmlinux, self.path, other.path)
+        ]


=====================================
diffoscope/scripts/extract-vmlinux
=====================================
@@ -62,3 +62,5 @@ check_vmlinux $img
 
 # Bail out:
 echo "$me: Cannot find vmlinux." >&2
+
+return 0



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/ffa385d336947526255335e31baef77977957404...c728381818c4f2e280f90792d775fcb7e68f4d4b

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/ffa385d336947526255335e31baef77977957404...c728381818c4f2e280f90792d775fcb7e68f4d4b
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/20250721/9ffee880/attachment.htm>


More information about the rb-commits mailing list