ports/62761: patch for phasing out distinfo files
Trevor Johnson
trevor at FreeBSD.org
Fri Feb 13 00:00:25 UTC 2004
>Number: 62761
>Category: ports
>Synopsis: patch for phasing out distinfo files
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Feb 12 16:00:24 PST 2004
>Closed-Date:
>Last-Modified:
>Originator: Trevor Johnson
>Release: N/A
>Organization:
>Environment:
bsd.port.mk 1.484
>Description:
This is a patch to record MD5 and SIZE in a port's Makefile with
"make makesum" and use that information for "make checksum" in a
way that remains compatible with ports that still have a distinfo
or other MD5_FILE. The purpose is to reduce the number of files
needed by the ports tree, to improve the extraction time of ports.tgz
and lessen the consumption of inodes.
>How-To-Repeat:
N/A
>Fix:
also available via
<URL:http://people.freebsd.org/~trevor/ports/distinfo-in-makefile.diff>
N.B. in the sixth chunk I removed an "if" but didn't change the
indentation.
Index: /usr/ports/Mk/bsd.port.mk
===================================================================
RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.484
diff -u -r1.484 bsd.port.mk
--- /usr/ports/Mk/bsd.port.mk 4 Feb 2004 04:27:04 -0000 1.484
+++ /usr/ports/Mk/bsd.port.mk 12 Feb 2004 23:41:16 -0000
@@ -3119,7 +3119,7 @@
exit 1; \
fi ; \
if [ -f ${MD5_FILE} -a "x${NO_CHECKSUM}" = "x" ]; then \
- if ! ${GREP} -q "^MD5 ($$pattern)" ${MD5_FILE}; then \
+ if ! ${GREP} -q "^MD5 ($$pattern)" ${MD5_FILE} ${MASTERDIR}/Makefile ; then \
${ECHO_MSG} ">> $${DIR:+$$DIR/}$$file is not in ${MD5_FILE}."; \
${ECHO_MSG} ">> Either ${MD5_FILE} is out of date, or"; \
${ECHO_MSG} ">> $${DIR:+$$DIR/}$$file is spelled incorrectly."; \
@@ -3147,7 +3147,7 @@
for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} ${MASTERDIR}/Makefile | ${SED} "s:^# ::g" | ${AWK} '{print $$4}'`; \
case $${file} in \
*/*) ${MKDIR} $${file%/*}; \
args="-o $${file} $${site}$${file}";; \
@@ -3201,7 +3201,7 @@
${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
DIR=${DIST_SUBDIR}; \
pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
- CKSIZE=`${GREP} "^SIZE ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`${GREP} -w "SIZE ($$pattern)" ${MD5_FILE} ${MASTERDIR}/Makefile | ${AWK} '{print $$4}'`; \
case $${file} in \
*/*) ${MKDIR} $${file%/*}; \
args="-o $${file} $${site}$${file}";; \
@@ -4139,7 +4139,7 @@
fi ; \
for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} ${MASTERDIR}/Makefile | ${AWK} '{print $$4}'`; \
case $${file} in \
*/*) args="-o $${file} $${site}$${file}";; \
*) args=$${site}$${file};; \
@@ -4171,7 +4171,7 @@
fi ; \
for site in `eval $$SORTED_PATCH_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
DIR=${DIST_SUBDIR}; \
- CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} ${MASTERDIR}/Makefile | ${AWK} '{print $$4}'`; \
case $${file} in \
*/*) args="-o $${file} $${site}$${file}";; \
*) args=$${site}$${file};; \
@@ -4202,38 +4202,51 @@
.if !target(makesum)
makesum:
@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} fetch NO_CHECKSUM=yes
- @if [ -f ${MD5_FILE} ]; then ${CAT} /dev/null > ${MD5_FILE}; fi
+ @${GREP} -v "^# SIZE (" ${MASTERDIR}/Makefile | ${GREP} -v "^# MD5 (" > \
+ ${MASTERDIR}/Makefile.makesum
@(cd ${DISTDIR}; \
for file in ${_CKSUMFILES}; do \
- ${MD5} $$file >> ${MD5_FILE}; \
+ ${ECHO_CMD} "recording MD5 for" $$file; \
+ ${MD5} $$file | ${SED} -e "s:^:\# :" >> \
+ ${MASTERDIR}/Makefile.makesum; \
if [ -z "${NO_SIZE}" ]; then \
- ${ECHO_CMD} "SIZE ($$file) = "`${LS} -ALln $$file | ${AWK} '{print $$5}'` >> ${MD5_FILE}; \
+ ${ECHO_CMD} "recording size for" $$file; \
+ ${ECHO_CMD} "SIZE ($$file) = "`${LS} -ALln $$file | \
+ ${AWK} '{print $$5}'` | ${SED} -e "s:^:\# :" >> \
+ ${MASTERDIR}/Makefile.makesum; \
fi; \
done)
@for file in ${_IGNOREFILES}; do \
- ${ECHO_CMD} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
+ ${ECHO_CMD} "MD5 ($$file) = IGNORE" | ${SED} -e "s:^:\# :" >> \
+ ${MASTERDIR}/Makefile.makesum; \
done
+ @${MV} ${MASTERDIR}/Makefile.makesum ${MASTERDIR}/Makefile
.endif
-
.if !target(checksum)
checksum: fetch
- @if [ -f ${MD5_FILE} ]; then \
- (cd ${DISTDIR}; OK=""; \
+ @(cd ${DISTDIR}; OK=""; \
for file in ${_CKSUMFILES}; do \
pattern="`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
CKSUM=`${MD5} < $$file`; \
- CKSUM2=`${GREP} "^MD5 ($$pattern)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
- if [ -z "$$CKSUM2" ]; then \
+ CKSUM2=`${GREP} "MD5 ($$pattern)" ${MASTERDIR}/Makefile | \
+ ${SED} "s/^# //g" | ${AWK} '{print $$4}'`; \
+ CKSUM3=`${GREP} -s "MD5 ($$pattern)" ${MD5_FILE} | \
+ ${AWK} '{print $$4}'`; \
+ if [ -z "$$CKSUM2" -a -z "$$CKSUM3" ]; then \
${ECHO_MSG} ">> No checksum recorded for $$file."; \
OK="false"; \
elif [ "$$CKSUM2" = "IGNORE" ]; then \
- ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE in distinfo file even though"; \
+ ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE even though"; \
+ ${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \
+ OK="false"; \
+ elif [ "$$CKSUM3" = "IGNORE" ]; then \
+ ${ECHO_MSG} ">> Checksum for $$file is set to IGNORE even though"; \
${ECHO_MSG} " the file is not in the "'$$'"{IGNOREFILES} list."; \
OK="false"; \
else \
ckmatch=${FALSE}; \
- for cksum2 in $$CKSUM2; do \
+ for cksum2 in $$CKSUM2 $$CKSUM3; do \
if [ "$$cksum2" = "$$CKSUM" ]; then \
ckmatch=${TRUE}; \
break; \
@@ -4250,7 +4263,7 @@
done; \
for file in ${_IGNOREFILES}; do \
pattern="`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
- CKSUM2=`${GREP} "($$pattern)" ${MD5_FILE} | ${AWK} '{if(NR<2)print $$4}'`; \
+ CKSUM2=`${GREP} "($$pattern)" ${MD5_FILE} ${MASTERDIR}/Makefile | ${AWK} '{if(NR<2)print $$4}'`; \
if [ "$$CKSUM2" = "" ]; then \
${ECHO_MSG} ">> No checksum recorded for $$file, file is in "'$$'"{IGNOREFILES} list."; \
OK="false"; \
@@ -4281,7 +4294,7 @@
exit 1; \
fi); \
elif [ -n "${_CKSUMFILES:M*}" ]; then \
- ${ECHO_MSG} ">> No checksum file (${MD5_FILE})."; \
+ ${ECHO_MSG} ; \
fi
.endif
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list