[Reproducible-commits] [debbindiff] 01/01: Fix handling of content name for gzip, bzip2, and xz

Jérémy Bobbio lunar at moszumanska.debian.org
Fri Jul 31 05:52:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch master
in repository debbindiff.

commit 631df8ed3dc0e6178a31cec9a3325a352b10f2bb
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Fri Jul 31 05:51:55 2015 +0000

    Fix handling of content name for gzip, bzip2, and xz
---
 debbindiff/comparators/bzip2.py | 5 +++++
 debbindiff/comparators/gzip.py  | 5 +++++
 debbindiff/comparators/utils.py | 4 +---
 debbindiff/comparators/xz.py    | 5 +++++
 tests/comparators/test_bzip2.py | 2 --
 tests/comparators/test_gzip.py  | 2 --
 tests/comparators/test_xz.py    | 2 --
 7 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/debbindiff/comparators/bzip2.py b/debbindiff/comparators/bzip2.py
index 7ec9714..5026337 100644
--- a/debbindiff/comparators/bzip2.py
+++ b/debbindiff/comparators/bzip2.py
@@ -52,6 +52,11 @@ class Bzip2Container(Archive):
                 shell=False, stdout=fp, stderr=None)
         return dest_path
 
+    def compare(self, other, source=None):
+        my_file = self.get_member(self.get_member_names()[0])
+        other_file = other.get_member(other.get_member_names()[0])
+        return [debbindiff.comparators.compare_files(my_file, other_file, source)]
+
 
 class Bzip2File(File):
     RE_FILE_TYPE = re.compile(r'^bzip2 compressed data\b')
diff --git a/debbindiff/comparators/gzip.py b/debbindiff/comparators/gzip.py
index f5203c5..da6903f 100644
--- a/debbindiff/comparators/gzip.py
+++ b/debbindiff/comparators/gzip.py
@@ -54,6 +54,11 @@ class GzipContainer(Archive):
                 shell=False, stdout=fp, stderr=None)
         return dest_path
 
+    def compare(self, other, source=None):
+        my_file = self.get_member(self.get_member_names()[0])
+        other_file = other.get_member(other.get_member_names()[0])
+        return [debbindiff.comparators.compare_files(my_file, other_file, source)]
+
 
 class GzipFile(object):
     RE_FILE_TYPE = re.compile(r'^gzip compressed data\b')
diff --git a/debbindiff/comparators/utils.py b/debbindiff/comparators/utils.py
index 1857970..b471837 100644
--- a/debbindiff/comparators/utils.py
+++ b/debbindiff/comparators/utils.py
@@ -137,11 +137,9 @@ def format_device(mode, major, minor):
 
 
 def get_compressed_content_name(path, expected_extension):
-    return 'content'
-    # XXX: implement fuzzy-matching support to get the thing below to work
     basename = os.path.basename(path)
     if basename.endswith(expected_extension):
-        name = basename[:-3]
+        name = basename[:-len(expected_extension)]
     else:
         name = "%s-content" % basename
     return name
diff --git a/debbindiff/comparators/xz.py b/debbindiff/comparators/xz.py
index 261ad75..17366ff 100644
--- a/debbindiff/comparators/xz.py
+++ b/debbindiff/comparators/xz.py
@@ -53,6 +53,11 @@ class XzContainer(Archive):
                 shell=False, stdout=fp, stderr=None)
         return dest_path
 
+    def compare(self, other, source=None):
+        my_file = self.get_member(self.get_member_names()[0])
+        other_file = other.get_member(other.get_member_names()[0])
+        return [debbindiff.comparators.compare_files(my_file, other_file, source)]
+
 
 class XzFile(File):
     RE_FILE_TYPE = re.compile(r'^XZ compressed data$')
diff --git a/tests/comparators/test_bzip2.py b/tests/comparators/test_bzip2.py
index 6e9a259..c59b616 100644
--- a/tests/comparators/test_bzip2.py
+++ b/tests/comparators/test_bzip2.py
@@ -49,12 +49,10 @@ def test_no_differences(bzip1):
 def differences(bzip1, bzip2):
     return bzip1.compare(bzip2).details
 
- at pytest.mark.xfail # need fuzzy
 def test_content_source(differences):
     assert differences[0].source1 == 'test1'
     assert differences[0].source2 == 'test2'
 
- at pytest.mark.xfail # need fuzzy
 def test_content_source_without_extension(tmpdir):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))
diff --git a/tests/comparators/test_gzip.py b/tests/comparators/test_gzip.py
index 657fcd6..f6c867f 100644
--- a/tests/comparators/test_gzip.py
+++ b/tests/comparators/test_gzip.py
@@ -53,12 +53,10 @@ def test_metadata(differences):
     expected_diff = open(os.path.join(os.path.dirname(__file__), '../data/gzip_metadata_expected_diff')).read()
     assert differences[0].unified_diff == expected_diff
 
- at pytest.mark.xfail # need fuzzy matching
 def test_content_source(differences):
     assert differences[1].source1 == 'test1'
     assert differences[1].source2 == 'test2'
 
- at pytest.mark.xfail # need fuzzy matching
 def test_content_source_without_extension(tmpdir):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))
diff --git a/tests/comparators/test_xz.py b/tests/comparators/test_xz.py
index d3d98c7..6e81af3 100644
--- a/tests/comparators/test_xz.py
+++ b/tests/comparators/test_xz.py
@@ -47,12 +47,10 @@ def test_no_differences(xz1):
 def differences(xz1, xz2):
     return xz1.compare(xz2).details
 
- at pytest.mark.xfail # need fuzzy
 def test_content_source(differences):
     assert differences[0].source1 == 'test1'
     assert differences[0].source2 == 'test2'
 
- at pytest.mark.xfail # need fuzzy
 def test_content_source_without_extension(tmpdir):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/debbindiff.git



More information about the Reproducible-commits mailing list