commit:     3b4d86d292e43516a6244bb6b7897ac3a28da180
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 23 18:36:57 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Sat Jun 26 17:05:57 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b4d86d2

rpm.eclass: Support EAPI 8, some cleanup

Closes: https://bugs.gentoo.org/655256
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eclass/rpm.eclass | 33 ++++++++++++++++++++-------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
index 351d7974877..77db8e80879 100644
--- a/eclass/rpm.eclass
+++ b/eclass/rpm.eclass
@@ -4,11 +4,13 @@
 # @ECLASS: rpm.eclass
 # @MAINTAINER:
 # base-sys...@gentoo.org
-# @SUPPORTED_EAPIS: 5 6 7
+# @SUPPORTED_EAPIS: 5 6 7 8
 # @BLURB: convenience class for extracting RPMs
 
-case ${EAPI:-0} in
-       [567]) inherit eutils ;;
+case ${EAPI} in
+       5|6) inherit epatch eutils ;; # eutils for eqawarn
+       7) inherit eutils ;; # not needed, but ebuilds may still rely on it
+       8) ;;
        *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
 esac
 
@@ -19,9 +21,9 @@ _RPM_ECLASS=1
 
 inherit estack
 
-case "${EAPI:-0}" in
-       [0-6]) DEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
-       *) BDEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
+case ${EAPI} in
+       5|6) DEPEND="app-arch/rpm2targz" ;;
+       *) BDEPEND="app-arch/rpm2targz" ;;
 esac
 
 # @FUNCTION: rpm_unpack
@@ -34,15 +36,16 @@ rpm_unpack() {
        for a in "$@" ; do
                echo ">>> Unpacking ${a} to ${PWD}"
                if [[ ${a} == ./* ]] ; then
-                       : nothing to do -- path is local
-               elif [[ ${a} == ${DISTDIR}/* ]] ; then
-                       ewarn 'QA: do not use ${DISTDIR} with rpm_unpack -- it 
is added for you'
+                       : # nothing to do -- path is local
+               elif [[ ${a} == "${DISTDIR}"/* ]] ; then
+                       eqawarn 'do not use ${DISTDIR} with rpm_unpack -- it is 
added for you'
                elif [[ ${a} == /* ]] ; then
-                       ewarn 'QA: do not use full paths with rpm_unpack -- use 
./ paths instead'
+                       eqawarn 'do not use full paths with rpm_unpack -- use 
./ paths instead'
                else
                        a="${DISTDIR}/${a}"
                fi
-               rpm2tar -O "${a}" | tar xf - || die "failure unpacking ${a}"
+               rpm2tar -O "${a}" | tar xf -
+               assert "failure unpacking ${a}"
        done
 }
 
@@ -64,9 +67,9 @@ srcrpm_unpack() {
 
        # unpack everything
        local a
-       for a in *.tar.{gz,bz2,xz} *.t{gz,bz2,xz,pxz} *.zip *.ZIP ; do
+       for a in *.tar.{gz,bz2,xz} *.t{gz,bz2,xz} *.zip *.ZIP ; do
                unpack "./${a}"
-               rm -f "${a}"
+               rm -f "${a}" || die
        done
 
        eshopts_pop
@@ -90,11 +93,15 @@ rpm_src_unpack() {
 
 # @FUNCTION: rpm_spec_epatch
 # @USAGE: [spec]
+# @DEPRECATED: none
 # @DESCRIPTION:
 # Read the specified spec (defaults to ${PN}.spec) and attempt to apply
 # all the patches listed in it.  If the spec does funky things like moving
 # files around, well this won't handle that.
 rpm_spec_epatch() {
+       # no epatch in EAPI 7 and later
+       [[ ${EAPI} == [56] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}"
+
        local p spec=$1
        local dir
 

Reply via email to