aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatoshi Asami <asami@FreeBSD.org>2000-07-19 16:41:22 +0000
committerSatoshi Asami <asami@FreeBSD.org>2000-07-19 16:41:22 +0000
commitca3a88aa57f9e01921ba5d3753cba65189115848 (patch)
treeaa085d4e6282b77640688ef3787112e1fafdc112
parent60200dd42a29e21dd2aee735038f406db5c2c77c (diff)
downloadports-ca3a88aa57f9e01921ba5d3753cba65189115848.tar.gz
ports-ca3a88aa57f9e01921ba5d3753cba65189115848.zip
(1) Add MASTER_SORT functionality. For instance, by setting
MASTER_SORT="foo.bar.co.jp bar.co.jp .jp" bsd.port.mk will try the machine foo.bar.co.jp, then any machine in the domain bar.co.jp, then any machine in the domain .jp. It might be useful for people in an island (network-topologically speaking). Submitted by: knu Obtained from: NetBSD (2) Deal with mtree's changing flags by looking at ${OSVERSION} Submitted by: ache (3) Don't generate code to try to erase an empty info/dir file if NO_MTREE is set -- although it will probably never happen that /usr/share/info/dir will be empty, it's still wasted code.
Notes
Notes: svn path=/head/; revision=30896
-rw-r--r--Mk/bsd.port.mk24
1 files changed, 22 insertions, 2 deletions
diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk
index 95fae7b43625..72eb7d01d5e2 100644
--- a/Mk/bsd.port.mk
+++ b/Mk/bsd.port.mk
@@ -911,7 +911,11 @@ MTREE_FILE= /etc/mtree/BSD.local.dist
.endif
.endif
MTREE_CMD?= /usr/sbin/mtree
+.if ${OSVERSION} >= 500010
+MTREE_ARGS?= -U -f ${MTREE_FILE} -d -e -p -L
+.else
MTREE_ARGS?= -U -f ${MTREE_FILE} -d -e -p
+.endif
# A few aliases for *-install targets
INSTALL_PROGRAM= \
@@ -1070,6 +1074,20 @@ FETCH_BEFORE_ARGS+= -l
.endif
.endif
+#
+# Sort the master site list according to the patterns in MASTER_SORT
+#
+MASTER_SORT?=
+MASTER_SORT_REGEX?=
+MASTER_SORT_REGEX+= ${MASTER_SORT:S|.|\\.|g:S|^|//[^/]*|:S|$|/|}
+
+MASTER_SORT_AWK= BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl = "${MASTER_SORT_REGEX}"; }
+.for srt in ${MASTER_SORT_REGEX}
+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}'
+
DISTFILES?= ${DISTNAME}${EXTRACT_SUFX}
ALLFILES?= ${DISTFILES} ${PATCHFILES}
@@ -1535,7 +1553,7 @@ do-fetch:
fi; \
fi; \
${ECHO_MSG} ">> $$file doesn't seem to exist on this system."; \
- for site in ${MASTER_SITES}; do \
+ for site in `${SORTED_MASTER_SITES_CMD}`; do \
${ECHO_MSG} ">> Attempting to fetch from $${site}."; \
DIR=${DIST_SUBDIR}; \
CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
@@ -2134,7 +2152,7 @@ fetch-list:
@(cd ${_DISTDIR}; \
for file in ${DISTFILES}; do \
if [ ! -f $$file -a ! -f `${BASENAME} $$file` ]; then \
- for site in ${MASTER_SITES}; do \
+ for site in `${SORTED_MASTER_SITES_CMD}`; do \
DIR=${DIST_SUBDIR}; \
CKSIZE=`${GREP} "^SIZE ($${DIR:+$$DIR/}$$file)" ${MD5_FILE} | ${AWK} '{print $$4}'`; \
case $${file} in \
@@ -2665,7 +2683,9 @@ generate-plist:
.endif
.endfor
@${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${PLIST} >> ${TMPPLIST}
+.if !defined(NO_MTREE)
@${ECHO} "@unexec if [ -f %D/info/dir ]; then if sed -e '1,/Menu:/d' %D/info/dir | grep -q '^[*] '; then true; else rm %D/info/dir; fi; fi" >> ${TMPPLIST}
+.endif
.if defined(INSTALLS_SHLIB)
@${ECHO} "@exec ${LDCONFIG} -m ${LDCONFIG_PLIST}" >> ${TMPPLIST}
@${ECHO} "@unexec ${LDCONFIG} -R" >> ${TMPPLIST}