Use debuginfo-install for installing debuginfos
Resolves
@@ -136,6 +136,22 @@ class PrepareInstall(tmt.steps.prepare.PreparePlugin):
self.info('copr', copr, 'green')
guest.execute(f'{command} copr enable -y {copr}')
+ def _prepare_install(self, package_list):
+ # Show a brief summary by default
+ if not self.opt('verbose'):
+ summary = fmf.utils.listed(package_list, max=3)
+ self.info('package', summary, 'green')
+ # Provide a full list of packages in verbose mode
+ else:
+ summary = fmf.utils.listed(package_list, 'package')
+ self.info('package', summary + ' requested', 'green')
+ for package in sorted(package_list):
+ self.verbose(package, shift=1)
+ # Quote package names and prepare the rpm check
+ packages = ' '.join(
+ [tmt.utils.quote(package) for package in package_list])
+ return packages
+
def go(self, guest):
""" Prepare the guests """
super().go()
@@ -165,15 +181,24 @@ class PrepareInstall(tmt.steps.prepare.PreparePlugin):
packages = self.get('package', [])
repo_packages = []
local_packages = []
+ debuginfo_packages = []
directories = self.get('directory', [])
if not packages and not directories:
self.debug("No packages for installation found.", level=3)
return
# Detect local packages and directories
+ # and split debug{info,source} if installing from repo
for package in packages:
if package.endswith('.rpm'):
local_packages.append(package)
+ else:
+ if 'debuginfo' in package or 'debugsource' in package:
+ # strip -debuginfo suffix from package name
+ # installing with it doesn't work on RHEL7
+ if re.search(r"-debuginfo\\.|-debuginfo$", package):
+ package = package.replace('-debuginfo', '')
+ debuginfo_packages.append(package)
else:
repo_packages.append(package)
@@ -215,19 +240,7 @@ class PrepareInstall(tmt.steps.prepare.PreparePlugin):
# Install from repositories
if repo_packages:
- # Show a brief summary by default
- if not self.opt('verbose'):
- summary = fmf.utils.listed(repo_packages, max=3)
- self.info('package', summary, 'green')
- # Provide a full list of packages in verbose mode
- else:
- summary = fmf.utils.listed(repo_packages, 'package')
- self.info('package', summary + ' requested', 'green')
- for package in sorted(repo_packages):
- self.verbose(package, shift=1)
- # Quote package names and prepare the rpm check
- packages = ' '.join(
- [tmt.utils.quote(package) for package in repo_packages])
+ packages = self._prepare_install(repo_packages)
check = f'rpm -q --whatprovides {packages}'
# Extra ignore/check for yum to workaround BZ#1920176
if 'yum' in command:
@@ -238,3 +251,10 @@ class PrepareInstall(tmt.steps.prepare.PreparePlugin):
guest.execute(
f"{check} || {command} install {options} "
f"{packages}{yum_check}")
+
+ # Install debug{info,source} from repos
+ if debuginfo_packages:
+ packages = self._prepare_install(debuginfo_packages)
+ # make sure debuginfo-install is present on the target system
+ guest.execute(f"{command} install -y /usr/bin/debuginfo-install")
+ guest.execute(f"debuginfo-install -y {packages}")
