From owner-freebsd-ports Tue Aug 22 3:19:38 2000 Delivered-To: freebsd-ports@freebsd.org Received: from tisch.mail.mindspring.net (tisch.mail.mindspring.net [207.69.200.157]) by hub.freebsd.org (Postfix) with ESMTP id BA1FA37B43C for ; Tue, 22 Aug 2000 03:19:31 -0700 (PDT) Received: from silvia.hip.berkeley.edu (sji-ca1-02.ix.netcom.com [209.109.232.2]) by tisch.mail.mindspring.net (8.9.3/8.8.5) with ESMTP id GAA08810; Tue, 22 Aug 2000 06:19:27 -0400 (EDT) Received: (from asami@localhost) by silvia.hip.berkeley.edu (8.9.3/8.6.9) id DAA39276; Tue, 22 Aug 2000 03:19:23 -0700 (PDT) To: rse@engelschall.com Cc: ports@freebsd.org Subject: Re: ports/20678: make SORTED_MASTER_SITES_CMD variable overridable References: <200008171131.e7HBVYk56997@en1.engelschall.com> From: asami@freebsd.org (Satoshi - Ports Wraith - Asami) Date: 22 Aug 2000 03:19:22 -0700 In-Reply-To: "Ralf S. Engelschall"'s message of "Thu, 17 Aug 2000 13:31:34 +0200 (CEST)" Message-ID: Lines: 99 X-Mailer: Gnus v5.7/Emacs 20.7 Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org * From: "Ralf S. Engelschall" * 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