On Sun, Jan 13, 2013 at 5:29 AM, Michał Górny <mgo...@gentoo.org> wrote: > The run_in_build_dir() command simply runs given command > in the directory stated as BUILD_DIR. This variable is used commonly > by autotools-utils, cmake-utils and python-r1 eclasses, therefore I'm > proposing adding the relevant function to eutils. > --- > gx86/eclass/eutils.eclass | 19 +++++++++++++++++++ > 1 file changed, 19 insertions(+) > > diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass > index 6588792..bb3c1e3 100644 > --- a/gx86/eclass/eutils.eclass > +++ b/gx86/eclass/eutils.eclass > @@ -1495,6 +1495,25 @@ prune_libtool_files() { > fi > } > > +# @FUNCTION: run_in_build_dir > +# @USAGE: <argv>... > +# @DESCRIPTION: > +# Run the given command in the directory pointed by BUILD_DIR. > +run_in_build_dir() { > + debug-print-function ${FUNCNAME} "$@" > + local ret
local -i ret ? > + > + [[ ${#} -ne 0 ]] || die "${FUNCNAME}: no command specified." > + [[ ${BUILD_DIR} ]] || die "${FUNCNAME}: BUILD_DIR not set." > + > + pushd "${BUILD_DIR}" &>/dev/null || die > + "${@}" > + ret=${?} > + popd &>/dev/null || die > + > + return ${ret} > +} > + > check_license() { die "you no longer need this as portage supports > ACCEPT_LICENSE itself"; } > > fi > -- > 1.8.1 > >