File gdb-add-rpm-suggestion-script-suse.patch of Package gdb

From 335a561f6eb23f1a67dff85355c66f2c8797bbb3 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@linux-m68k.org>
Date: Sun, 29 Dec 2024 11:10:34 +0100
Subject: [PATCH] gdb-add-rpm-suggestion-script-suse.patch

---
 gdb/python/lib/gdb/command/rpm-suggestions.py | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/gdb/python/lib/gdb/command/rpm-suggestions.py b/gdb/python/lib/gdb/command/rpm-suggestions.py
index bcae2ba2fd7..a1fd9576ed6 100644
--- a/gdb/python/lib/gdb/command/rpm-suggestions.py
+++ b/gdb/python/lib/gdb/command/rpm-suggestions.py
@@ -211,9 +211,9 @@ else:
         global find_objfile_suggestions_re
 
         if find_objfile_suggestions_re is None:
-            find_objfile_suggestions_re = re.compile("^(.*)-debuginfo-(.*) : Debug information for package (.*)$")
+            find_objfile_suggestions_re = re.compile("^<solvable .* name=\"(.*)-debuginfo\" summary=\"Debug information for package (.*)\".*$")
 
-        result = subprocess.run(['dnf', "--enablerepo=*debug*", '--nogpgcheck', '-C', 'provides',
+        result = subprocess.run(['zypper', '--xml-out', '--plus-content=debug', '--no-gpg-check', 'search', '--file-list', '--match-exact',
                                  build_id_to_usr_lib_filename(build_id, True)],
                                 capture_output=True, timeout=30)
 
@@ -224,11 +224,11 @@ else:
             m = find_objfile_suggestions_re.match(l)
             if not m:
                 continue
-            if m.group(1) != m.group(3):
+            if m.group(1) != m.group(2):
                 return
 
-            main_rpm = m.group(1) + '-' + m.group(2)
-            dbg_rpm = m.group(1) + '-debuginfo-' + m.group(2)
+            main_rpm = m.group(1)
+            dbg_rpm = m.group(1) + '-debuginfo'
 
             if not is_rpm_installed(ts, main_rpm):
                 add_rpm_suggestion(main_rpm)
@@ -351,7 +351,7 @@ else:
     # Take a non-empty list of RPM names and print a command line a
     # user could run to install these RPMs.
     def print_rpm_suggestions(rpm_name_list):
-        print("Missing rpms, try: dnf --enablerepo='*debug*' install " + ' '.join(rpm_name_list))
+        print("Missing rpms, try: zypper --plus-content=debug install " + ' '.join(rpm_name_list))
 
     # Take a non-empty list of build-id strings and print a series of
     # lines that a user could run to instll the RPMs that provide
@@ -361,10 +361,8 @@ else:
     # packages for the executable with the given build-id.
     def print_build_id_suggestions(build_id_list):
         for build_id in build_id_list:
-            print("Missing file(s), try: dnf --enablerepo='*debug*' install "
-                  + build_id_to_usr_lib_filename(build_id, False)
-                  + ' '
-                  + build_id_to_usr_lib_filename(build_id, True, ".debug"))
+            print("Missing file(s), try: zypper --plus-content=debug install -C "
+                  + '"debuginfo(build-id)=' + build_id + '"')
 
     # Called before GDB displays its prompt.  If the global __SUGGEST_RPMS
     # dictionary is not empty, then this hook prints the keys of this
-- 
2.47.1

openSUSE Build Service is sponsored by