Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 Jun 1999 13:26:51 +0200 (CEST)
From:      Alexander Langer <alex@cichlids.com>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/12325: bsd.port.mk refetch funktionally added
Message-ID:  <199906211126.NAA70792@cichlids.cichlids.com>

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

>Number:         12325
>Category:       ports
>Synopsis:       Adds refetch functionallity to bsd.port.mk on checksum mismathes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jun 21 04:30:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Langer
>Release:        FreeBSD 4.0-CURRENT i386
>Organization:
>Environment:

the bsd.port.mk.old is
#       $Id: bsd.port.mk,v 1.314 1999/06/11 11:59:10 asami Exp $

>Description:

	If a checksum mismatch appears it makes a make FORCE_FETCH=$$file that forces make fetch to refetch
	this one file. If the checksum is ok, it proceeds, if not, it tries to refetch it again as many times
	as set in FETCH_REGET (default to 1). It stops when FETCH_REGET becomes 0 and stops with an error if
	the checksum mismatch still appears.
	It uses fetch -R as default to not-delete the files on broken transfers, so files can be refetched.

>How-To-Repeat:
>Fix:

I hope this wonīt make problems with the long lines. 

--- bsd.port.mk.old	Mon Jun 21 13:18:36 1999
+++ bsd.port.mk	Mon Jun 21 13:19:45 1999
@@ -319,6 +319,8 @@
 # FETCH_AFTER_ARGS -
 #				  Arguments to ${FETCH_CMD} following filename (default: none).
 # FETCH_ENV		- Environment to pass to ${FETCH_CMD} (default: none).
+# FETCH_REGET	- Attempts to reget a file before giving up (default: 1)
+#				  Set to 0 (null) if you donīt want a reget
 #
 # For extract:
 #
@@ -688,11 +690,13 @@
 .if ${OSVERSION} < 300000
 FETCH_CMD?=		/usr/bin/fetch
 .else
-FETCH_CMD?=		/usr/bin/fetch -A
+FETCH_CMD?=		/usr/bin/fetch -AaR
+FETCH_REGET?= 1
 .endif
 #FETCH_BEFORE_ARGS+=	$${CKSIZE:+-S $$CKSIZE}
 .else
 FETCH_CMD?=		/usr/bin/ftp
+FETCH_REGET?= 0
 .endif
 
 TOUCH?=			/usr/bin/touch
@@ -1420,6 +1424,24 @@
 	@${MKDIR} ${_DISTDIR}
 	@(cd ${_DISTDIR}; \
 	 for file in ${DISTFILES}; do \
+		if [  -f $$file -a "${FORCE_FETCH}" = "$$file" ]; then \
+			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 ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} -r $${site}$${file} ${FETCH_AFTER_ARGS}; then \
+					if cd ${.CURDIR} && ${MAKE} checksum ; then\
+						exit 0; \
+					else \
+					 	${ECHO_MSG} "Refetch didn't help, still checksum mismatch. I'm giving up."; \
+						exit 1; \
+					fi; \
+				fi \
+			done; \
+			${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\
+			${ECHO_MSG} ">> port manually into ${_DISTDIR} and try again."; \
+			exit 1; \
+	    fi ;\
 		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
 			if [ -h $$file -o -h `${BASENAME} $$file` ]; then \
 				${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \
@@ -2035,6 +2057,16 @@
 				OK="false"; \
 			fi; \
 		  done; \
+		  if [ "$$OK" != "true" ] && [ ${FETCH_REGET} -gt 0 ]; then \
+			${ECHO_MSG} "===>  Refetch $$file"; \
+			if ( cd ${.CURDIR} && \
+				${MAKE} ${.MAKEFLAGS} FORCE_FETCH="$$file" FETCH_REGET="`expr ${FETCH_REGET} - 1`" fetch); then \
+				${ECHO_MSG} ">> Successfully refetched $$file"; \
+				OK="true"; \
+			else \
+				exit 1; \
+			fi; \
+		  fi ; \
 		  if [ "$$OK" != "true" ]; then \
 			${ECHO_MSG} "Make sure the Makefile and md5 file (${MD5_FILE})"; \
 			${ECHO_MSG} "are up to date.  If you want to override this check, type"; \

>Release-Note:
>Audit-Trail:
>Unformatted:


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?199906211126.NAA70792>