eclass/rpm: Sync with Gentoo

It's from Gentoo commit 26b30e180a4b2583452508d79ebb35d0e97fc696.

Signed-off-by: Flatcar Buildbot <buildbot@flatcar-linux.org>
This commit is contained in:
Flatcar Buildbot 2026-03-23 07:35:18 +00:00
parent d06d79b03c
commit eab6759068

View File

@ -1,4 +1,4 @@
# Copyright 1999-2025 Gentoo Authors
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: rpm.eclass
@ -8,7 +8,7 @@
# @BLURB: convenience class for extracting RPMs
case ${EAPI} in
7|8) ;;
7|8) inherit eapi9-pipestatus ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
@ -17,7 +17,12 @@ _RPM_ECLASS=1
inherit estack
BDEPEND="app-arch/rpm2targz"
BDEPEND="
|| (
app-arch/rpm2targz
>=app-arch/rpm-4.19.0
)
"
# @FUNCTION: rpm_unpack
# @USAGE: <rpms>
@ -37,8 +42,16 @@ rpm_unpack() {
else
a="${DISTDIR}/${a}"
fi
rpm2tar -O "${a}" | tar xf -
assert "failure unpacking ${a}"
if command -v rpm2tar >/dev/null; then
local extracttool=(rpm2tar -O)
else
# app-arch/rpm fallback
local extracttool=(rpm2archive -n)
fi
"${extracttool[@]}" "${a}" | tar xf -
pipestatus || die "failure unpacking ${a}"
done
}