1 |
Matthew Kenendy wrote: [Sat Nov 13 2004, 06:44:49AM EST] |
2 |
> Up until this thread, the solution was simple: |
3 |
> |
4 |
> doins *.fasl *.dat |
5 |
|
6 |
Simple but sloppy and error-prone. What if the *.fasl files are |
7 |
missing? You won't know about it until the somebody reports a bug. |
8 |
Ideally we want to be catching errors before the users, and it would |
9 |
be easier if the ebuilds didn't allow this kind of sloppiness. |
10 |
|
11 |
> So what will that need to be if doins calls die because a file '*.dat' |
12 |
> can't be found? |
13 |
|
14 |
Good question. Neither of the following works, but we want something |
15 |
short: |
16 |
|
17 |
[[ -e *.dat ]] # *.dat doesn't expand (semantics of [[ ]]) |
18 |
[ -e *.dat ] # *.dat expands and causes an error |
19 |
|
20 |
How about this? |
21 |
|
22 |
doins *.fasl |
23 |
exists *.dat && doins *.dat |
24 |
|
25 |
In ebuild.sh: |
26 |
|
27 |
exists() { |
28 |
[[ -e $1 ]] |
29 |
} |
30 |
|
31 |
This works because the glob is expanded before calling exists(), which |
32 |
then only needs to test the first argument to make a determination. |
33 |
If the argument is a file expanded from the glob, goodness. If the |
34 |
file is the glob itself, it won't be found. |
35 |
|
36 |
> Perhaps doins should take a --strict argument, whose absence will be |
37 |
> compatible with what I do now and whose presence will be appreciated by |
38 |
> those developers forgetting to install init.d run scripts etc. |
39 |
|
40 |
Same as telling devs to append ||die as we've been saying all along. |
41 |
Isn't it better to optimize for the common case by dying when files |
42 |
are missing? |
43 |
|
44 |
Regards, |
45 |
Aron |
46 |
|
47 |
-- |
48 |
Aron Griffis |
49 |
Gentoo Linux Developer |