ports/59392: bsd.port.mk: add filesize field in distinfo
Sergey Matveychuk
sem at ciam.ru
Tue Nov 18 03:30:14 UTC 2003
>Number: 59392
>Category: ports
>Synopsis: bsd.port.mk: add filesize field in distinfo
>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: Mon Nov 17 19:30:11 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: Sergey Matveychuk
>Release: FreeBSD 5.1-CURRENT i386
>Organization:
>Environment:
System: FreeBSD Current.sem-home.ciam.ru 5.1-CURRENT FreeBSD 5.1-CURRENT #1: Sun Oct 19 08:20:34 MSD 2003 root at current-test.sem-home.ciam.ru:/usr/obj/usr/src/sys/CURRENT i386
>Description:
There are two ideas for the change:
1) Users could know what size of files he need download.
It's most useful for modem users (like me) because the difference
is significant - tens kilobytes or tens megabytes.
2) When developers change a file without changing its name
ports system try to reget file and append it. It's useless.
So if file size <= than expected and checksum mismatch
we need to remove the file and fetch it again.
The patch is backward compatible, so we can move gradually.
Comments are welcome.
>How-To-Repeat:
>Fix:
--- bsd.port.mk.1.473 Mon Nov 10 10:13:30 2003
+++ bsd.port.mk Tue Nov 18 06:06:02 2003
@@ -873,6 +873,7 @@
SED?= /usr/bin/sed
SETENV?= /usr/bin/env
SH?= /bin/sh
+STAT?= /usr/bin/stat
STRIP_CMD?= /usr/bin/strip
SU_CMD?= /usr/bin/su root -c
TAIL?= /usr/bin/tail
@@ -3839,7 +3840,8 @@
@if [ -f ${MD5_FILE} ]; then ${CAT} /dev/null > ${MD5_FILE}; fi
@(cd ${DISTDIR}; \
for file in ${_CKSUMFILES}; do \
- ${MD5} $$file >> ${MD5_FILE}; \
+ (${MD5} $$file; ${STAT} -f%z $$file) | \
+ ${SED} '1N;s/\n/ /' >> ${MD5_FILE}; \
done)
@for file in ${_IGNOREFILES}; do \
${ECHO_CMD} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \
@@ -3858,6 +3860,7 @@
for file in ${_CKSUMFILES}; do \
CKSUM=`${MD5} < $$file`; \
CKSUM2=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
+ SIZE=`${GREP} "^MD5 ($$file)" ${MD5_FILE} | ${AWK} '{print $$5}'`; \
if [ "$$CKSUM2" = "" ]; then \
${ECHO_MSG} ">> No checksum recorded for $$file."; \
OK="false"; \
@@ -3869,6 +3872,12 @@
${ECHO_MSG} ">> Checksum OK for $$file."; \
else \
${ECHO_MSG} ">> Checksum mismatch for $$file."; \
+ if [ "x$${SIZE}" != "x" ]; then \
+ if [ $${SIZE} -le `${STAT} -f%z $$file` ]; then \
+ ${ECHO_MSG} " File is old or broken with download. Removed to fetch again."; \
+ ${RM} -f $$file; \
+ fi; \
+ fi; \
refetchlist="$$refetchlist$$file "; \
OK="false"; \
fi; \
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list