Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Sep 1998 09:27:37 -0700 (PDT)
From:      asami@cs.berkeley.edu (Satoshi Asami)
To:        ports@FreeBSD.ORG
Cc:        se@FreeBSD.ORG
Subject:   fetch + size
Message-ID:  <199809221627.JAA08248@silvia.hip.berkeley.edu>

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

I got the following (slightly changed) from Stefan Esser (se).  It
adds support for file size checking (-S) option to fetch.

I'm torn whether it should go in before the release, for two reasons:

(1) The -S flag of "fetch" just went into -current, if it doesn't work
    as well as it's supposed to this might cause a great instability
    in ports

(2) The patch adds a SIZE line to files/md5.  That is quite
    displeasing aesthetically (there's a reason why the file was
    called "md5" in the first place...)

What do people think?  I'm leaning towards leaving this out for 3.0R,
for reasons stated above.  (We'll be dealing with a whole bunch of
diffs to files/md5 if this goes in, so it's going to be a royal pain
to change it later....)

Satoshi
-------
Index: bsd.port.mk
===================================================================
RCS file: /home/ncvs/src/share/mk/bsd.port.mk,v
retrieving revision 1.227.2.54
diff -u -r1.227.2.54 bsd.port.mk
--- bsd.port.mk	1998/09/17 01:22:32	1.227.2.54
+++ bsd.port.mk	1998/09/21 10:23:46
@@ -573,4 +573,5 @@
 .if exists(/usr/bin/fetch)
 FETCH_CMD?=		/usr/bin/fetch
+FETCH_BEFORE_ARGS+=	$${CKSIZE:+-S $$CKSIZE}
 .else
 FETCH_CMD?=		/usr/bin/ftp
@@ -1152,6 +1158,8 @@
 			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
 			for site in ${MASTER_SITES}; do \
 			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
+				DIR=${DIST_SUBDIR}; \
+				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
 					continue 2; \
 				fi \
@@ -1174,6 +1182,8 @@
 			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
 			for site in ${PATCH_SITES}; do \
 			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
+				DIR=${DIST_SUBDIR}; \
+				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} ${FETCH_AFTER_ARGS}; then \
 					continue 2; \
 				fi \
@@ -1614,6 +1624,8 @@
 	 for file in ${DISTFILES}; do \
 		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
 			for site in ${MASTER_SITES}; do \
+				DIR=${DIST_SUBDIR}; \
+				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
 					break; \
 			done; \
@@ -1625,6 +1637,8 @@
 	 for file in ${PATCHFILES}; do \
 		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
 			for site in ${PATCH_SITES}; do \
+				DIR=${DIST_SUBDIR}; \
+				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				${ECHO} -n ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${file} "${FETCH_AFTER_ARGS}" '||' ; \
 					break; \
 			done; \
@@ -1643,6 +1657,7 @@
 	@(cd ${DISTDIR}; \
 	 for file in ${_CKSUMFILES}; do \
 		${MD5} $$file >> ${MD5_FILE}; \
+		echo "SIZE ($$file) = "`wc -c < $$file` >> ${MD5_FILE}; \
 	 done)
 	@for file in ${_IGNOREFILES}; do \
 		${ECHO} "MD5 ($$file) = IGNORE" >> ${MD5_FILE}; \

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?199809221627.JAA08248>