Gentoo Archives: gentoo-dev

From: Florian Schmaus <flo@×××××××××.eu>
To: gentoo-dev@l.g.o
Cc: Florian Schmaus <flo@×××××××××.eu>
Subject: [gentoo-dev] [PATCH 3/3] rebar.eclass: add support for EAPI 7
Date: Mon, 12 Apr 2021 08:30:45
Message-Id: 20210412082902.162091-3-flo@geekplace.eu
In Reply to: [gentoo-dev] [PATCH 1/3] rebar.eclass: fix @RETURN argument by Florian Schmaus
1 Thanks To Sam James for reviewing this and providing feedback.
2
3 Closes: https://bugs.gentoo.org/770283
4 Signed-off-by: Florian Schmaus <flo@×××××××××.eu>
5 ---
6 eclass/rebar.eclass | 25 +++++++++++++++----------
7 1 file changed, 15 insertions(+), 10 deletions(-)
8
9 diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
10 index 2ec255486463..c6781b211470 100644
11 --- a/eclass/rebar.eclass
12 +++ b/eclass/rebar.eclass
13 @@ -1,4 +1,4 @@
14 -# Copyright 1999-2020 Gentoo Authors
15 +# Copyright 1999-2021 Gentoo Authors
16 # Distributed under the terms of the GNU General Public License v2
17
18 # @ECLASS: rebar.eclass
19 @@ -6,7 +6,7 @@
20 # maintainer-needed@g.o
21 # @AUTHOR:
22 # Amadeusz Żołnowski <aidecoe@g.o>
23 -# @SUPPORTED_EAPIS: 6
24 +# @SUPPORTED_EAPIS: 6 7
25 # @BLURB: Build Erlang/OTP projects using dev-util/rebar.
26 # @DESCRIPTION:
27 # An eclass providing functions to build Erlang/OTP projects using
28 @@ -23,7 +23,7 @@ case "${EAPI:-0}" in
29 0|1|2|3|4|5)
30 die "Unsupported EAPI=${EAPI:-0} (too old) for ${ECLASS}"
31 ;;
32 - 6)
33 + 6|7)
34 ;;
35 *)
36 die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
37 @@ -33,9 +33,14 @@ esac
38 EXPORT_FUNCTIONS src_prepare src_compile src_test src_install
39
40 RDEPEND="dev-lang/erlang:="
41 -DEPEND="${RDEPEND}
42 +DEPEND="${RDEPEND}"
43 +BDEPEND="
44 dev-util/rebar
45 - >=sys-apps/gawk-4.1"
46 + >=sys-apps/gawk-4.1
47 +"
48 +if [[ ${EAPI} == 6 ]]; then
49 + DEPEND+="${BDEPEND}"
50 +fi
51
52 # @ECLASS-VARIABLE: REBAR_APP_SRC
53 # @DESCRIPTION:
54 @@ -63,7 +68,7 @@ _rebar_find_dep() {
55 local p
56 local result
57
58 - pushd "${EPREFIX}$(get_erl_libs)" >/dev/null || return 1
59 + pushd "${EPREFIX%/}/$(get_erl_libs)" >/dev/null || return 1
60 for p in ${pn} ${pn}-*; do
61 if [[ -d ${p} ]]; then
62 # Ensure there's at most one matching.
63 @@ -102,7 +107,7 @@ erebar() {
64
65 (( $# > 0 )) || die "erebar: at least one target is required"
66
67 - local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
68 + local -x ERL_LIBS="${EPREFIX%/}/$(get_erl_libs)"
69 [[ ${1} == eunit ]] && local -x ERL_LIBS="."
70
71 rebar -v skip_deps=true "$@" || die -n "rebar $@ failed"
72 @@ -123,7 +128,7 @@ rebar_fix_include_path() {
73
74 local pn="${1}"
75 local rebar_config="${2:-rebar.config}"
76 - local erl_libs="${EPREFIX}$(get_erl_libs)"
77 + local erl_libs="${EPREFIX%/}/$(get_erl_libs)"
78 local p
79
80 p="$(_rebar_find_dep "${pn}")" \
81 @@ -212,7 +217,7 @@ rebar_src_prepare() {
82 rebar_src_configure() {
83 debug-print-function ${FUNCNAME} "${@}"
84
85 - local -x ERL_LIBS="${EPREFIX}$(get_erl_libs)"
86 + local -x ERL_LIBS="${EPREFIX%/}/$(get_erl_libs)"
87 default
88 }
89
90 @@ -252,7 +257,7 @@ rebar_src_install() {
91 [[ -d bin ]] && for bin in bin/*; do dobin "$bin"; done
92
93 if [[ -d priv ]]; then
94 - cp -pR priv "${ED}${dest}/" || die "failed to install priv/"
95 + cp -pR priv "${ED%/}/${dest}/" || die "failed to install priv/"
96 fi
97
98 einstalldocs
99 --
100 2.30.2