Unpack RPMs using rpm2archive

This should support both older files compressed with cpio as well as
newer zstd-compressed files.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2020-06-24 14:47:28 +02:00 committed by lsedlar
parent 7d00942d13
commit f5e33950c1

View File

@ -189,8 +189,9 @@ def explode_rpm_package(pkg_path, target_dir):
"""Explode a rpm package into target_dir.""" """Explode a rpm package into target_dir."""
pkg_path = os.path.abspath(pkg_path) pkg_path = os.path.abspath(pkg_path)
makedirs(target_dir) makedirs(target_dir)
# rpm2archive writes to stdout only if reading from stdin, thus the redirect
run( run(
"rpm2cpio %s | cpio -iuvmd && chmod -R a+rX ." % shlex_quote(pkg_path), "rpm2archive - <%s | tar xfz - && chmod -R a+rX ." % shlex_quote(pkg_path),
workdir=target_dir, workdir=target_dir,
) )