Subject: Re: [RFC] making PKGBASE and PKGVERSION read-only
To: None <tech-pkg@netbsd.org>
From: Roland Illig <roland.illig@gmx.de>
List: tech-pkg
Date: 10/15/2005 09:28:48
This is a multi-part message in MIME format.
--------------010807020304090605040906
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Roland Illig wrote:
> Index: bsd.pkg.mk
> ===================================================================
> RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
> retrieving revision 1.1730
> diff -u -p -r1.1730 bsd.pkg.mk
> --- bsd.pkg.mk	10 Oct 2005 17:37:17 -0000	1.1730
> +++ bsd.pkg.mk	15 Oct 2005 07:06:05 -0000

Oops. This was the patch I made before I tested the change. This is the 
corrected version. Only the trailing .endif is removed.

Roland

--------------010807020304090605040906
Content-Type: text/plain;
 name="bsd.pkg.mk.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bsd.pkg.mk.patch"

Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1730
diff -u -p -r1.1730 bsd.pkg.mk
--- bsd.pkg.mk	10 Oct 2005 17:37:17 -0000	1.1730
+++ bsd.pkg.mk	15 Oct 2005 07:27:00 -0000
@@ -78,21 +78,25 @@ ACCEPTABLE_LICENSES=	${ACCEPTABLE_LICENC
 
 ##### PKGBASE, PKGNAME[_NOREV], PKGVERSION
 
-PKGBASE?=		${PKGNAME:C/-[^-]*$//}
-PKGVERSION?=		${PKGNAME:C/^.*-//}
+.if defined(PKGBASE)
+PKG_FAIL_REASON+=	"[bsd.pkg.mk] error: PKGBASE is a read-only variable."
+.endif
+.if defined(PKGVERSION)
+PKG_FAIL_REASON+=	"[bsd.pkg.mk] error: PKGVERSION is a read-only variable."
+.endif
+
 .if defined(PKGREVISION) && !empty(PKGREVISION) && (${PKGREVISION} != "0")
-.  if defined(PKGNAME)
-PKGNAME_NOREV:=		${PKGNAME}
-PKGNAME:=		${PKGNAME}nb${PKGREVISION}
-.  else
-PKGNAME?=		${DISTNAME}nb${PKGREVISION}
-PKGNAME_NOREV=		${DISTNAME}
-.  endif
+_PKGREVISIONPART=	nb${PKGREVISION}
 .else
-PKGNAME?=		${DISTNAME}
-PKGNAME_NOREV=		${PKGNAME}
+_PKGREVISIONPART=	# empty
 .endif
 
+PKGNAME?=		${DISTNAME}
+PKGNAME_NOREV:=		${PKGNAME}
+PKGNAME:=		${PKGNAME}${_PKGREVISIONPART}
+PKGBASE=		${PKGNAME:C/-[^-]*$//}
+PKGVERSION=		${PKGNAME:C/^.*-//}
+
 ##### PLIST
 
 .if ${PKG_INSTALLATION_TYPE} == "pkgviews"

--------------010807020304090605040906--