1 |
On Tue, 2009-01-20 at 21:37 +0200, Petteri Räty wrote: |
2 |
> Ferris McCormick wrote: |
3 |
> > On Tue, 2009-01-20 at 21:04 +0200, Petteri Räty wrote: |
4 |
> >> Many times upstream Java projects don't include build.xml files or |
5 |
> >> proper build systems so we include build.xml files in $FILESDIR. In case |
6 |
> >> upstream some day adds one we usually use cp -i to detect if upstream |
7 |
> >> adds this file in new versions. If devs do their job properly, this will |
8 |
> >> never show to users. On #gentoo-dev at least grobian and darkside did |
9 |
> >> not like this and proposed using test and die instead. If we think that |
10 |
> >> cp -i is not acceptable, this should be made a function to avoid code |
11 |
> >> duplication in my opinion. Here's a suggestion: |
12 |
> >> |
13 |
> >> function cp-no-replace() { |
14 |
> >> debug-print-function ${FUNCNAME} $* |
15 |
> >> |
16 |
> >> [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments" |
17 |
> >> [[ -e ${2} ]] && die "die target exists" |
18 |
> >> |
19 |
> >> cp "${1}" "${2}" || die "cp failed" |
20 |
> >> } |
21 |
> >> |
22 |
> >> So do you think: |
23 |
> >> a) cp -i is fine |
24 |
> > |
25 |
> > Fine with me |
26 |
> > |
27 |
> >> b) this function should be added to eutils |
28 |
> > |
29 |
> > I don't like this one --- |
30 |
> > [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments" |
31 |
> > [[ -e ${2} ]] && die "die target exists" |
32 |
> > |
33 |
> > How does the user recover from that? I would become irate if a build |
34 |
> > died without giving some useful indication the problem. |
35 |
> > |
36 |
> |
37 |
> You did not understand the issue if you are fine with a) but then make |
38 |
> this statement. a) would surely be even more confusing to the user. |
39 |
> |
40 |
> Regards, |
41 |
> Petteri |
42 |
|
43 |
I think I understand the issue. My point is that |
44 |
die "die target exists" |
45 |
gives no clue whatsoever as to what to do or where the problem is and |
46 |
strikes me as something that should never appear in a proper build. If |
47 |
that's the preferred solution, at least indicate that the ebuild has not |
48 |
caught up with upstream and that the user is not at fault. |
49 |
|
50 |
'cp -i' will at least ask a question, and I find that marginally better |
51 |
--- it's confusing, but at least it says something. But it seems to me |
52 |
that if we hit this case, no one (including the package owner) knows |
53 |
which .xml file to use, so stopping the build makes sense, but do it |
54 |
with some message that explains exactly what is going on. |
55 |
|
56 |
I do not intend to respond further to this thread. |
57 |
|
58 |
Regards, |
59 |
Ferris |
60 |
-- |
61 |
Ferris McCormick (P44646, MI) <fmccor@g.o> |
62 |
Developer, Gentoo Linux (Sparc, Userrel, Trustees) |