Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Mar 1999 05:48:50 -0800 (PST)
From:      asami@FreeBSD.ORG (Satoshi Asami)
To:        sjr@home.net
Cc:        jim@corp.au.triax.com, jorbeton@pilot.net, freebsd-ports@FreeBSD.ORG
Subject:   Re: CVSup and Fetch
Message-ID:  <199903261348.FAA18790@silvia.hip.berkeley.edu>
In-Reply-To: <199903261302.IAA19553@istari.home.net> (sjr@home.net)
References:   <199903261302.IAA19553@istari.home.net>

next in thread | previous in thread | raw e-mail | index | archive | help
 * From: "Stephen J. Roznowski" <sjr@home.net>

 * Would it be possible to inbed something in the bsd.port.mk file about
 * this? [So when it fails, it says to make sure you have a current upgrade
 * kit or some such]

I've been thinking about it for quite awhile. :)

How about something like this?  A file (/var/db/pkg/VERSION) records
the "version" of the system.  The "version" is a number derived by
concatenating the year/month/date -- so it's "19990326" today.  If the
"version" is too old, bsd.port.mk refuses to do anything.

bsd.port.mk has a variable that contains the required version.  When I
know there is an incompatible update, I'll change the BSDPORTMKVERSION
line.

There are a couple ways to update the version file.  An upgrade kit
will of course fix it.  Also, a "make world" will change it from
within src/share/mk/Makefile.  This will be the date of the install,
not the date of the source, so it's actually possible that people can
still trip over by doing a new install on an old source tree...but the
alternative will be to encode something inside the source tree, which
I do not want to start doing again.

Sample patch follows.  You can see the change to 31upgrade/Makefile
too.  31upgrade/pkg/INSTALL just does a 

  echo %%VERSION%% > /var/db/pkg/VERSION

Satoshi

P.S. Credit goes to billf for some of the ideas.
===
Index: src/share/mk/Makefile
===================================================================
RCS file: /usr/cvs/src/share/mk/Makefile,v
retrieving revision 1.21
diff -u -r1.21 Makefile
--- Makefile	1998/11/11 05:21:26	1.21
+++ Makefile	1999/03/26 13:15:43
@@ -13,4 +13,7 @@
 	${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${SHAREMODE} ${FILES} \
 	    ${DESTDIR}${BINDIR}/mk
 
+afterinstall:
+	date '+%Y%m%d' > /var/db/pkg/VERSION
+
 .include <bsd.prog.mk>
Index: ports/Mk/bsd.port.mk
===================================================================
RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.307
diff -u -r1.307 bsd.port.mk
--- bsd.port.mk	1999/03/09 11:27:34	1.307
+++ bsd.port.mk	1999/03/26 13:29:35
@@ -1134,6 +1128,8 @@
 # Don't build a port on an ELF machine if it's broken for ELF.
 #
 # Don't build a port if it's broken.
+#
+# Don't build a port if the system is too old.
 ################################################################
 
 OLDSYSTCL!=	${ECHO} /usr/include/tcl.h /usr/lib/libtcl??.so.*.*
@@ -1153,6 +1149,18 @@
 .endfor
 .endif
 
+# You need an upgrade kit or make world newer than this
+BSDPORTMKVERSION=	19990326
+VERSIONFILE=	${PKG_DBDIR}/VERSION
+.if exists(${VERSIONFILE})
+SYSTEMVERSION!=	cat ${VERSIONFILE}
+.else
+SYSTEMVERSION=	0
+.endif
+.if ${BSDPORTMKVERSION} > ${SYSTEMVERSION}
+IGNORE=	": Your system is too old.  You need a fresh make world or an upgrade kit.  Please go to http://www.freebsd.org/ports/ or a mirror site and follow the instructions"
+.endif
+
 .if defined(ONLY_FOR_ARCHS)
 .for __ARCH in ${ONLY_FOR_ARCHS}
 .if ${MACHINE_ARCH:M${__ARCH}} != ""
Index: ports/misc/31upgrade/Makefile
===================================================================
RCS file: /usr/cvs/ports/misc/31upgrade/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- Makefile	1999/03/10 22:10:51	1.3
+++ Makefile	1999/03/26 13:35:49
@@ -22,6 +22,10 @@
 NO_MTREE=	yes
 PREFIX=		/
 NO_BUILD=	yes
-NO_INSTALL=	yes
+PKGINSTALL=	${WRKDIR}/INSTALL
+
+do-install:
+	${SED} -e "s/%%VERSION%%/${BSDPORTMKVERSION}/" ${PKGDIR}/INSTALL \
+		> ${PKGINSTALL}
 
 .include <bsd.port.post.mk>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199903261348.FAA18790>