Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: "Ulrich Müller" <ulm@g.o>
Subject: [gentoo-dev] [PATCH] rpm.eclass: Support EAPI 8, some cleanup
Date: Thu, 24 Jun 2021 14:06:49
Message-Id: 20210624140627.23268-1-ulm@gentoo.org
1 Closes: https://bugs.gentoo.org/655256
2 Signed-off-by: Ulrich Müller <ulm@g.o>
3 ---
4 eclass/rpm.eclass | 28 ++++++++++++++++++----------
5 1 file changed, 18 insertions(+), 10 deletions(-)
6
7 diff --git a/eclass/rpm.eclass b/eclass/rpm.eclass
8 index 351d7974877e..1757e2cba5f2 100644
9 --- a/eclass/rpm.eclass
10 +++ b/eclass/rpm.eclass
11 @@ -4,11 +4,14 @@
12 # @ECLASS: rpm.eclass
13 # @MAINTAINER:
14 # base-system@g.o
15 -# @SUPPORTED_EAPIS: 5 6 7
16 +# @SUPPORTED_EAPIS: 5 6 7 8
17 # @BLURB: convenience class for extracting RPMs
18
19 -case ${EAPI:-0} in
20 - [567]) inherit eutils ;;
21 +case ${EAPI} in
22 + # eutils not actually needed, only inherited in case ebuilds rely on it
23 + 5|6) inherit epatch eutils ;;
24 + 7) inherit eutils ;;
25 + 8) ;;
26 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
27 esac
28
29 @@ -19,8 +22,8 @@ _RPM_ECLASS=1
30
31 inherit estack
32
33 -case "${EAPI:-0}" in
34 - [0-6]) DEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
35 +case ${EAPI} in
36 + 5|6) DEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
37 *) BDEPEND=">=app-arch/rpm2targz-9.0.0.3g" ;;
38 esac
39
40 @@ -34,15 +37,16 @@ rpm_unpack() {
41 for a in "$@" ; do
42 echo ">>> Unpacking ${a} to ${PWD}"
43 if [[ ${a} == ./* ]] ; then
44 - : nothing to do -- path is local
45 - elif [[ ${a} == ${DISTDIR}/* ]] ; then
46 + : # nothing to do -- path is local
47 + elif [[ ${a} == "${DISTDIR}"/* ]] ; then
48 ewarn 'QA: do not use ${DISTDIR} with rpm_unpack -- it is added for you'
49 elif [[ ${a} == /* ]] ; then
50 ewarn 'QA: do not use full paths with rpm_unpack -- use ./ paths instead'
51 else
52 a="${DISTDIR}/${a}"
53 fi
54 - rpm2tar -O "${a}" | tar xf - || die "failure unpacking ${a}"
55 + rpm2tar -O "${a}" | tar xf -
56 + assert "failure unpacking ${a}"
57 done
58 }
59
60 @@ -64,9 +68,9 @@ srcrpm_unpack() {
61
62 # unpack everything
63 local a
64 - for a in *.tar.{gz,bz2,xz} *.t{gz,bz2,xz,pxz} *.zip *.ZIP ; do
65 + for a in *.tar.{gz,bz2,xz} *.t{gz,bz2,xz} *.zip *.ZIP ; do
66 unpack "./${a}"
67 - rm -f "${a}"
68 + rm -f "${a}" || die
69 done
70
71 eshopts_pop
72 @@ -90,11 +94,15 @@ rpm_src_unpack() {
73
74 # @FUNCTION: rpm_spec_epatch
75 # @USAGE: [spec]
76 +# @DEPRECATED: none
77 # @DESCRIPTION:
78 # Read the specified spec (defaults to ${PN}.spec) and attempt to apply
79 # all the patches listed in it. If the spec does funky things like moving
80 # files around, well this won't handle that.
81 rpm_spec_epatch() {
82 + # no epatch in EAPI 7 and later
83 + [[ ${EAPI} == [56] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}"
84 +
85 local p spec=$1
86 local dir
87
88 --
89 2.32.0