Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Dec 1999 16:30:55 +0100 (CET)
From:      Christian Weisgerber <naddy@unix-ag.uni-kl.de>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/15495: Add "addsum" target to bsd.port.mk
Message-ID:  <199912151530.QAA44121@fettuccini.unix-ag.uni-kl.de>

next in thread | raw e-mail | index | archive | help

>Number:         15495
>Category:       ports
>Synopsis:       Add "addsum" target to bsd.port.mk
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 15 07:40:00 PST 1999
>Closed-Date:
>Last-Modified:
>Originator:     Christian Weisgerber
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
Unix-AG, Uni Kaiserslautern
>Environment:

>Description:

The appended patch adds an "addsum" target to bsd.port.mk. As the
name implies, "addsum" puts additional checksums into files/md5
rather than overwriting it completely as "makesum" does. This is
very handy in the (admittedly rather rare) case where your
DISTFILES/PATCHFILES change depending on options such as NO_X11.

From Marc Espie <espie@openbsd.org>'s work on OpenBSD.

>How-To-Repeat:

>Fix:

--- bsd.port.mk.old	Wed Dec 15 16:04:52 1999
+++ bsd.port.mk	Wed Dec 15 16:04:58 1999
@@ -292,6 +292,8 @@
 #				  the same file.
 # checksum		- Use files/md5 to ensure that your distfiles are valid.
 # makesum		- Generate files/md5 (only do this for your own ports!).
+# addsum		- update files/md5 in a non-destructive way
+#				(your own ports only!)
 #
 # Default sequence for "all" is:  fetch checksum extract patch configure build
 #
@@ -878,8 +880,11 @@
 SED?=		/usr/bin/sed
 SETENV?=	/usr/bin/env
 SH?=		/bin/sh
+SORT?=		/usr/bin/sort
 TR?=		/usr/bin/tr
 TRUE?=		/usr/bin/true
+UNIQ?=		/usr/bin/uniq
+WC?=		/usr/bin/wc
 WHICH?=		/usr/bin/which
 
 # Used to print all the '===>' style prompts - override this to turn them off.
@@ -2118,6 +2123,24 @@
 # this line goes after the ${MD5} above
 #		echo "SIZE ($$file) = "`wc -c < $$file` >> ${MD5_FILE}; \
 
+.if !target(addsum)
+addsum: fetch
+	@${MKDIR} ${FILESDIR} && ${TOUCH} ${MD5_FILE}
+	@(cd ${DISTDIR}; \
+	 for file in ${_CKSUMFILES}; do \
+		${MD5} $$file >> ${MD5_FILE}; \
+	 done)
+	@for file in ${_IGNOREFILES}; do \
+		${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
+	done
+	@${SORT} -u -o ${MD5_FILE} ${MD5_FILE}
+	@if [ `${SED} -e 's/\=.*$$//' ${MD5_FILE} | ${UNIQ} -d | ${WC} -l` -ne 0 ]; then \
+		${ECHO} "Inconsistent checksum in ${MD5_FILE}"; \
+		exit 1; \
+	else \
+		${ECHO} "${MD5_FILE} updated okay, don't forget to remove cruft"; \
+	fi
+.endif
 
 .if !target(checksum)
 checksum:

>Release-Note:
>Audit-Trail:
>Unformatted:


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?199912151530.QAA44121>