[applied] abipkgdiff: Recognize stablelist files in their package

Message ID 878qqnjc3v.fsf@redhat.com
State New
Headers
Series [applied] abipkgdiff: Recognize stablelist files in their package |

Commit Message

Dodji Seketeli Feb. 3, 2025, 3:12 p.m. UTC
  Hello,

A Kernel ABI "whitelist" is now called a Kernel ABI stablelist.  The
file containing the stablist in the kernel stablelist package has also
changed.

This patch makes abipkgdiff recognize that otherwise, no stablelist is
found and then analyzing a Linux Kernel becomes super slow.

	* tools/abipkgdiff.cc (maybe_collect_kabi_whitelists):  Recognize
	files with prefix "kabi_stablelist_" as being a stablelist file,
	in addition to the old kabi_whitelist_ prefix.

Signed-off-by: Dodji Seketeli <dodji@redhat.com>
Applied to the mainline.
---
 tools/abipkgdiff.cc | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)
  

Patch

diff --git a/tools/abipkgdiff.cc b/tools/abipkgdiff.cc
index c55ae577..335da9c3 100644
--- a/tools/abipkgdiff.cc
+++ b/tools/abipkgdiff.cc
@@ -1995,12 +1995,12 @@  must_compare_public_dso_only(package& pkg, options& opts)
 ///
 /// @param arch the architecture to consider.
 ///
-/// @param whitelists out parameter.  If @p entry is the whitelist we
-/// are looking for, add its path to this output parameter.
+/// @param stablelists out parameter.  If @p entry is the stablelist
+/// we are looking for, add its path to this output parameter.
 static void
 maybe_collect_kabi_whitelists(const FTSENT *entry,
 			      const string arch,
-			      vector<string> &whitelists)
+			       vector<string> &stablelists)
 {
   if (entry == NULL
       || (entry->fts_info != FTS_F && entry->fts_info != FTS_SL)
@@ -2011,10 +2011,17 @@  maybe_collect_kabi_whitelists(const FTSENT *entry,
   string path = entry->fts_path;
   maybe_get_symlink_target_file_path(path, path);
 
-  string kabi_whitelist_name = "kabi_whitelist_" + arch;
+  vector<string> stablelist_prefixes;
+  stablelist_prefixes.push_back("kabi_whitelist_");
+  stablelist_prefixes.push_back("kabi_stablelist_");
 
-  if (string_ends_with(path, kabi_whitelist_name))
-    whitelists.push_back(path);
+  string kabi_stablelist_name;
+  for (auto prefix : stablelist_prefixes)
+    {
+      kabi_stablelist_name = prefix + arch;
+      if (string_ends_with(path, kabi_stablelist_name))
+	stablelists.push_back(path);
+    }
 }
 
 /// Get the kabi whitelist for a particular architecture under a given