fedabipkgdiff refuses to compare packages with the same release number
authorDodji Seketeli <dodji@redhat.com>
Mon, 23 Jan 2017 22:28:12 +0000 (23:28 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 15 Feb 2017 15:06:32 +0000 (16:06 +0100)
I tried to run:

    fedabipkgdiff vte291-0.39.1-1.fc22.x86_64 vte291-0.39.90-1.fc22.x86_64

And it wouldn't work :-(

The program considers the two packages as not being "peers".  This has
to do with the RPM.is_peer method which considers the two package as
not being "peers", just because they have the same release number
(1.fc22).

They should be considered peers, though, because they have the same
name but different {version, release} pairs.

This patch fixes the RPM.is_peer method and adds the aforementioned
packages to the regression test suite for good measure.

* tools/fedabipkgdiff (RPM.is_peer): Update comment.  Fix logic.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm:
New test input file.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm: Likewise.
* tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm:
Likewise.
* tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt: Likewise.
* tests/data/Makefile.am: Add the new test input data to source
distribution.
* tests/mockfedabipkgdiff.in: Update the package and build
information to add the new vte291-0.39.1-1.fc22.x86_64.rpm and
vte291-0.39.90-1.fc22.x86_64.rpm packages (as well as their devel
and debuginfo packages) into the "mock" Koji build database.
* tests/runtestfedabipkgdiff.py.in:  Make this test harness run
over the two aforementioned packages.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tests/data/Makefile.am
tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm [new file with mode: 0644]
tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt [new file with mode: 0644]
tests/mockfedabipkgdiff.in
tests/runtestfedabipkgdiff.py.in
tools/fedabipkgdiff

index d69c7f068e09d54084a50fdb28857bceb3c17b51..dfe80d0846c955d358b14042a75479c7805c228c 100644 (file)
@@ -1308,6 +1308,13 @@ test-fedabipkgdiff/packages/nss-util/3.12.6/1.fc14/x86_64/nss-util-debuginfo-3.1
 test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/x86_64/nss-util-debuginfo-3.24.0-2.0.fc25.x86_64.rpm \
 test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/x86_64/nss-util-devel-3.24.0-2.0.fc25.x86_64.rpm \
 test-fedabipkgdiff/packages/nss-util/3.24.0/2.0.fc25/x86_64/nss-util-3.24.0-2.0.fc25.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm \
+test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt \
 \
 test-default-supprs/test0-type-suppr-0.suppr \
 test-default-supprs/test0-type-suppr-report-0.txt \
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..10656f5
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-0.39.1-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..edce025
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-debuginfo-0.39.1-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..0a704b2
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.1/1.fc22/x86_64/vte291-devel-0.39.1-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..292cacb
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-0.39.90-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..a90712a
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-debuginfo-0.39.90-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm
new file mode 100644 (file)
index 0000000..2db7b05
Binary files /dev/null and b/tests/data/test-fedabipkgdiff/packages/vte291/0.39.90/1.fc22/x86_64/vte291-devel-0.39.90-1.fc22.x86_64.rpm differ
diff --git a/tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt b/tests/data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt
new file mode 100644 (file)
index 0000000..fab0271
--- /dev/null
@@ -0,0 +1,27 @@
+Comparing the ABI of binaries between vte291-0.39.1-1.fc22.x86_64.rpm and vte291-0.39.90-1.fc22.x86_64.rpm:
+
+================ changes of 'gnome-pty-helper'===============
+  Functions changes summary: 0 Removed, 0 Changed, 0 Added function
+  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+  Function symbols changes summary: 0 Removed, 0 Added function symbol not referenced by debug info
+  Variable symbols changes summary: 0 Removed, 1 Added variable symbol not referenced by debug info
+
+  1 Added variable symbol not referenced by debug info:
+
+    stderr
+
+================ end of changes of 'gnome-pty-helper'===============
+
+================ changes of 'libvte-2.91.so.0.3901.0'===============
+  Functions changes summary: 0 Removed, 0 Changed (81 filtered out), 3 Added functions
+  Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+  3 Added functions:
+
+    'function const char* vte_get_features()'    {vte_get_features}
+    'function const char* vte_terminal_get_word_char_exceptions(VteTerminal*)'    {vte_terminal_get_word_char_exceptions}
+    'function void vte_terminal_set_word_char_exceptions(VteTerminal*, const char*)'    {vte_terminal_set_word_char_exceptions}
+
+================ end of changes of 'libvte-2.91.so.0.3901.0'===============
+
+
index 68d26faf0f93d93fc50e151db1a73949b7575556..48a1866cc6ac9205356326c0699ee33638a4e886 100644 (file)
@@ -109,6 +109,7 @@ packages = [
     {'id': 286, 'name': 'gnutls'},
     {'id': 612, 'name': 'dbus-glib'},
     {'id': 9041, 'name': 'nss-util'},
+    {'id': 18494, 'name': 'vte291'},
     ]
 
 builds = [
@@ -159,6 +160,16 @@ builds = [
      'name': 'gnutls', 'release': '1.fc23', 'version': '3.4.2',
      'package_id': 286, 'package_name': 'gnutls', 'state': 1,
      },
+
+    # builds of package vte291
+    {'build_id': 600011, 'nvr': 'vte291-0.39.1-1.fc22',
+     'name': 'vte291', 'version': '0.39.1', 'release': '1.fc22',
+     'package_id': 18494, 'package_name': 'vte291', 'state': 1,
+     },
+    {'build_id': 612610, 'nvr': 'vte291-0.39.90-1.fc22',
+     'name': 'vte291', 'version': '0.39.90', 'release': '1.fc22',
+     'package_id': 18494, 'package_name': 'vte291', 'state': 1,
+     },
     ]
 
 rpms = [
@@ -239,7 +250,34 @@ rpms = [
      'name': 'nss-util-devel', 'release': '2.0.fc25', 'version': '3.24.0',
      'arch': 'x86_64', 'nvr': 'nss-util-devel-3.24.0-2.0.fc25',
      },
-    ]
+    # RPMs of build vte291-0.39.1-1.fc22
+    {'build_id': 600011,
+     'name': 'vte291', 'version': '0.39.1', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.1-1.fc22',
+    },
+    {'build_id': 600011,
+     'name': 'vte291-devel', 'version': '0.39.1', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.1-1.fc22',
+    },
+    {'build_id': 600011,
+     'name': 'vte291-debuginfo', 'version': '0.39.1', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.1-1.fc22',
+    },
+
+    # RPMs of build vte291-0.39.90-1.fc22
+    {'build_id': 612610,
+     'name': 'vte291', 'version': '0.39.90', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.90-1.fc22',
+    },
+    {'build_id': 612610,
+     'name': 'vte291-devel', 'version': '0.39.90', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.90-1.fc22',
+    },
+    {'build_id': 612610,
+     'name': 'vte291-debuginfo', 'version': '0.39.90', 'release': '1.fc22', 
+     'arch': 'x86_64', 'nvr': 'vte291-0.39.90-1.fc22',
+    },
+   ]
 
 # -----------------  End of Koji resource storage ------------------
 
