Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Aug 1997 09:38:51 +0900
From:      itojun@itojun.org
To:        Bill Fenner <fenner@parc.xerox.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: Versioning bsd.port.mk
Message-ID:  <1280.872210331@itojun.csl.sony.co.jp>
In-Reply-To: Bill Fenner <fenner@parc.xerox.com>'s message of Thu, 21 Aug 1997 13:43:22 PDT. <97Aug21.134334pdt.177512@crevenia.parc.xerox.com>
References:  <97Aug21.134334pdt.177512@crevenia.parc.xerox.com>

next in thread | previous in thread | raw e-mail | index | archive | help
>Adding the following to bsd.port.mk will give you a variable which is
>the check-in date of the existing bsd.port.mk (this doesn't help people
>who have their own CVS trees into which they check FreeBSD sources).
>BSD_PORT_MK_DATE=    $$Date: $$
>BSD_PORT_MK_DATE:=   ${BSD_PORT_MK_DATE:M[0-9]*/[0-9]*}
>BSD_PORT_MK_DATE:=   ${BSD_PORT_MK_DATE:S/\///g}
>Then bsd.port.mk could have something like
>.if defined(NEED_MK_VERSION) && (${NEED_MK_VERSION} > ${BSD_PORT_MK_DATE})
>	${ECHO_MSG} "===> WARNING: you probably need a newer bsd.port.mk to build this port"
>.endif
>in bsd.port.mk, and port Makefiles could contain NEED_MK_VERSION= .


	how about this?  (using perl is not essential; I'm happy with the
	above Makefile-only approach)

itojun


=======
--- bsd.port.mk	Tue Aug 19 21:32:50 1997
+++ /tmp/bsd.port.mk	Wed Aug 20 14:03:02 1997
@@ -390,6 +389,7 @@
 MD5?=			md5
 .endif
 MD5_FILE?=		${FILESDIR}/md5
+STAMP_FILE?=		${FILESDIR}/stamp
 
 MAKE_FLAGS?=	-f
 MAKEFILE?=		Makefile
@@ -814,6 +814,12 @@
 	@${DO_NADA}
 .endif
 
+.if defined(NO_CHECKSTAMP) && !target(checkstamp)
+checkstamp: fetch
+	@${DO_NADA}
+.endif
+
+
 # Disable extract
 .if defined(NO_EXTRACT) && !target(extract)
 extract: checksum
@@ -1174,7 +1180,7 @@
 ################################################################
 
 .if !target(fetch)
-fetch:
+fetch: checkstamp
 	@cd ${.CURDIR} && ${MAKE} ${.MAKEFLAGS} real-fetch
 .endif
 
@@ -1357,6 +1363,14 @@
 	done
 .endif
 
+.if !target(makestamp)
+makestamp:
+	@${MKDIR} ${FILESDIR}
+	@if [ -f ${STAMP_FILE} ]; then ${RM} -f ${STAMP_FILE}; fi
+	@grep 'Id: bsd.port.mk,v' /usr/share/mk/bsd.port.mk | head -1 | \
+		perl -pe 's/.*(\d\d\d\d)\/(\d\d)\/(\d\d) (\d\d):(\d\d):(\d\d).*/$$1$$2$$3$$4/' > ${STAMP_FILE}
+.endif
+
 .if !target(checksum)
 checksum: fetch
 	@if [ ! -f ${MD5_FILE} ]; then \
@@ -1399,6 +1413,23 @@
 		  fi) ; \
 	fi
 .endif
+
+.if !target(checkstamp)
+checkstamp:
+	@if [ ! -f ${STAMP_FILE} ]; then \
+		${ECHO_MSG} ">> No bsd.port.mk timestamp file."; \
+	else ( \
+		CURSTAMP=`grep 'Id: bsd.port.mk,v' /usr/share/mk/bsd.port.mk | head -1 | perl -pe 's/.*(\d\d\d\d)\/(\d\d)\/(\d\d) (\d\d):(\d\d):(\d\d).*/$$1$$2$$3$$4/'`; \
+		EXPECTEDSTAMP=`cat ${STAMP_FILE}`; \
+		if [ "$$CURSTAMP" -lt "$$EXPECTEDSTAMP" ]; then \
+			${ECHO_MSG} "bsd.port.mk looks older than expected."; \
+			${ECHO_MSG} "If you wish to force make the port, type"; \
+			${ECHO_MSG} "\"make NO_CHECKSTAMP=yes [other args]\"."; \
+			exit 1; \
+		fi ); \
+	fi
+.endif
+
 
 ################################################################
 # The special package-building targets



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