Gentoo Archives: gentoo-dev

From: Alec Warner <antarus@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-dev] [PATCH eutils] Introduce run_in_build_dir() used in a few ebuilds.
Date: Sun, 13 Jan 2013 15:37:05
Message-Id: CAAr7Pr_9n0PhHPywNQ53mUWF+i5KT67CDUC=9W3Mz9h=0HojSw@mail.gmail.com
In Reply to: [gentoo-dev] [PATCH eutils] Introduce run_in_build_dir() used in a few ebuilds. by "Michał Górny"
1 On Sun, Jan 13, 2013 at 5:29 AM, Michał Górny <mgorny@g.o> wrote:
2 > The run_in_build_dir() command simply runs given command
3 > in the directory stated as BUILD_DIR. This variable is used commonly
4 > by autotools-utils, cmake-utils and python-r1 eclasses, therefore I'm
5 > proposing adding the relevant function to eutils.
6 > ---
7 > gx86/eclass/eutils.eclass | 19 +++++++++++++++++++
8 > 1 file changed, 19 insertions(+)
9 >
10 > diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass
11 > index 6588792..bb3c1e3 100644
12 > --- a/gx86/eclass/eutils.eclass
13 > +++ b/gx86/eclass/eutils.eclass
14 > @@ -1495,6 +1495,25 @@ prune_libtool_files() {
15 > fi
16 > }
17 >
18 > +# @FUNCTION: run_in_build_dir
19 > +# @USAGE: <argv>...
20 > +# @DESCRIPTION:
21 > +# Run the given command in the directory pointed by BUILD_DIR.
22 > +run_in_build_dir() {
23 > + debug-print-function ${FUNCNAME} "$@"
24 > + local ret
25
26 local -i ret
27 ?
28
29 > +
30 > + [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified."
31 > + [[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set."
32 > +
33 > + pushd "${BUILD_DIR}" &>/dev/null || die
34 > + "${@}"
35 > + ret=${?}
36 > + popd &>/dev/null || die
37 > +
38 > + return ${ret}
39 > +}
40 > +
41 > check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
42 >
43 > fi
44 > --
45 > 1.8.1
46 >
47 >

Replies