On 1/26/26 9:34 PM, Eli Schwartz wrote: > It is feature-compatible with rpm2tar but utilizes the rpm codebase. The > first any-of element remains rpm2targz as it's vastly smaller, but for > users who happen to have rpm installed as a dep of some other package, > there is no need to additionally install another package. > > Signed-off-by: Eli Schwartz <[email protected]> > ---
Locally applied to the commit message:
23: 9419e14f29e8 ! 23: 01ef29c35981 rpm.eclass: allow using
rpm2archive from rpm itself
@@ Commit message
users who happen to have rpm installed as a dep of some other
package,
there is no need to additionally install another package.
+ rpm 4.19.0 is required because:
+
+ - rpm2archive was added in 2014 / rpm 4.12
+ - it learned -n in 2021 / rpm 4.17
+ - it learned to write to a pipe in 2022 / rpm 4.19
+
Signed-off-by: Eli Schwartz <[email protected]>
## eclass/rpm.eclass ##
> eclass/rpm.eclass | 17 +++++++++++++++--
> 1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
> index b9e1b87a29de..3b7f9e64355b 100644
> --- a/eclass/rpm.eclass
> +++ b/eclass/rpm.eclass
> @@ -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,7 +42,15 @@ rpm_unpack() {
> else
> a="${DISTDIR}/${a}"
> fi
> - rpm2tar -O "${a}" | tar xf -
> +
> + 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
> }
--
Eli Schwartz
OpenPGP_signature.asc
Description: OpenPGP digital signature
