Subject: Re: Use of ${PKGNAME} can lead to confusion
To: Roland Illig <rillig@NetBSD.org>
From: Quentin Garnier <cube@cubidou.net>
List: tech-pkg
Date: 10/09/2005 13:12:37
--rHeCoQbvuHTnkkIZ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, Oct 09, 2005 at 12:46:30PM +0200, Roland Illig wrote:
> Hi,
>=20
> many package authors (at least 39) assume that if they write the=20
> following, the distfiles are downloaded into ${DISTDIR}/package-1.0. But=
=20
> they are wrong.
>=20
> PKGNAME=3D          package-1.0

You really mean PKGNAME here, not DISTNAME?

> PKGREVISION=3D      4
> DIST_SUBDIR=3D      ${PKGNAME}
>=20
> What really happens is that bsd.pkg.mk modifies PKGNAME and appends the=
=20
> PKGREVISION to it. That is, whenever the PKGREVISION is bumped, the=20
> distfiles are downloaded again. Certainly there are other places where=20
> the modification of PKGNAME leads to confusion.
>=20
> Therefore I suggest that a new variable PKGNAME_REV be introduced and=20
> the use of ${PKGNAME} be deprecated. Then we have PKGNAME, PKGNAME_NOREV=
=20
> and PKGNAME_REV.
>=20
> The use of ${PKGNAME} then means the developer does not know that=20
> PKGNAME is modified. This is already true for almost all current uses.=20
> Developers that know about this pitfall should then use either=20
> ${PKGNAME_REV} or ${PKGNAME_NOREV}.

You should be aware that most (if not all) occurrences of
"DIST_SUBDIR=3D${PKGNAME}" are likely to be there on purpose, because at
least once the distfile was changed when its name didn't.

So be very cautious when changing that so you don't make old distfiles
suddenly get in the way, again.

--=20
Quentin Garnier - cube@cubidou.net - cube@NetBSD.org
"When I find the controls, I'll go where I like, I'll know where I want
to be, but maybe for now I'll stay right here on a silent sea."
KT Tunstall, Silent Sea, Eye to the Telescope, 2004.

--rHeCoQbvuHTnkkIZ
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (NetBSD)

iQEVAwUBQ0j7JdgoQloHrPnoAQLKaQf9EwujJ0N1U9mpcs0arlEg40Vk+9B2fEJO
yXkoEofmjPfaPz/4RNH5yWVM2oLMz/d6EYq1E2qjQr3I4PX6m9DXmgDl8vXoeJ1E
xX2IadUVeUbe8hYU321whMZtl3yLXzcOZFsVAgXF3Vf5BIcRZ+adkT/o6fvZIMjd
+6w2d/YCB3p+3//9SgAl5K22d8hiGJ34vQSdzI1oNM5mImcgafuGI7UoJOWzuMgT
Tv8B7wjjhgDCPvDgIYfegA5TronwayR5erLL1kajSEp22v/SCJ5o5aYQHQhd1fXI
Z6ZpUccb4VKgKJCtjw0ea1TRSBMEqISNkiFV0KGulo5p7/806AflDw==
=VPe1
-----END PGP SIGNATURE-----

--rHeCoQbvuHTnkkIZ--