1 |
Le dimanche 13 janvier 2013 à 09:52 -0600, William Hubbs a écrit : |
2 |
> On Sun, Jan 13, 2013 at 04:08:18PM +0100, Michał Górny wrote: |
3 |
> > On Sun, 13 Jan 2013 09:05:31 -0600 |
4 |
> > William Hubbs <williamh@g.o> wrote: |
5 |
> > |
6 |
> > > On Sun, Jan 13, 2013 at 02:29:43PM +0100, Michał Górny wrote: |
7 |
> > > > The run_in_build_dir() command simply runs given command |
8 |
> > > > in the directory stated as BUILD_DIR. This variable is used commonly |
9 |
> > > > by autotools-utils, cmake-utils and python-r1 eclasses, therefore I'm |
10 |
> > > > proposing adding the relevant function to eutils. |
11 |
> > > > --- |
12 |
> > > > gx86/eclass/eutils.eclass | 19 +++++++++++++++++++ |
13 |
> > > > 1 file changed, 19 insertions(+) |
14 |
> > > > |
15 |
> > > > diff --git a/gx86/eclass/eutils.eclass b/gx86/eclass/eutils.eclass |
16 |
> > > > index 6588792..bb3c1e3 100644 |
17 |
> > > > --- a/gx86/eclass/eutils.eclass |
18 |
> > > > +++ b/gx86/eclass/eutils.eclass |
19 |
> > > > @@ -1495,6 +1495,25 @@ prune_libtool_files() { |
20 |
> > > > fi |
21 |
> > > > } |
22 |
> > > > |
23 |
> > > > +# @FUNCTION: run_in_build_dir |
24 |
> > > > +# @USAGE: <argv>... |
25 |
> > > > +# @DESCRIPTION: |
26 |
> > > > +# Run the given command in the directory pointed by BUILD_DIR. |
27 |
> > > |
28 |
> > > I think I would make this more generic if it is going in eutiles, |
29 |
> > > e.g. rename it something like run_in_dir and pass in the directory as the |
30 |
> > > first argument. |
31 |
> > |
32 |
> > That's not going to work for us since the command is subject to a loop |
33 |
> > which sets BUILD_DIR, e.g.: |
34 |
> > |
35 |
> > python_foreach_impl run_in_build_dir ... |
36 |
> |
37 |
> Can you not change the logic so it doesn't die if build_dir isn't set, |
38 |
> but uses the value of $1 and calls shift? |
39 |
|
40 |
I guess an explicit option would be less error prone, eg. : |
41 |
|
42 |
run_in_dir -d foodir barfunc arg1 arg2 |
43 |
or |
44 |
run_in_dir --directory foodir barfunc arg1 arg2 |
45 |
|
46 |
documentation could then mention that the function defaults to BUILD_DIR |
47 |
if this option is not set and fails if nothing is set. |
48 |
|
49 |
-- |
50 |
Gilles Dartiguelongue <eva@g.o> |
51 |
Gentoo |