[applied] fedabipkgdiff: Cleanup output of ABI comparison

Message ID 87bk5s8azr.fsf@redhat.com
State New
Headers
Series [applied] fedabipkgdiff: Cleanup output of ABI comparison |

Commit Message

Dodji Seketeli April 29, 2024, 3:06 p.m. UTC
  Hello,

The output of fedabipkgidiff doesn't clearly say when two
(sub)packages have no ABI change.

This patch fixes that.  The patch also trims unnecessary white spaces
from the output of fedabipkgdiff.  As a result, the patch adjusts the
expected reference output files.

	* tools/fedabipkgdiff: Adjust copyright year
	(abipkgdiff): Strip out trailing spaces from the stdout
	string.  Emit a clear message when no ABI change was found.
	* tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt:
	Adjust.
	* tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt:
	Adjust.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to master.
---
 .../test0-from-fc20-to-fc23-dbus-glib-report-0.txt |  2 --
 ...0-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt |  1 -
 ...0.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt |  2 --
 ....i686--dbus-glib-0.106-1.fc23.i686-report-0.txt |  1 -
 ...4.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt |  1 -
 ..._64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt |  1 -
 ...4--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt |  1 -
 ...7-self-compare-from-fc23-dbus-glib-report-0.txt |  8 ++++----
 tools/fedabipkgdiff                                | 14 +++++++++++---
 9 files changed, 15 insertions(+), 16 deletions(-)
  

Patch

diff --git a/tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt b/tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt
index 3e04feb0..a0f98f30 100644
--- a/tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test0-from-fc20-to-fc23-dbus-glib-report-0.txt
@@ -26,7 +26,6 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.i686.rpm and dbus
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
 Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and dbus-glib-0.106-1.fc23.x86_64.rpm:
 
 ================ changes of 'libdbus-glib-1.so.2.2.2'===============
@@ -51,4 +50,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and db
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt b/tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt
index 9f4d1f65..567aaab5 100644
--- a/tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test1-from-fc20-to-dbus-glib-0.106-1.fc23.x86_64-report-0.txt
@@ -22,4 +22,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and db
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt b/tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt
index 3e04feb0..a0f98f30 100644
--- a/tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test2-dbus-glib-0.100.2-2.fc20--dbus-glib-0.106-1.fc23-report-0.txt
@@ -26,7 +26,6 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.i686.rpm and dbus
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
 Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and dbus-glib-0.106-1.fc23.x86_64.rpm:
 
 ================ changes of 'libdbus-glib-1.so.2.2.2'===============
@@ -51,4 +50,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and db
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt b/tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt
index 8413f4a2..4ef9e60a 100644
--- a/tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test3-dbus-glib-0.100.2-2.fc20.i686--dbus-glib-0.106-1.fc23.i686-report-0.txt
@@ -26,4 +26,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.i686.rpm and dbus
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt b/tests/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 9f4d1f65..567aaab5 100644
--- a/tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test4-glib-0.100.2-2.fc20.x86_64.rpm-glib-0.106-1.fc23.x86_64.rpm-report-0.txt
@@ -22,4 +22,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and db
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt b/tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt
index 63378fd8..e093078e 100644
--- a/tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test5-same-dir-dbus-glib-0.100.2-2.fc20.x86_64--dbus-glib-0.106-1.fc23.x86_64-report-0.txt
@@ -26,4 +26,3 @@  Comparing the ABI of binaries between dbus-glib-0.100.2-2.fc20.x86_64.rpm and db
 
 ================ end of changes of 'dbus-binding-tool'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt b/tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt
index 006b334e..9d05efa4 100644
--- a/tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test6-nss-util-3.12.6-1.fc14.x86_64--nss-util-3.24.0-2.0.fc25.x86_64-report-0.txt
@@ -48,4 +48,3 @@  Comparing the ABI of binaries between nss-util-3.12.6-1.fc14.x86_64.rpm and nss-
 
 ================ end of changes of 'libnssutil3.so'===============
 
