You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On QEMU tests/acceptance/boot_linux_console.py, the LinuxKernelTest class has two utility methods to extract from deb and from rpm. It would be good if we could add those two utilities to our avocado/utils.
Code from QEMU:
defextract_from_deb(self, deb, path):
""" Extracts a file from a deb package into the test workdir :param deb: path to the deb archive :param path: path within the deb archive of the file to be extracted :returns: path of the extracted file """cwd=os.getcwd()
os.chdir(self.workdir)
file_path=process.run("ar t %s"%deb).stdout_text.split()[2]
process.run("ar x %s %s"% (deb, file_path))
archive.extract(file_path, self.workdir)
os.chdir(cwd)
# Return complete path to extracted file. Because callers to# extract_from_deb() specify 'path' with a leading slash, it is# necessary to use os.path.relpath() as otherwise os.path.join()# interprets it as an absolute path and drops the self.workdir part.returnos.path.normpath(os.path.join(self.workdir,
os.path.relpath(path, '/')))
defextract_from_rpm(self, rpm, path):
""" Extracts a file from an RPM package into the test workdir. :param rpm: path to the rpm archive :param path: path within the rpm archive of the file to be extracted needs to be a relative path (starting with './') because cpio(1), which is used to extract the file, expects that. :returns: path of the extracted file """cwd=os.getcwd()
os.chdir(self.workdir)
process.run("rpm2cpio %s | cpio -id %s"% (rpm, path), shell=True)
os.chdir(cwd)
returnos.path.normpath(os.path.join(self.workdir, path))
The text was updated successfully, but these errors were encountered:
On QEMU
tests/acceptance/boot_linux_console.py
, the LinuxKernelTest class has two utility methods to extract from deb and from rpm. It would be good if we could add those two utilities to ouravocado/utils
.Code from QEMU:
The text was updated successfully, but these errors were encountered: