Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Dec 1996 04:53:18 -0800 (PST)
From:      asami@freebsd.org (Satoshi Asami)
To:        msmith@atrad.adelaide.edu.au
Cc:        ports@freebsd.org
Subject:   Re: Ports tidy-up sweep
Message-ID:  <199612151253.EAA29674@baloon.mimi.com>
In-Reply-To: <199612120723.RAA03527@genesis.atrad.adelaide.edu.au> (message from Michael Smith on Thu, 12 Dec 1996 17:53:01 %2B1030 (CST))

next in thread | previous in thread | raw e-mail | index | archive | help
 * From: Michael Smith <msmith@atrad.adelaide.edu.au>

 * It is clear that for some ports, the files/md5 file can't be used.  Could
 * I perhaps campaign for a files/md5.ignore file listing the names of files
 * which belong to the port but whose checksum should not be checked?

Ye ask, ye shall receive. :)

What this patch does is:

(1) Slightly change meaning of ALLFILES, it is now just a union of
    DISTFILES and PATCHFILES, without DIST_SUBDIR in front (the one
    with DIST_SUBDIR is now called _ALLFILES, and is intended for
    bsd.port.mk internal use only).

(2) Add a new variable IGNOREFILES, which is the subset of ALLFILES
    that you don't want to checksum.  The checksum field of these
    files will be set to the string "IGNORE" by the makesum target.
    The checksum target will try to ensure all checksums and all
    IGNORE-dness.  If a file not in IGNOREFILES has the checksum
    "IGNORE" or a file in IGNOREFILES has a regular checksum, it will
    warn you (or should I make this an error?).

Now a file not having an entry in files/md5 is not possible, so I
should probably make that an error to, eh?

Comments please!

Satoshi
===
Index: bsd.port.mk
===================================================================
RCS file: /usr/cvs/src/share/mk/bsd.port.mk,v
retrieving revision 1.238
diff -u -r1.238 bsd.port.mk
--- bsd.port.mk	1996/12/12 04:32:25	1.238
+++ bsd.port.mk	1996/12/15 12:40:03
@@ -71,8 +71,9 @@
 #				  and ${PATCHFILES} will be put in this subdirectory of
 #				  ${DISTDIR}.  Also they will be fetched in this subdirectory 
 #				  from FreeBSD mirror sites.
-# ALLFILES		- All of ${DISTFILES} and ${PATCHFILES}.  If ${DIST_SUBDIR}
-#                 is defined, it will be appended in front of all filenames.
+# ALLFILES		- All of ${DISTFILES} and ${PATCHFILES}.
+# IGNOREFILES	- If some of the ${ALLFILES} are not checksum-able, set
+#				  this variable to their names.
 # PKGNAME		- Name of the package file to create if the DISTNAME 
 #				  isn't really relevant for the port/package
 #				  (default: ${DISTNAME}).
@@ -501,12 +502,32 @@
 DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
 PKGNAME?=		${DISTNAME}
 
+ALLFILES?=	${DISTFILES} ${PATCHFILES}
+
+.if defined(IGNOREFILES)
+CKSUMFILES!=	\
+	for file in ${ALLFILES}; do \
+		ignore=0; \
+		for tmp in ${IGNOREFILES}; do \
+			if [ "$$file" = "$$tmp" ]; then \
+				ignore=1; \
+			fi; \
+		done; \
+		if [ "$$ignore" = 0 ]; then \
+			echo "$$file"; \
+		fi; \
+	done
+.else
+CKSUMFILES=		${ALLFILES}
+.endif
+
 # List of all files, with ${DIST_SUBDIR} in front.  Used for checksum.
 .if defined(DIST_SUBDIR)
-ALLFILES?=		${DISTFILES:S/^/${DIST_SUBDIR}\//} \
-				${PATCHFILES:S/^/${DIST_SUBDIR}\//}
+_CKSUMFILES?=	${CKSUMFILES:S/^/${DIST_SUBDIR}\//}
+_IGNOREFILES?=	${IGNOREFILES:S/^/${DIST_SUBDIR}\//}
 .else
-ALLFILES?=		${DISTFILES} ${PATCHFILES}
+_CKSUMFILES?=	${CKSUMFILES}
+_IGNOREFILES?=	${IGNOREFILES}
 .endif
 
 # This is what is actually going to be extracted, and is overridable
@@ -1196,9 +1217,12 @@
 	@${MKDIR} ${FILESDIR}
 	@if [ -f ${MD5_FILE} ]; then ${RM} -f ${MD5_FILE}; fi
 	@(cd ${DISTDIR}; \
-	 for file in ${ALLFILES}; do \
+	 for file in ${_CKSUMFILES}; do \
 		${MD5} $$file >> ${MD5_FILE}; \
 	 done)
+	@for file in ${_IGNOREFILES}; do \
+		${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
+	done
 .endif
 
 .if !target(checksum)
@@ -1206,22 +1230,38 @@
 	@if [ ! -f ${MD5_FILE} ]; then \
 		${ECHO_MSG} ">> No MD5 checksum file."; \
 	else \
-		(cd ${DISTDIR}; OK=""; \
-		  for file in ${ALLFILES}; do \
+		(cd ${DISTDIR}; OK="true"; \
+		  for file in ${_CKSUMFILES}; do \
 			CKSUM=`${MD5} < $$file`; \
 			CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 			if [ "$$CKSUM2" = "" ]; then \
-				${ECHO_MSG} ">> No checksum recorded for $$file"; \
+				${ECHO_MSG} ">> No checksum recorded for $$file."; \
+				OK="false"; \
+			elif [ "$$CKSUM2" = "IGNORE" ]; then \
+				${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in md5 file even though"; \
+				${ECHO_MSG} "   the file is not in the "'$$'"{IGNOREFILES} list."; \
 				OK="false"; \
 			elif [ "$$CKSUM" != "$$CKSUM2" ]; then \
-				${ECHO_MSG} ">> Checksum mismatch for $$file"; \
+				${ECHO_MSG} ">> Checksum mismatch for $$file."; \
 				exit 1; \
 			fi; \
 		  done; \
-		  if [ "$$OK" = "" ]; then \
+		  for file in ${_IGNOREFILES}; do \
+			CKSUM2=`${GREP} "($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+			if [ "$$CKSUM2" = "" ]; then \
+				${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
+				OK="false"; \
+			elif [ "$$CKSUM2" != "IGNORE" ]; then \
+				${ECHO_MSG} ">> Checksum for $$file is not set to IGNORE in md5 file even though"; \
+				${ECHO_MSG} "   the file is in the "'$$'"{IGNOREFILES} list."; \
+				OK="false"; \
+			fi; \
+		  done; \
+		  if [ "$$OK" = "true" ]; then \
 			${ECHO_MSG} "Checksums OK."; \
 		  else \
-			${ECHO_MSG} "Checksums OK for files that have them."; \
+			${ECHO_MSG} "There may be some inconsistencies, make sure the Makefile and md5 file"; \
+			${ECHO_MSG} "(\"${MD5_FILE}\") are up to date."; \
 		  fi) ; \
 	fi
 .endif



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