aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.port.mk
diff options
context:
space:
mode:
authorasami <asami@FreeBSD.org>2000-07-20 00:41:22 +0800
committerasami <asami@FreeBSD.org>2000-07-20 00:41:22 +0800
commit566d948a7aec7b76f6f7f977eef42b8600f8cdd5 (patch)
tree6dd20aed411dccc19dc97541b7bd9f3ee19da5d5 /Mk/bsd.port.mk
parentba64abc4e04faa6342a2f30b523e8b7937fc08c5 (diff)
downloadfreebsd-ports-graphics-566d948a7aec7b76f6f7f977eef42b8600f8cdd5.tar.gz
freebsd-ports-graphics-566d948a7aec7b76f6f7f977eef42b8600f8cdd5.tar.zst
freebsd-ports-graphics-566d948a7aec7b76f6f7f977eef42b8600f8cdd5.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.
Diffstat (limited to 'Mk/bsd.port.mk')
-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 95fae7b4362..72eb7d01d5e 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}