summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorfredb <fredb>2002-03-04 19:41:03 +0000
committerfredb <fredb>2002-03-04 19:41:03 +0000
commit3c94275e3186ff706aff64431088202eaa12d576 (patch)
tree81fb74e21b3de2fbc9c29841caa4eb46bf038535 /mk
parentf7418e7a9e3bc8f14d47d274559723d14bb07751 (diff)
downloadpkgsrc-3c94275e3186ff706aff64431088202eaa12d576.tar.gz
Generalize the handling for packages where "fetch" and "fetch-list"
only emit a message and don't actually fetch anything. This allows us to make the output of "fetch-list" for these packages consistent with other packages. While we're in here, integrate DYNAMIC_MASTER_SITES with the ${ORDERED_SITES} macro. The only functional change here is that ${MASTER_SITE_OVERRIDE} is now respected. Still to do -- something appropriate for "fetch-list" for these packages, like sourcing "getsites.sh" into the generated script. (Well, "package", but there are two others that do something similar in their "Makefile".) Also eliminate the misbegotten _FETCH_ALLFILES macro -- now that only "fetch" uses it, move it's functionality directly under "do-fetch".
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk85
-rw-r--r--mk/bsd.pkg.subdir.mk3
2 files changed, 52 insertions, 36 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index 2855d41afa8..ff70c98835e 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.940 2002/03/04 17:21:46 jmc Exp $
+# $NetBSD: bsd.pkg.mk,v 1.941 2002/03/04 19:41:03 fredb Exp $
#
# This file is in the public domain.
#
@@ -1251,17 +1251,22 @@ _CHECK_DIST_PATH= \
fi
#
-# Sort the master site list according to the patterns in MASTER_SORT.
+# Set up ORDERED_SITES to work out the exact list of sites for every file,
+# using the dynamic sites script, or sorting according to the master site
+# list or the patterns in MASTER_SORT or MASTER_SORT_REGEX as appropriate.
+# No actual sorting is done until ORDERED_SITES is expanded.
#
-.if defined(MASTER_SORT) || defined(MASTER_SORT_REGEX)
+.if defined(DYNAMIC_MASTER_SITES)
+ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} `${SH} ${FILESDIR}/getsite.sh $${file}`
+.elif defined(MASTER_SORT) || defined(MASTER_SORT_REGEX)
MASTER_SORT?=
MASTER_SORT_REGEX?=
MASTER_SORT_REGEX+= ${MASTER_SORT:S/./\\./g:C/.*/:\/\/[^\/]*&\//}
MASTER_SORT_AWK= BEGIN { RS = " "; ORS = " "; IGNORECASE = 1 ; gl = "${MASTER_SORT_REGEX}"; }
-.for srt in ${MASTER_SORT_REGEX}
+. for srt in ${MASTER_SORT_REGEX}
MASTER_SORT_AWK+= /${srt:C/\//\\\//g}/ { good["${srt}"] = good["${srt}"] " " $$0 ; next; }
-.endfor
+. endfor
MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; }
SORT_SITES_CMD= ${ECHO} $$unsorted_sites | ${AWK} '${MASTER_SORT_AWK}'
@@ -1271,47 +1276,43 @@ ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} $$unsorted_sites
.endif
#
-# Complete macro for the do-fetch target.
+# Associate each file to fetch with the correct site(s).
#
-.if !defined(_FETCH_ALLFILES)
-. if !empty(_DISTFILES)
-. for fetchfile in ${_DISTFILES}
+.if !empty(_DISTFILES)
+. for fetchfile in ${_DISTFILES}
SITES_${fetchfile:T}?= ${MASTER_SITES}
-. endfor
-. endif
-. if !empty(_PATCHFILES)
-. for fetchfile in ${_PATCHFILES}
+. endfor
+.endif
+.if !empty(_PATCHFILES)
+. for fetchfile in ${_PATCHFILES}
SITES_${fetchfile:T}?= ${PATCH_SITES}
-. endfor
-. endif
+. endfor
+.endif
+
+.if !target(do-fetch)
+do-fetch:
. if !empty(_ALLFILES)
-_FETCH_ALLFILES= ${TEST} -d ${_DISTDIR} || ${MKDIR} ${_DISTDIR};
-_FETCH_ALLFILES+= cd ${_DISTDIR};
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${TEST} -d ${_DISTDIR} || ${MKDIR} ${_DISTDIR}
. for fetchfile in ${_ALLFILES}
-. if defined(DYNAMIC_MASTER_SITES)
-_FETCH_ALLFILES+= \
+. if defined(_FETCH_MESSAGE)
+ ${_PKG_SILENT}${_PKG_DEBUG} \
file="${fetchfile}"; \
- bfile="${fetchfile:T}"; \
- sites=`sh ${FILESDIR}/getsite.sh $${file}`; \
- ${_CHECK_DIST_PATH}; \
- ${_FETCH_FILE};
+ if [ ! -f ${DISTDIR}/$$file ]; then \
+ ${_FETCH_MESSAGE}; \
+ fi
. else
-_FETCH_ALLFILES+= \
- unsorted_sites="${SITES_${fetchfile:T}} ${_MASTER_SITE_BACKUP}"; \
- sites="${ORDERED_SITES}"; \
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ cd ${_DISTDIR}; \
file="${fetchfile}"; \
bfile="${fetchfile:T}"; \
+ unsorted_sites="${SITES_${fetchfile:T}} ${_MASTER_SITE_BACKUP}"; \
+ sites="${ORDERED_SITES}"; \
${_CHECK_DIST_PATH}; \
${_FETCH_FILE};
-. endif
+. endif # defined(_FETCH_MESSAGE)
. endfor
-. endif
-_FETCH_ALLFILES?= ${DO_NADA}
-.endif
-
-.if !target(do-fetch)
-do-fetch:
- ${_PKG_SILENT}${_PKG_DEBUG}${_FETCH_ALLFILES}
+. endif # !empty(_ALLFILES)
.endif
# show both build and run depends directories (non-recursively)
@@ -2844,6 +2845,7 @@ fetch-list-recursive:
| ${AWK} ' \
/^[^#]/ { FoundSomething = 1 } \
/^unsorted/ { gsub(/[[:space:]]+/, " \\\n\t") } \
+ /^echo/ { gsub(/;[[:space:]]+/, "\n") } \
{ block[line_c++] = $$0 } \
END { if (FoundSomething) \
for (line = 0; line < line_c; line++) \
@@ -2864,8 +2866,20 @@ fetch-list-one-pkg:
@${ECHO} '#'
@${MKDIR} ${_DISTDIR}
. for fetchfile in ${_ALLFILES}
+. if defined(_FETCH_MESSAGE)
+ @(cd ${_DISTDIR}; \
+ if [ ! -f ${fetchfile:T} ]; then \
+ ${ECHO}; \
+ filesize=`${AWK} ' \
+ /^Size/ && $$2 == "(${fetchfile})" { print $$4 } \
+ ' ${DISTINFO_FILE}` || true; \
+ ${ECHO} '# Prompt user to get ${fetchfile} ('$${filesize-???}' bytes) manually:'; \
+ ${ECHO} '#'; \
+ ${ECHO} ${_FETCH_MESSAGE:Q}; \
+ fi)
+. else
@(cd ${_DISTDIR}; \
- if [ ! -f ${fetchfile} -a ! -f ${fetchfile:T} ]; then \
+ if [ ! -f ${fetchfile:T} ]; then \
${ECHO}; \
filesize=`${AWK} ' \
/^Size/ && $$2 == "(${fetchfile})" { print $$4 } \
@@ -2881,6 +2895,7 @@ fetch-list-one-pkg:
${ECHO} ' ${ECHO} ${fetchfile} not fetched'; \
${ECHO} done; \
fi)
+. endif # defined(_FETCH_MESSAGE)
. endfor
. endif # !empty(_ALLFILES)
.endif # !target(fetch-list-one-pkg)
diff --git a/mk/bsd.pkg.subdir.mk b/mk/bsd.pkg.subdir.mk
index b64fc7366ba..cf76fdaddbb 100644
--- a/mk/bsd.pkg.subdir.mk
+++ b/mk/bsd.pkg.subdir.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.subdir.mk,v 1.46 2002/02/28 14:42:39 fredb Exp $
+# $NetBSD: bsd.pkg.subdir.mk,v 1.47 2002/03/04 19:41:05 fredb Exp $
# Derived from: FreeBSD Id: bsd.port.subdir.mk,v 1.19 1997/03/09 23:10:56 wosch Exp
# from: @(#)bsd.subdir.mk 5.9 (Berkeley) 2/1/91
#
@@ -236,6 +236,7 @@ fetch-list:
} \
/^[^#=]/ { FoundSomething = 1 } \
/^unsorted/ { gsub(/[[:space:]]+/, " \\\n\t") } \
+ /^echo/ { gsub(/;[[:space:]]+/, "\n") } \
!/^=/ { block[c++] = $$0 } \
/^=/ { do_block() } \
END { do_block() } \