Gentoo Archives: gentoo-dev

From: "Amadeusz Żołnowski" <aidecoe@g.o>
To: "Michał Górny" <mgorny@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] rebar.eclass: Build Erlang/OTP projects using dev-util/rebar
Date: Sat, 21 May 2016 22:12:04
Message-Id: 877fenvz6m.fsf@freja.aidecoe.name
In Reply to: Re: [gentoo-dev] [PATCH] rebar.eclass: Build Erlang/OTP projects using dev-util/rebar by "Michał Górny"
1 Michał Górny <mgorny@g.o> writes:
2 >> +# Run rebar with verbose flag. Die on failure.
3 >> +erebar() {
4 >> + debug-print-function ${FUNCNAME} "${@}"
5 >> +
6 >> + (( $# > 0 )) || die 'erebar: at least one target is required'
7 >
8 > Why not [[ $# -gt 0 ]]? It's the first time I see someone using (( ))
9 > for conditionals.
10
11 '>' reads better than some '-gt'.
12
13
14 >> + evar_push ERL_LIBS
15 >> + export ERL_LIBS="${EPREFIX}$(get_erl_libs)"
16 >
17 > local -x ERL_LIBS=...
18 >
19 > We don't really have to employ terribly ugly eval hackery to have
20 > a local variable.
21
22 Fixed. I hoped there's better way! (-:
23
24
25 > I meant indent like this:
26 >
27 > + eawk rebar.config \
28 > + -v erl_libs="${erl_libs}" -v pn="${pn}" -v pv="${pv}" \
29 > + '/^{[[:space:]]*erl_opts[[:space:]]*,/, /}[[:space:]]*\.$/ {
30 > + pattern = "\"(./)?deps/" pn "/include\"";
31 > + if (match($0, "{i,[[:space:]]*" pattern "[[:space:]]*}")) {
32 > + sub(pattern, "\"" erl_libs "/" pn "-" pv "/include\"");
33 > + }
34 > + print $0;
35 > + next;
36 > + }
37 > + 1
38 > + ' || die "failed to fix include paths in rebar.config"
39
40 OK.
41
42
43 >> + insinto "${dest}"
44 >> + doins -r ebin
45 >> + [[ -d include ]] && doins -r include
46 >> + [[ -d bin ]] && for bin in bin/*; do dobin "$bin"; done
47 >> + [[ -d priv ]] && cp -pR priv "${ED}${dest}/"
48 >
49 > Missing ||die. Just don't do it as one-liner :-P.
50
51 You've got me! ;-)
52
53
54 Thanks,
55 --
56 Amadeusz Żołnowski

Attachments

File name MIME type
signature.asc application/pgp-signature