Date: Mon, 24 Jul 2006 13:21:10 GMT From: Gabor Kovesdan <gabor@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 102277 for review Message-ID: <200607241321.k6ODLAHn086724@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=102277 Change 102277 by gabor@gabor_spitfire on 2006/07/24 13:20:57 Add Tools/scripts/do-fetch.sh. This script will handle the whole fetching process. Currently only the distfile fetcher part of the do-fetch target is moved, I'll move other parts step-by-step. In bsd.port.mk FETCH_SCRIPT is introduced to point to Tools/scripts/do-fetch.sh. I also added FETCH_SCRIPT_ENV to pass some variables to the script. The passed environment will be reduced later when other parts have been moved. Affected files ... .. //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#56 edit .. //depot/projects/soc2006/gabor_ports/Tools/scripts/do-fetch.sh#1 add Differences ... ==== //depot/projects/soc2006/gabor_ports/Mk/bsd.port.mk#56 (text+ko) ==== @@ -2114,6 +2114,20 @@ PTHREAD_LIBS?= -pthread .endif +FETCH_SCRIPT=${PORTSDIR}/Tools/scripts/do-fetch.sh +FETCH_SCRIPT_ENV= AWK="${AWK}" BASENAME="${BASENAME}" ECHO_CMD="${ECHO_CMD}" ECHO_MSG="${ECHO_MSG}" \ + GREP="${GREP}" MKDIR="${MKDIR}" SED="${SED}" SETENV="${SETENV}" \ + FETCH_CMD="${FETCH_CMD}" \ + FETCH_BEFORE_ARGS="${FETCH_BEFORE_ARGS}" FETCH_AFTER_ARGS="${FETCH_AFTER_ARGS}" \ + _DISTDIR="${_DISTDIR}" DIST_SUBDIR="${DIST_SUBDIR}" DISTFILES="${DISTFILES}" \ + FORCE_FETCH="${FORCE_FETCH}" NO_CHECKSUM="${NO_CHECKSUM}" MD5_FILE="${MD5_FILE}" \ + _MASTER_SITES="${_MASTER_SITES}" \ + _MASTER_SITE_OVERRIDE="${MASTER_SITE_OVERRIDE}" \ + _MASTER_SITE_BACKUP="${_MASTER_SITE_BACKUP}" MASTER_SORT_AWK="${MASTER_SORT_AWK}" \ + SORTED_MASTER_SITES_DEFAULT_CMD="${SORTED_MASTER_SITES_DEFAULT_CMD}" \ + _RANDOMIZE_SITES="${_RANDOMIZE_SITES}" + + .if exists(/usr/bin/fetch) FETCH_CMD?= /usr/bin/fetch -ARr FETCH_REGET?= 1 @@ -3301,73 +3315,8 @@ .if !target(do-fetch) do-fetch: - @${MKDIR} ${_DISTDIR} - @(cd ${_DISTDIR}; \ - ${_MASTER_SITES_ENV} ; \ - for _file in ${DISTFILES}; do \ - file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ - select=`${ECHO_CMD} $${_file#$${file}} | ${SED} -e 's/^://' -e 's/,/ /g'` ; \ - force_fetch=false; \ - filebasename=`${BASENAME} $$file`; \ - for afile in ${FORCE_FETCH}; do \ - afile=`${BASENAME} $$afile`; \ - if [ "x$$afile" = "x$$filebasename" ]; then \ - force_fetch=true; \ - fi; \ - done; \ - if [ ! -f $$file -a ! -f $$filebasename -o "$$force_fetch" = "true" ]; then \ - DIR=${DIST_SUBDIR}; \ - pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \ - if [ -L $$file -o -L $$filebasename ]; then \ - ${ECHO_MSG} "=> ${_DISTDIR}/$$file is a broken symlink."; \ - ${ECHO_MSG} "=> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ - ${ECHO_MSG} "=> Please correct this problem and try again."; \ - exit 1; \ - fi ; \ - if [ -f ${MD5_FILE} -a "x${NO_CHECKSUM}" = "x" ]; then \ - if ! ${GREP} -q "^MD5 ($$pattern)" ${MD5_FILE}; then \ - ${ECHO_MSG} "=> $${DIR:+$$DIR/}$$file is not in ${MD5_FILE}."; \ - ${ECHO_MSG} "=> Either ${MD5_FILE} is out of date, or"; \ - ${ECHO_MSG} "=> $${DIR:+$$DIR/}$$file is spelled incorrectly."; \ - exit 1; \ - fi; \ - fi; \ - ${ECHO_MSG} "=> $$file doesn't seem to exist in ${_DISTDIR}."; \ - if [ ! -w ${DISTDIR} ]; then \ - ${ECHO_MSG} "=> ${DISTDIR} is not writable by you; cannot fetch."; \ - exit 1; \ - fi; \ - if [ ! -z "$$select" ] ; then \ - __MASTER_SITES_TMP= ; \ - for group in $$select; do \ - if [ ! -z \$${_MASTER_SITES_$${group}} ] ; then \ - eval ___MASTER_SITES_TMP="\$${_MASTER_SITES_$${group}}" ; \ - __MASTER_SITES_TMP="$${__MASTER_SITES_TMP} $${___MASTER_SITES_TMP}" ; \ - fi \ - done; \ - ___MASTER_SITES_TMP= ; \ - SORTED_MASTER_SITES_CMD_TMP="${ECHO_CMD} ${_MASTER_SITE_OVERRIDE} `${ECHO_CMD} $${__MASTER_SITES_TMP} | ${AWK} '${MASTER_SORT_AWK:S|\\|\\\\|g}'` ${_MASTER_SITE_BACKUP}" ; \ - else \ - SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \ - fi ; \ - for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \ - ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \ - DIR=${DIST_SUBDIR}; \ - CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ - case $${file} in \ - */*) ${MKDIR} $${file%/*}; \ - args="-o $${file} $${site}$${file}";; \ - *) args=$${site}$${file};; \ - esac; \ - if ${SETENV} ${FETCH_ENV} ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${args} ${FETCH_AFTER_ARGS}; then \ - continue 2; \ - 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 \ - done) + ${SETENV} ${FETCH_SCRIPT_ENV} ${SH} -x ${FETCH_SCRIPT} + .if defined(PATCHFILES) @(cd ${_DISTDIR}; \ ${_PATCH_SITES_ENV} ; \
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200607241321.k6ODLAHn086724>