[Git][reproducible-builds/diffoscope][master] 5 commits: Add a bit more debug around launching guestfs.

Chris Lamb gitlab at salsa.debian.org
Thu Jul 30 10:35:22 UTC 2020



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
69c0d4bc by Chris Lamb at 2020-07-30T11:31:03+01:00
Add a bit more debug around launching guestfs.

- - - - -
7e3bc6dd by Chris Lamb at 2020-07-30T11:31:42+01:00
Profile the launch of guestfs filesystems.

- - - - -
d5ed790e by Chris Lamb at 2020-07-30T11:34:45+01:00
Add an add_comment helper method; don't mess with our _comments list directly.

- - - - -
0dada5a0 by Chris Lamb at 2020-07-30T11:34:45+01:00
Correct adding a comment when we cannot extract a filesystem due to missing guestfs.

- - - - -
29b54888 by Chris Lamb at 2020-07-30T11:34:45+01:00
Add support for F2FS filesystems. (Closes: reproducible-builds/diffoscope#207)

- - - - -


3 changed files:

- diffoscope/comparators/fsimage.py
- diffoscope/comparators/pdf.py
- diffoscope/comparators/utils/file.py


Changes:

=====================================
diffoscope/comparators/fsimage.py
=====================================
@@ -24,6 +24,7 @@ import os.path
 
 from diffoscope.difference import Difference
 from diffoscope.tools import python_module_missing
+from diffoscope.profiling import profile
 
 from .utils.file import File
 from .utils.archive import Archive
@@ -51,7 +52,10 @@ class FsImageContainer(Archive):
             pass
         self.g.add_drive_opts(self.source.path, format="raw", readonly=1)
         try:
-            self.g.launch()
+            logger.debug("Launching guestfs; this may take some time")
+            with profile("command", "guestfs"):
+                self.g.launch()
+            logger.debug("guestfs successful launched")
         except RuntimeError:
             logger.exception("guestfs failed to launch")
             logger.error(
@@ -89,7 +93,9 @@ class FsImageContainer(Archive):
 class FsImageFile(File):
     DESCRIPTION = "ext2/ext3/ext4/btrfs/fat filesystems"
     CONTAINER_CLASSES = [FsImageContainer]
-    FILE_TYPE_RE = re.compile(r"^(Linux.*filesystem data|BTRFS Filesystem).*")
+    FILE_TYPE_RE = re.compile(
+        r"^(Linux.*filesystem data|BTRFS Filesystem|F2FS filesystem).*"
+    )
 
     @classmethod
     def recognizes(cls, file):
@@ -118,9 +124,8 @@ class FsImageFile(File):
                     my_fs, other_fs, None, None, source="filesystem"
                 )
             )
-            if not guestfs:
-                differences.add_comment(
-                    "guestfs not available; falling back to binary diff"
-                )
-
+        if not guestfs:
+            self.add_comment(
+                "Installing the 'guestfs' package may produce a better output."
+            )
         return differences


=====================================
diffoscope/comparators/pdf.py
=====================================
@@ -53,7 +53,7 @@ class PdfFile(File):
         xs = []
 
         if PyPDF2 is None:
-            self._comments.append(
+            self.add_comment(
                 "Installing the 'PyPDF2' package may produce a better output."
             )
         else:


=====================================
diffoscope/comparators/utils/file.py
=====================================
@@ -541,6 +541,9 @@ class File(metaclass=abc.ABCMeta):
             return difference
         return self.compare_bytes(other, source)
 
+    def add_comment(self, msg):
+        self._comments.append(msg)
+
 
 def maybe_decode(s):
     """



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/c1b066c3c2d56d3ad051f0f3a852ba579eb12ecc...29b548881f79c9bb83b4d6b207d0939616e2858d

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/c1b066c3c2d56d3ad051f0f3a852ba579eb12ecc...29b548881f79c9bb83b4d6b207d0939616e2858d
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/20200730/b661d16a/attachment.htm>


More information about the rb-commits mailing list