Skip site navigation (1)Skip section navigation (2)
Date:      22 Aug 2000 03:19:22 -0700
From:      asami@freebsd.org (Satoshi - Ports Wraith - Asami)
To:        rse@engelschall.com
Cc:        ports@freebsd.org
Subject:   Re: ports/20678: make SORTED_MASTER_SITES_CMD variable overridable
Message-ID:  <vqcn1i538et.fsf@silvia.hip.berkeley.edu>
In-Reply-To: "Ralf S. Engelschall"'s message of "Thu, 17 Aug 2000 13:31:34 %2B0200 (CEST)"
References:  <200008171131.e7HBVYk56997@en1.engelschall.com>

next in thread | previous in thread | raw e-mail | index | archive | help
 * From: "Ralf S. Engelschall" <rse@en1.engelschall.com>

 * With our recently introduced sorting of the master sites, it is no longer
 * possible to extend/override the master sites on a *per-distfile basis*.
 * Previously MASTER_SITE_OVERRIDE could be used for this purpose by using things
 * like this in /etc/make.conf:
 * 
 * MASTER_SITE_OVERRIDE=`/path/to/script $$$${file}`
 * 
 * I used this since years to run /path/to/script with the currently to be
 * fetched distfile. If this script determined (how it does this is outside of
 * this scope) that the distfile already exists somewhere locally, the ports
 * system first tried it to fetch from there. Keep in mind that a script has to
 * be used here, because the files are stored not in a single directory (for me
 * they are stored in a very large software archive with thousands of subdirs).
 * So something like MASTER_SITE_OVERRIDE=/path/to/local/stuff is not sufficient.

Hmm.  Actually, the current implementation of SORTED_MASTER_SITES is
broken in that it completely ignores the meaning of
MASTER_SITE_OVERRIDE, putting it into the list to be sorted.

Will something like the below work?  I wasn't sure how to do a double
command substitution ($() inside $()'s) so there are new targets,
master-sites and patch-sites, which print out the desired list of
master and patch sites.  I also made the patch sites sortable.

Satoshi
-------
Index: bsd.port.mk
===================================================================
RCS file: /usr/cvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.346
diff -u -r1.346 bsd.port.mk
--- bsd.port.mk	2000/08/15 22:39:00	1.346
+++ bsd.port.mk	2000/08/17 20:16:53
@@ -1090,24 +1106,19 @@
 
 # If the user has MASTER_SITE_FREEBSD set, go to the FreeBSD repository
 # for everything, but don't search it twice by appending it to the end.
-.if !defined(MASTER_SITE_FREEBSD)
-MASTER_SITES+=	${MASTER_SITE_BACKUP}
-PATCH_SITES+=	${MASTER_SITE_BACKUP}
-.if defined(MASTER_SITE_OVERRIDE)
-MASTER_SITES:=	${MASTER_SITE_OVERRIDE} ${MASTER_SITES}
-PATCH_SITES:=	${MASTER_SITE_OVERRIDE} ${PATCH_SITES}
-.endif
+.if defined(MASTER_SITE_FREEBSD)
+_MASTER_SITE_OVERRIDE:=	${MASTER_SITE_BACKUP}
+_MASTER_SITE_BACKUP:=	# empty
 .else
-MASTER_SITES:=	${MASTER_SITE_BACKUP} ${MASTER_SITES}
-PATCH_SITES:=	${MASTER_SITE_BACKUP} ${PATCH_SITES}
+_MASTER_SITE_OVERRIDE=	${MASTER_SITE_OVERRIDE}
+_MASTER_SITE_BACKUP=	${MASTER_SITE_BACKUP}
 .endif
 
 # Search CDROM first if mounted, symlink instead of copy if
 # FETCH_SYMLINK_DISTFILES is set
 CD_MOUNTPT?=	/cdrom
 .if exists(${CD_MOUNTPT}/ports/distfiles)
-MASTER_SITES:=	file:${CD_MOUNTPT}/ports/distfiles/${DIST_SUBDIR}/ ${MASTER_SITES}
-PATCH_SITES:=	file:${CD_MOUNTPT}/ports/distfiles/${DIST_SUBDIR}/ ${PATCH_SITES}
+_MASTER_SITE_OVERRIDE:=	file:${CD_MOUNTPT}/ports/distfiles/${DIST_SUBDIR}/ ${_MASTER_SITE_OVERRIDE}
 .if defined(FETCH_SYMLINK_DISTFILES)
 FETCH_BEFORE_ARGS+=	-l
 .endif
@@ -1125,7 +1136,13 @@
 MASTER_SORT_AWK+= /${srt:S^/^\\/^g}/ { good["${srt}"] = good["${srt}"] " " $$0 ; next; } 
 .endfor
 MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; }
-SORTED_MASTER_SITES_CMD= echo '${MASTER_SITES}' | ${AWK} '${MASTER_SORT_AWK}'
+SORTED_MASTER_SITES_CMD=	cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} master-sites
+SORTED_PATCH_SITES_CMD=		cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} patch-sites
+
+master-sites:
+	@echo ${_MASTER_SITE_OVERRIDE} `echo '${MASTER_SITES}' | ${AWK} '${MASTER_SORT_AWK}'` ${_MASTER_SITE_BACKUP}
+patch-sites:
+	@echo ${_MASTER_SITE_OVERRIDE} `echo '${PATCH_SITES}' | ${AWK} '${MASTER_SORT_AWK}'` ${_MASTER_SITE_BACKUP}
 
 DISTFILES?=		${DISTNAME}${EXTRACT_SUFX}
 ALLFILES?=	${DISTFILES} ${PATCHFILES}
@@ -1621,7 +1638,7 @@
 				exit 1; \
 			fi ; \
 			${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
-			for site in ${PATCH_SITES}; do \
+			for site in `${SORTED_PATCH_SITES_CMD}`; do \
 			    ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
@@ -2213,7 +2230,7 @@
 	@(cd ${_DISTDIR}; \
 	 for file in ${PATCHFILES}; do \
 		if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
-			for site in ${PATCH_SITES}; do \
+			for site in ${SORTED_PATCH_SITES_CMD}; do \
 				DIR=${DIST_SUBDIR}; \
 				CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
 				case $${file} in \


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?vqcn1i538et.fsf>