From owner-freebsd-ports Mon Jun 21 4:30: 4 1999 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id EB4DA14F0F for ; Mon, 21 Jun 1999 04:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id EAA84560; Mon, 21 Jun 1999 04:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from neutron.cichlids.com (as3-046.rp-plus.de [149.221.238.238]) by hub.freebsd.org (Postfix) with ESMTP id 94A0F14F0F for ; Mon, 21 Jun 1999 04:26:06 -0700 (PDT) (envelope-from alex@cichlids.com) Received: from cichlids.cichlids.com (cichlids.cichlids.com [192.168.0.10]) by neutron.cichlids.com (8.9.3/8.9.1) with ESMTP id NAA30266 for ; Mon, 21 Jun 1999 13:27:24 +0200 (CEST) Received: (from alex@localhost) by cichlids.cichlids.com (8.9.3/8.9.3) id NAA70792; Mon, 21 Jun 1999 13:26:51 +0200 (CEST) (envelope-from alex) Message-Id: <199906211126.NAA70792@cichlids.cichlids.com> Date: Mon, 21 Jun 1999 13:26:51 +0200 (CEST) From: Alexander Langer To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: ports/12325: bsd.port.mk refetch funktionally added Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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