From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([69.77.167.62] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1LPMDb-0004FM-3S for garchives@archives.gentoo.org; Tue, 20 Jan 2009 19:25:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 37B07E0724; Tue, 20 Jan 2009 19:24:56 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id F1C5EE0724 for ; Tue, 20 Jan 2009 19:24:55 +0000 (UTC) Received: from [192.168.1.213] (unknown [74.92.132.138]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 6B318646C8 for ; Tue, 20 Jan 2009 19:24:54 +0000 (UTC) Subject: Re: [gentoo-dev] Usage of cp -i to prevent overwriting upstream files From: Ferris McCormick To: gentoo-dev@lists.gentoo.org In-Reply-To: <4976205A.5030600@gentoo.org> References: <4976205A.5030600@gentoo.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-Jhc9IRZ+gtoxa9KZX3XL" Organization: gentoo developer Date: Tue, 20 Jan 2009 19:24:52 +0000 Message-Id: <1232479492.31989.140.camel@liasis.inforead.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-Archives-Salt: 3aec9e41-20c7-4f64-a34d-15d773a2a979 X-Archives-Hash: 85002325fcced89c766b2e2712f496b6 --=-Jhc9IRZ+gtoxa9KZX3XL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, 2009-01-20 at 21:04 +0200, Petteri R=C3=A4ty wrote: > 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: >=20 > function cp-no-replace() { > debug-print-function ${FUNCNAME} $* >=20 > [[ ${#} !=3D 2 ]] && die "${FUNCNAME} takes two arguments" > [[ -e ${2} ]] && die "die target exists" >=20 > cp "${1}" "${2}" || die "cp failed" > } >=20 > So do you think: > a) cp -i is fine Fine with me > b) this function should be added to eutils I don't like this one ---=20 [[ ${#} !=3D 2 ]] && die "${FUNCNAME} takes two arguments" [[ -e ${2} ]] && die "die target exists" How does the user recover from that? I would become irate if a build died without giving some useful indication the problem. > c) keep it restricted to java eclasses > d) something else >=20 > Regards, > Petteri Regards, Ferris --=20 Ferris McCormick (P44646, MI) Developer, Gentoo Linux (Sparc, Userrel, Trustees) --=-Jhc9IRZ+gtoxa9KZX3XL Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAkl2JQQACgkQQa6M3+I///e/tACgyf5Qq025d2OAsQQYnzleCZ2t 56cAoJx/qkCC30YdxuZJHcamn3F6lm8l =D2gM -----END PGP SIGNATURE----- --=-Jhc9IRZ+gtoxa9KZX3XL--