public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Usage of cp -i to prevent overwriting upstream files
@ 2009-01-20 19:04 Petteri Räty
  2009-01-20 19:24 ` Ferris McCormick
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Petteri Räty @ 2009-01-20 19:04 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

Many times upstream Java projects don't include build.xml files or
proper build systems so we include build.xml files in $FILESDIR. In case
upstream some day adds one we usually use cp -i to detect if upstream
adds this file in new versions. If devs do their job properly, this will
never show to users. On #gentoo-dev at least grobian and darkside did
not like this and proposed using test and die instead. If we think that
cp -i is not acceptable, this should be made a function to avoid code
duplication in my opinion. Here's a suggestion:

function cp-no-replace() {
	debug-print-function ${FUNCNAME} $*

	[[ ${#} != 2 ]] && die "${FUNCNAME} takes two arguments"
	[[ -e ${2} ]] && die "die target exists"

	cp "${1}" "${2}" || die "cp failed"
}

So do you think:
a) cp -i is fine
b) this function should be added to eutils
c) keep it restricted to java eclasses
d) something else

Regards,
Petteri


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-01-31  8:14 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-20 19:04 [gentoo-dev] Usage of cp -i to prevent overwriting upstream files Petteri Räty
2009-01-20 19:24 ` Ferris McCormick
2009-01-20 19:37   ` Petteri Räty
2009-01-20 20:18     ` Ferris McCormick
2009-01-20 22:50       ` Jan Kundrát
2009-01-20 23:40         ` Ferris McCormick
2009-01-20 23:57           ` Jeremy Olexa
2009-01-21 17:00 ` Peter Volkov
2009-01-21 19:22 ` Santiago M. Mola
2009-01-31  8:13   ` Luca Barbato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox