[Midnightbsd-cvs] mports [19246] trunk/Mk/bsd.mport.mk: rework how we get the hashes

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat May 30 11:01:42 EDT 2015


Revision: 19246
          http://svnweb.midnightbsd.org/mports/?rev=19246
Author:   laffer1
Date:     2015-05-30 11:01:42 -0400 (Sat, 30 May 2015)
Log Message:
-----------
rework how we get the hashes

Modified Paths:
--------------
    trunk/Mk/bsd.mport.mk

Modified: trunk/Mk/bsd.mport.mk
===================================================================
--- trunk/Mk/bsd.mport.mk	2015-05-30 14:59:10 UTC (rev 19245)
+++ trunk/Mk/bsd.mport.mk	2015-05-30 15:01:42 UTC (rev 19246)
@@ -1983,6 +1983,11 @@
 	fi
 .endif
 
+# set alg to any of SIZE, SHA256 (or any other checksum algorithm):
+DISTINFO_DATA?= if [ \( -n "${DISABLE_SIZE}" -a -n "${NO_CHECKSUM}" \) -o ! -f "${DISTINFO_FILE}" ]; then exit; fi; \
+	DIR=${DIST_SUBDIR}; ${AWK} -v alg=$$alg -v file=$${DIR:+$$DIR/}$${file} \
+		'$$1 == alg && $$2 == "(" file ")" {print $$4}' ${DISTINFO_FILE}
+
 # Fetch
 
 .if !target(do-fetch)
@@ -3034,9 +3039,8 @@
 	if [ -f ${DISTINFO_FILE} ]; then \
 		cd ${DISTDIR}; OK=""; \
 		for file in ${_CKSUMFILES}; do \
-			pattern="`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
-			\
 			ignored="true"; \
+			_file=$${file#${DIST_SUBDIR}/*};	\
 			for alg in ${CHECKSUM_ALGORITHMS:tu}; do \
 				ignore="false"; \
 				eval alg_executable=\$$$$alg; \
@@ -3043,7 +3047,7 @@
 				\
 				if [ $$alg_executable != "NO" ]; then \
 					MKSUM=`$$alg_executable < $$file`; \
-					CKSUM=`${GREP} "^$$alg ($$pattern)" ${DISTINFO_FILE} | ${AWK} '{print $$4}'`; \
+					CKSUM=`file=$$_file; ${DISTINFO_DATA}`; \
 				else \
 					ignore="true"; \
 				fi; \



More information about the Midnightbsd-cvs mailing list