index 777c8f95cb28707c6bb3c11eaad80cb2b8640e3f..9c06165fa08fc35d9cd999c5ef872bc945732b5e 100755 (executable)
@@ -73,6 +73,10 @@ FEDABIPKGDIFF_TEST_SPECS = [
      'data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt',
      'output/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt'),
 
+    (['vte291-0.39.1-1.fc22.x86_64', 'vte291-0.39.90-1.fc22.x86_64'],
+     'data/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt',
+     'output/test-fedabipkgdiff/vte291-0.39.1-1.fc22.x86_64--vte291-0.39.90-1.fc22.x86_64-report-0.txt'),
+
     ([os.path.join(INPUT_DIR, 'packages/dbus-glib/0.100.2/2.fc20/x86_64/dbus-glib-0.100.2-2.fc20.x86_64.rpm'),
       os.path.join(INPUT_DIR, 'packages/dbus-glib/0.106/1.fc23/x86_64/dbus-glib-0.106-1.fc23.x86_64.rpm')],
      'data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt',
index 425fdd5d08a87c05e1121f0ed2398b5d477350c5..f9504f42a5af635273e4b31a31ef16e504f7d04e 100755 (executable)
@@ -258,10 +258,21 @@ class RPM(object):
             raise AttributeError('No attribute name {0}'.format(name))
 
     def is_peer(self, another_rpm):
-        """Determine if this is the peer of a given rpm"""
+        """Determine if this is the peer of a given rpm.
+
+        Here is what "peer" means.
+
+        Consider a package P for which the tripplet Name, Version,
+        Release is made of the values {N,V,R}.  Then, consider a
+        package P' for which the similar tripplet is {N', V', R'}.
+
+        P' is a peer of P if N == N', and either V != V' or R != R'.
+        given package with a given NVR is another package with a N'V'
+        """
         return self.name == another_rpm.name and \
             self.arch == another_rpm.arch and \
-            self.release != another_rpm.release
+            not (self.version == another_rpm.version
+                 and self.release == another_rpm.release)
 
     @property
     def nvra(self):