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
signature.asc
Description: OpenPGP digital signature
