Index: bsd.port.mk =================================================================== RCS file: /home/ncvs/ports/Mk/bsd.port.mk,v retrieving revision 1.515 diff -u -r1.515 bsd.port.mk --- bsd.port.mk 24 Jun 2005 09:18:54 -0000 1.515 +++ bsd.port.mk 26 Jun 2005 09:39:24 -0000 @@ -138,6 +138,10 @@ # CD_MOUNTPTS - List of CDROM mountpoints to look for distfiles under. # This variable supercedes CD_MOUNTPT, which is # obsolete. +# FETCH_ONLY_SITES +# - List of allowed prefixes for sites from which to try to fetch +# distfiles and patchfiles. +# Example: FETCH_ONLY_SITES=http fetch only from http sites. # # Set these if your port should not be built under certain circumstances. # These are string variables; you should set them to the reason why @@ -3109,9 +3113,30 @@ # Fetch .if !target(do-fetch) + +FUNC_FETCH_FILTER_SITE=\ +fetch_filter_site() { \ + site=$${1} ; \ + ret=1 ; \ + if [ -n "${FETCH_ONLY_SITES}" ] ; then \ + ret=0 ; \ + for fetch_only_site in ${FETCH_ONLY_SITES} ; do \ + if [ "$${site}" != "$${site\#$${fetch_only_site}}" ] ; then \ + ret=1 ; \ + break ; \ + fi ; \ + done ; \ + fi ; \ + if [ $${ret} -eq 0 ] ; then \ + ${ECHO_MSG} "=> Skipping site $${site} due to FETCH_ONLY_SITES filter." ; \ + fi ; \ + return $$ret ; \ +} + do-fetch: @${MKDIR} ${_DISTDIR} - @(cd ${_DISTDIR}; \ + @(${FUNC_FETCH_FILTER_SITE} ; \ + cd ${_DISTDIR}; \ ${_MASTER_SITES_ENV} ; \ for _file in ${DISTFILES}; do \ file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ @@ -3160,7 +3185,10 @@ 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}."; \ + if fetch_filter_site "$${site}" ; then \ + continue ; \ + fi ; \ + ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \ DIR=${DIST_SUBDIR}; \ CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \ case $${file} in \ @@ -3178,7 +3206,8 @@ fi \ done) .if defined(PATCHFILES) - @(cd ${_DISTDIR}; \ + @(${FUNC_FETCH_FILTER_SITE} ; \ + cd ${_DISTDIR}; \ ${_PATCH_SITES_ENV} ; \ for _file in ${PATCHFILES}; do \ file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \ @@ -3213,6 +3242,9 @@ SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \ fi ; \ for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \ + if fetch_filter_site "$${site}" ; then \ + continue ; \ + fi ; \ ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \ DIR=${DIST_SUBDIR}; \ pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \