Gentoo Archives: gentoo-dev

From: Peter Stuge <peter@×××××.se>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] rebar.eclass: Build Erlang/OTP projects using dev-util/rebar
Date: Wed, 18 May 2016 23:34:09
Message-Id: 20160518232658.GM26940@foo.stuge.se
In Reply to: [gentoo-dev] [PATCH] rebar.eclass: Build Erlang/OTP projects using dev-util/rebar by aidecoe@gentoo.org
1 Cool!
2
3 aidecoe@g.o wrote:
4 > +_find_dep_version() {
5 > + local pn="$1"
6 > + local p
7 > +
8 > + pushd "${EPREFIX}$(get_erl_libs)" >/dev/null
9 > + for p in ${pn} ${pn}-*; do
10 > + if [[ -d ${p} ]]; then
11 > + echo "${p#${pn}-}"
12 > + return 0
13
14 No popd on success?
15
16 > + fi
17 > + done
18 > + popd >/dev/null
19 > +
20 > + return 1
21 > +}
22
23
24
25 > +# @FUNCTION: eawk
26 > +# @USAGE: <file> <args>
27 > +# @DESCRIPTION:
28 > +# Edit file <file> in place with awk. Pass all arguments following <file> to
29 > +# awk.
30 > +eawk() {
31 > + local f="$1"; shift
32 > + local tmpf="$(emktemp)"
33 > +
34 > + cat "${f}" >"${tmpf}" || return 1
35 > + awk "$@" "${tmpf}" >"${f}"
36 > +}
37
38 Wouldn't it be nicer to cut cat, awk > $tmpf && mv $tmpf $f ?
39
40
41 //Peter

Replies