[Git][reproducible-builds/diffoscope][master] 2 commits: Include xz --verbose --verbose (ie. double) output. (Closes: Debian:#1069329)

Chris Lamb (@lamby) gitlab at salsa.debian.org
Wed May 15 09:53:18 UTC 2024



Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
9a7d78f0 by Chris Lamb at 2024-05-15T10:52:32+01:00
Include xz --verbose --verbose (ie. double) output. (Closes: Debian:#1069329)

- - - - -
52919364 by Chris Lamb at 2024-05-15T10:52:47+01:00
Only include xz --list --verbose output if the xz has no other differences.

- - - - -


5 changed files:

- diffoscope/comparators/xz.py
- tests/comparators/test_xz.py
- + tests/data/test3.xz
- + tests/data/test4.xz
- tests/data/text_xz_list


Changes:

=====================================
diffoscope/comparators/xz.py
=====================================
@@ -35,7 +35,7 @@ logger = logging.getLogger(__name__)
 class XZList(Command):
     @tool_required("xz")
     def cmdline(self):
-        return ("xz", "--list", "--verbose", self.path)
+        return ("xz", "--list", "--verbose", "--verbose", self.path)
 
     def filter(self, line):
         # Strip the first line
@@ -80,7 +80,7 @@ class XzFile(File):
         difference = super().compare(other, source)
 
         # Append xz --list *after* showing any container differences.
-        if isinstance(other, XzFile):
+        if difference and not difference.details and isinstance(other, XzFile):
             xz_list = Difference.from_operation(
                 XZList, self.path, other.path, source="xz --list"
             )


=====================================
tests/comparators/test_xz.py
=====================================
@@ -30,6 +30,8 @@ from ..utils.nonexisting import assert_non_existing
 
 xz1 = load_fixture("test1.xz")
 xz2 = load_fixture("test2.xz")
+xz3 = load_fixture("test3.xz")
+xz4 = load_fixture("test4.xz")
 
 
 def test_identification(xz1):
@@ -50,8 +52,6 @@ def differences(xz1, xz2):
 def test_content_source(differences):
     assert differences[0].source1 == "test1"
     assert differences[0].source2 == "test2"
-    assert differences[1].source1 == "xz --list"
-    assert differences[1].source2 == "xz --list"
 
 
 @skip_unless_tools_exist("xz")
@@ -65,16 +65,25 @@ def test_content_source_without_extension(tmpdir, xz1, xz2):
     difference = xz1.compare(xz2).details
     assert difference[0].source1 == "test1-content"
     assert difference[0].source2 == "test2-content"
-    assert difference[1].source1 == "xz --list"
-    assert difference[1].source2 == "xz --list"
 
 
 @skip_unless_tools_exist("xz")
 def test_content_diff(differences):
     assert_diff(differences[0], "text_ascii_expected_diff")
-    assert_diff(differences[1], "text_xz_list")
 
 
 @skip_unless_tools_exist("xz")
 def test_compare_non_existing(monkeypatch, xz1):
     assert_non_existing(monkeypatch, xz1)
+
+
+ at pytest.fixture
+def differences_verbose(xz3, xz4):
+    return xz3.compare(xz4).details
+
+
+ at skip_unless_tools_exist("xz")
+def test_content_source_verbose(differences_verbose):
+    assert differences_verbose[0].source1 == "xz --list"
+    assert differences_verbose[0].source2 == "xz --list"
+    assert_diff(differences_verbose[0], "text_xz_list")


=====================================
tests/data/test3.xz
=====================================
Binary files /dev/null and b/tests/data/test3.xz differ


=====================================
tests/data/test4.xz
=====================================
Binary files /dev/null and b/tests/data/test4.xz differ


=====================================
tests/data/text_xz_list
=====================================
@@ -1,19 +1,14 @@
-@@ -1,13 +1,13 @@
-   Streams:           1
-   Blocks:            1
--  Compressed size:   388 B
--  Uncompressed size: 446 B
--  Ratio:             0.870
-+  Compressed size:   532 B
-+  Uncompressed size: 671 B
-+  Ratio:             0.793
+@@ -6,11 +6,11 @@
    Check:             CRC64
    Stream Padding:    0 B
    Streams:
      Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding
--         1         1               0               0             388             446  0.870  CRC64            0
-+         1         1               0               0             532             671  0.793  CRC64            0
+          1         1               0               0              60               4    ---  CRC64            0
    Blocks:
-     Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check
--         1         1              12               0             352             446  0.789  CRC64
-+         1         1              12               0             496             671  0.739  CRC64
+     Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check      CheckVal          Header  Flags        CompSize    MemUsage  Filters
+-         1         1              12               0              28               4  7.000  CRC64      f29c31305aacd7ff      12  --                  8       1 MiB  --lzma2=dict=256KiB
+-  Memory needed:     1 MiB
++         1         1              12               0              28               4  7.000  CRC64      f29c31305aacd7ff      12  --                  8      65 MiB  --lzma2=dict=64MiB
++  Memory needed:     65 MiB
+   Sizes in headers:  No
+   Minimum XZ Utils version: 5.0.0



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/01d6fd7671f8300d204755633df2953d16344e32...529193643d94fbbd9c47ab94f27ffb221cb5f6f1

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/-/compare/01d6fd7671f8300d204755633df2953d16344e32...529193643d94fbbd9c47ab94f27ffb221cb5f6f1
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/20240515/a1dccf7e/attachment.htm>


More information about the rb-commits mailing list