]> sourceware.org Git - libabigail.git/commitdiff
Bug 27255 - fedabipkgdiff fails on nfs-utils on Fedora 33
authorDodji Seketeli <dodji@redhat.com>
Wed, 27 Jan 2021 10:20:48 +0000 (11:20 +0100)
committerDodji Seketeli <dodji@redhat.com>
Wed, 27 Jan 2021 10:20:48 +0000 (11:20 +0100)
When running fedabipkgdiff as:

    fedabipkgdiff --self-compare -a --from fc33 nfs-utils

I am getting:

    Error encountered while running fedabipkgdiff with error message:

Running it with the --verbose option yields more clue, though.

It turns out that fedabipkgdiff runs abipkgdiff on an RPM and gives it
the wrong associated -debuginfo RPM.

This is because the member function
RPMCollection.get_sibling_debuginfo() doesn't returns the "first"
debuginfo package that comes with a given RPM.  In the case of the
package nfs-utils-2.5.2-1.rc4.fc33.aarch64.rpm, it was using the
package nfs-utils-coreos-debuginfo-2.5.2-1.rc4.fc33.aarch64.rpm
instead of the package nfs-utils-debuginfo-2.5.2-1.rc4.fc33.aarch64.rpm.

So, of course, abipkgdiff could not find the proper debuginfo for the
binaries carried by nfs-utils-2.5.2-1.rc4.fc33.aarch64.rpm.

This happens only in cases where there a several debuginfo packages
for a given RPM.  In that case, we need to be more careful to select
the right debuginfo package and not just a random one.

This patch adds a RPMCollection.get_matching_debuginfo() member function
that does the right thing.  It thus teaches
generate_comparison_halves() to use the new function.

* tools/fedabipkgdiff (RPMCollection::get_sibling_debuginfo):
Update comment.
(RPMCollection::get_matching_debuginfo): Define new function.
(generate_comparison_halves): Use
RPMCollection::get_matching_debuginfo instead of
RPMCollection::get_sibling_debuginfo.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
tools/fedabipkgdiff

index ea303a021f81696eb8880d3a1427263c1d3cc5bc..89cbd15c3adaf5610df42ec2a6965ff261f0117d 100755 (executable)
@@ -514,11 +514,32 @@ class RPMCollection(object):
                 yield _rpm
 
     def get_sibling_debuginfo(self, rpm):
-        """Get sibling debuginfo package of given rpm"""
+        """Get sibling debuginfo package of given rpm
+
+        The sibling debuginfo is a debug info package for the
+        'rpm'.  Note that if there are several debuginfo packages
+        associated to 'rpm' and users want to get the one which name
+        matches exactly 'rpm', then they might want to use the member
+        function 'get_matching_debuginfo' instead.
+
+        """
         if rpm.arch not in self.ancillary_rpms:
             return None
         return self.ancillary_rpms[rpm.arch].get('debuginfo')
 
+    def get_matching_debuginfo(self, rpm):
+        """Get the debuginfo package that matches a given one """
+        all_debuginfo_list = self.get_all_debuginfo_rpms(rpm)
+        debuginfo_pkg = None
+        for d in all_debuginfo_list:
+            if d.name == '{0}-debuginfo'.format(rpm.name):
+                debuginfo_pkg = d
+                break
+        if not debuginfo_pkg:
+            debuginfo_pkg = self.get_sibling_debuginfo(rpm)
+
+        return debuginfo_pkg
+
     def get_sibling_devel(self, rpm):
         """Get sibling devel package of given rpm"""
         if rpm.arch not in self.ancillary_rpms:
@@ -578,8 +599,7 @@ def generate_comparison_halves(rpm_col1, rpm_col2):
         if _rpm.is_devel:
             debuginfo_list1 = rpm_col1.get_all_debuginfo_rpms(_rpm)
         else:
-            debuginfo_list1.append(rpm_col1.get_sibling_debuginfo(_rpm))
-
+            debuginfo_list1.append(rpm_col1.get_matching_debuginfo(_rpm))
 
         devel1 = rpm_col1.get_sibling_devel(_rpm)
 
@@ -590,7 +610,7 @@ def generate_comparison_halves(rpm_col1, rpm_col2):
             if rpm2.is_devel:
                 debuginfo_list2 = rpm_col2.get_all_debuginfo_rpms(rpm2)
             else:
-                debuginfo_list2.append(rpm_col2.get_sibling_debuginfo(rpm2))
+                debuginfo_list2.append(rpm_col2.get_matching_debuginfo(rpm2))
             devel2 = rpm_col2.get_sibling_devel(rpm2)
 
         yield (ComparisonHalf(subject=_rpm,
This page took 0.035458 seconds and 5 git commands to generate.