From owner-freebsd-ports@FreeBSD.ORG Sat Apr 5 10:18:23 2003 Return-Path: Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5C3EE37B401; Sat, 5 Apr 2003 10:18:23 -0800 (PST) Received: from mail.soaustin.net (mail.soaustin.net [207.200.4.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D97043F75; Sat, 5 Apr 2003 10:18:22 -0800 (PST) (envelope-from linimon@lonesome.com) Received: from lonesome.lonesome.com (cs242746-11.austin.rr.com [24.27.46.11]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mail.soaustin.net (Postfix) with ESMTP id 72B65140FE; Sat, 5 Apr 2003 12:18:21 -0600 (CST) From: Mark Linimon Organization: Lonesome Dove Computing Services To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-ports@FreeBSD.org Date: Sat, 5 Apr 2003 12:21:54 -0600 User-Agent: KMail/1.5 References: <200212080140.gB81e1kh088670@freefall.freebsd.org> In-Reply-To: <200212080140.gB81e1kh088670@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200304051221.54727.linimon@lonesome.com> Subject: Re: ports/12325: Adds refetch functionallity to bsd.port.mk on checksum mismathes X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Apr 2003 18:18:23 -0000 OK, I have a patch which **may** be what you want here. Disclaimer: I've merely done the mechanical work, not any logical (debugging) work. I simply don't understand the framework enough to even begin. FYI the version of bsd.port.mk which the original patch was done against was probably r1.313. At least that's what I used as a guideline based on the date. --- bsd.port.mk.dist Sat Apr 5 11:58:59 2003 +++ bsd.port.mk Sat Apr 5 12:15:00 2003 @@ -553,6 +553,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: # @@ -1443,11 +1445,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 @@ -2505,6 +2509,24 @@ for _file in ${DISTFILES}; do \ file=`echo $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ select=`echo $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ + 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 [ -L $$file -o -L `${BASENAME} $$file` ]; then \ ${ECHO_MSG} ">> ${_DISTDIR}/$$file is a broken symlink."; \ @@ -3393,6 +3415,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 distinfo file (${MD5_FILE})"; \ ${ECHO_MSG} "are up to date. If you are absolutely sure you want to override this"; \