View | Details | Raw Unified | Return to bug 82661
Collapse All | Expand All

(-)bsd.port.mk (-3 / +35 lines)
Lines 138-143 Link Here
138
# CD_MOUNTPTS	- List of CDROM mountpoints to look for distfiles under.
138
# CD_MOUNTPTS	- List of CDROM mountpoints to look for distfiles under.
139
#				  This variable supercedes CD_MOUNTPT, which is
139
#				  This variable supercedes CD_MOUNTPT, which is
140
#				  obsolete.
140
#				  obsolete.
141
# FETCH_ONLY_SITES
142
#				- List of allowed prefixes for sites from which to try to fetch
143
#				distfiles and patchfiles.
144
#				Example: FETCH_ONLY_SITES=http fetch only from http sites.
141
#
145
#
142
# Set these if your port should not be built under certain circumstances.
146
# Set these if your port should not be built under certain circumstances.
143
# These are string variables; you should set them to the reason why
147
# These are string variables; you should set them to the reason why
Lines 3109-3117 Link Here
3109
# Fetch
3113
# Fetch
3110
3114
3111
.if !target(do-fetch)
3115
.if !target(do-fetch)
3116
3117
FUNC_FETCH_FILTER_SITE=\
3118
fetch_filter_site() { \
3119
	site=$${1} ; \
3120
	ret=1 ; \
3121
	if [ -n "${FETCH_ONLY_SITES}" ] ; then \
3122
		ret=0 ; \
3123
		for fetch_only_site in ${FETCH_ONLY_SITES} ; do \
3124
			if [ "$${site}" != "$${site\#$${fetch_only_site}}" ] ; then \
3125
				ret=1 ; \
3126
				break ; \
3127
			fi ; \
3128
		done ; \
3129
	fi ; \
3130
	if [ $${ret} -eq 0 ] ; then \
3131
		${ECHO_MSG} "=> Skipping site $${site} due to FETCH_ONLY_SITES filter." ; \
3132
	fi ; \
3133
	return $$ret ; \
3134
}
3135
3112
do-fetch:
3136
do-fetch:
3113
	@${MKDIR} ${_DISTDIR}
3137
	@${MKDIR} ${_DISTDIR}
3114
	@(cd ${_DISTDIR}; \
3138
	@(${FUNC_FETCH_FILTER_SITE} ; \
3139
	 cd ${_DISTDIR}; \
3115
	 ${_MASTER_SITES_ENV} ; \
3140
	 ${_MASTER_SITES_ENV} ; \
3116
	 for _file in ${DISTFILES}; do \
3141
	 for _file in ${DISTFILES}; do \
3117
		file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
3142
		file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
Lines 3160-3166 Link Here
3160
				SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \
3185
				SORTED_MASTER_SITES_CMD_TMP="${SORTED_MASTER_SITES_DEFAULT_CMD}" ; \
3161
			fi ; \
3186
			fi ; \
3162
			for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
3187
			for site in `eval $$SORTED_MASTER_SITES_CMD_TMP ${_RANDOMIZE_SITES}`; do \
3163
			    ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
3188
				if fetch_filter_site "$${site}" ; then \
3189
					continue ; \
3190
				fi ; \
3191
				${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
3164
				DIR=${DIST_SUBDIR}; \
3192
				DIR=${DIST_SUBDIR}; \
3165
				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
3193
				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
3166
				case $${file} in \
3194
				case $${file} in \
Lines 3178-3184 Link Here
3178
	    fi \
3206
	    fi \
3179
	 done)
3207
	 done)
3180
.if defined(PATCHFILES)
3208
.if defined(PATCHFILES)
3181
	@(cd ${_DISTDIR}; \
3209
	@(${FUNC_FETCH_FILTER_SITE} ; \
3210
	 cd ${_DISTDIR}; \
3182
	 ${_PATCH_SITES_ENV} ; \
3211
	 ${_PATCH_SITES_ENV} ; \
3183
	 for _file in ${PATCHFILES}; do \
3212
	 for _file in ${PATCHFILES}; do \
3184
		file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
3213
		file=`${ECHO_CMD} $$_file | ${SED} -E -e 's/:[^:]+$$//'` ; \
Lines 3213-3218 Link Here
3213
				SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \
3242
				SORTED_PATCH_SITES_CMD_TMP="${SORTED_PATCH_SITES_DEFAULT_CMD}" ; \
3214
			fi ; \
3243
			fi ; \
3215
			for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \
3244
			for site in `eval $$SORTED_PATCH_SITES_CMD_TMP`; do \
3245
				if fetch_filter_site "$${site}" ; then \
3246
					continue ; \
3247
				fi ; \
3216
			    ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
3248
			    ${ECHO_MSG} "=> Attempting to fetch from $${site}."; \
3217
				DIR=${DIST_SUBDIR}; \
3249
				DIR=${DIST_SUBDIR}; \
3218
				pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \
3250
				pattern="$${DIR:+$$DIR/}`${ECHO_CMD} $$file | ${SED} -e 's/\./\\\\./g'`"; \

Return to bug 82661