Gentoo Archives: gentoo-dev

From: Ferris McCormick <fmccor@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Usage of cp -i to prevent overwriting upstream files
Date: Tue, 20 Jan 2009 19:25:00
Message-Id: 1232479492.31989.140.camel@liasis.inforead.com
In Reply to: [gentoo-dev] Usage of cp -i to prevent overwriting upstream files by "Petteri Räty"
1 On Tue, 2009-01-20 at 21:04 +0200, Petteri Räty wrote:
2 > Many times upstream Java projects don't include build.xml files or
3 > proper build systems so we include build.xml files in $FILESDIR. In case
4 > upstream some day adds one we usually use cp -i to detect if upstream
5 > adds this file in new versions. If devs do their job properly, this will
6 > never show to users. On #gentoo-dev at least grobian and darkside did
7 > not like this and proposed using test and die instead. If we think that
8 > cp -i is not acceptable, this should be made a function to avoid code
9 > duplication in my opinion. Here's a suggestion:
10 >
11 > function cp-no-replace() {
12 > debug-print-function ${FUNCNAME} $*
13 >
14 > [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
15 > [[ -e ${2} ]] && die "die target exists"
16 >
17 > cp "${1}" "${2}" || die "cp failed"
18 > }
19 >
20 > So do you think:
21 > a) cp -i is fine
22
23 Fine with me
24
25 > b) this function should be added to eutils
26
27 I don't like this one ---
28 [[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
29 [[ -e ${2} ]] && die "die target exists"
30
31 How does the user recover from that? I would become irate if a build
32 died without giving some useful indication the problem.
33
34 > c) keep it restricted to java eclasses
35 > d) something else
36 >
37 > Regards,
38 > Petteri
39 Regards,
40 Ferris
41 --
42 Ferris McCormick (P44646, MI) <fmccor@g.o>
43 Developer, Gentoo Linux (Sparc, Userrel, Trustees)

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] Usage of cp -i to prevent overwriting upstream files "Petteri Räty" <betelgeuse@g.o>