-
diff --git a/tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt b/tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt
index 5c5b95d3..1ed26f4c 100644
--- a/tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt
+++ b/tests/data/test-fedabipkgdiff/test7-self-compare-from-fc23-dbus-glib-report-0.txt
@@ -1,18 +1,18 @@ 
 Comparing the ABI of binaries between dbus-glib-0.106-1.fc23.i686.rpm and dbus-glib-0.106-1.fc23.i686.rpm:
-
 ==== SELF CHECK SUCCEEDED for 'libdbus-glib-1.so.2.3.3' ====
 ==== SELF CHECK SUCCEEDED for 'dbus-binding-tool' ====
+No ABI change between dbus-glib-0.106-1.fc23.i686.rpm and dbus-glib-0.106-1.fc23.i686.rpm
 
 Comparing the ABI of binaries between dbus-glib-devel-0.106-1.fc23.i686.rpm and dbus-glib-devel-0.106-1.fc23.i686.rpm:
-
 ==== SELF CHECK SUCCEEDED for 'dbus-bash-completion-helper' ====
+No ABI change between dbus-glib-devel-0.106-1.fc23.i686.rpm and dbus-glib-devel-0.106-1.fc23.i686.rpm
 
 Comparing the ABI of binaries between dbus-glib-0.106-1.fc23.x86_64.rpm and dbus-glib-0.106-1.fc23.x86_64.rpm:
-
 ==== SELF CHECK SUCCEEDED for 'libdbus-glib-1.so.2.3.3' ====
 ==== SELF CHECK SUCCEEDED for 'dbus-binding-tool' ====
+No ABI change between dbus-glib-0.106-1.fc23.x86_64.rpm and dbus-glib-0.106-1.fc23.x86_64.rpm
 
 Comparing the ABI of binaries between dbus-glib-devel-0.106-1.fc23.x86_64.rpm and dbus-glib-devel-0.106-1.fc23.x86_64.rpm:
-
 ==== SELF CHECK SUCCEEDED for 'dbus-bash-completion-helper' ====
+No ABI change between dbus-glib-devel-0.106-1.fc23.x86_64.rpm and dbus-glib-devel-0.106-1.fc23.x86_64.rpm
 
diff --git a/tools/fedabipkgdiff b/tools/fedabipkgdiff
index de494d17..49254c7d 100755
--- a/tools/fedabipkgdiff
+++ b/tools/fedabipkgdiff
@@ -3,7 +3,7 @@ 
 # -*- coding: utf-8 -*-
 # -*- Mode: Python
 #
-# Copyright (C) 2013-2023 Red Hat, Inc.
+# Copyright (C) 2013-2024 Red Hat, Inc.
 #
 # Author: Chenxiong Qi
 
@@ -1184,13 +1184,14 @@  def abipkgdiff(cmp_half1, cmp_half2):
 
     print('Comparing the ABI of binaries between {0} and {1}:'.format(
         cmp_half1.subject.filename, cmp_half2.subject.filename))
-    print()
 
     proc = subprocess.Popen(' '.join(cmd), shell=True,
                             stdout=subprocess.PIPE, stderr=subprocess.PIPE,
                             universal_newlines=True)
 
     stdout, stderr = proc.communicate()
+    stdout=stdout.strip()
+    stderr=stderr.strip()
 
     is_ok = proc.returncode == ABIDIFF_OK
     is_internal_error = proc.returncode & ABIDIFF_ERROR or proc.returncode & ABIDIFF_USAGE_ERROR
@@ -1198,9 +1199,16 @@  def abipkgdiff(cmp_half1, cmp_half2):
 
     if is_internal_error:
         six.print_(stderr, file=sys.stderr)
-    elif is_ok or has_abi_change:
+    elif has_abi_change:
+        print()
         print(stdout)
+    elif is_ok:
+        if stdout != '':
+            print(stdout)
+        print('No ABI change between {0} and {1}'.format(cmp_half1.subject.filename,
+                                                         cmp_half2.subject.filename))
 
+    print()
     return proc.returncode