diff options
author | tron <tron> | 1998-09-05 19:45:25 +0000 |
---|---|---|
committer | tron <tron> | 1998-09-05 19:45:25 +0000 |
commit | 3a2f673e4f1758ed7f5287adf455deacd60ca6b5 (patch) | |
tree | 59a1d74828a50f2d2f86e8903fb34867e6652d21 /mk | |
parent | 3ed01437030690949ea2063095a20103332dc1e9 (diff) | |
download | pkgsrc-3a2f673e4f1758ed7f5287adf455deacd60ca6b5.tar.gz |
Combine fetch loops for distribution and patch files to reduce duplicate
code. Patch supplied by Jim Bernard in PR pkg/5977.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.mk | 60 |
1 files changed, 18 insertions, 42 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index b38eaaa98d6..3ce019c28da 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.157 1998/09/04 10:26:59 agc Exp $ +# $NetBSD: bsd.pkg.mk,v 1.158 1998/09/05 19:45:25 tron Exp $ # # This file is in the public domain. # @@ -762,12 +762,7 @@ describe: ################################################################ # Fetch - -.if !target(do-fetch) -do-fetch: - @${MKDIR} ${_DISTDIR} - @(cd ${_DISTDIR}; \ - for file in ${_DISTFILES}; do \ +_FETCH_FILE= \ bfile=`${BASENAME} $$file`; \ if [ ! -f $$file -a ! -f $$bfile ]; then \ if [ -h $$file -o -h $$bfile ]; then \ @@ -775,12 +770,12 @@ do-fetch: ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ ${ECHO_MSG} ">> Please correct this problem and try again."; \ exit 1; \ - fi ; \ + fi ; \ ${ECHO_MSG} ">> $$bfile doesn't seem to exist on this system."; \ - for site in ${MASTER_SITES}; do \ + for site in $$sites; do \ ${ECHO_MSG} ">> Attempting to fetch $$bfile from $${site}."; \ if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${bfile} ${FETCH_AFTER_ARGS}; then \ - if [ "X${FAILOVER_FETCH}" != X"" -a -f ${MD5_FILE} ]; then \ + if [ -n "${FAILOVER_FETCH}" -a -f ${MD5_FILE} ]; then \ CKSUM=`${MD5} < ${_DISTDIR}/$$bfile`; \ CKSUM2=`${AWK} '$$1 == "MD5" && $$2 == "\('$$file'\)"{print $$4;}' ${MD5_FILE}`; \ if [ "$$CKSUM" = "$$CKSUM2" -o "$$CKSUM2" = "IGNORE" ]; then \ @@ -796,40 +791,21 @@ do-fetch: ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\ ${ECHO_MSG} ">> file manually into ${_DISTDIR} and try again."; \ exit 1; \ - fi \ + fi + +.if !target(do-fetch) +do-fetch: + @${MKDIR} ${_DISTDIR} + @(cd ${_DISTDIR}; \ + sites="${MASTER_SITES}"; \ + for file in ${_DISTFILES}; do \ + ${_FETCH_FILE} \ done) .if defined(PATCHFILES) - @(cd ${_DISTDIR}; \ - for file in ${_PATCHFILES}; do \ - bfile=`${BASENAME} $$file`; \ - if [ ! -f $$file -a ! -f $$bfile ]; then \ - if [ -h $$file -o -h $$bfile ]; then \ - ${ECHO_MSG} ">> ${_DISTDIR}/$$bfile is a broken symlink."; \ - ${ECHO_MSG} ">> Perhaps a filesystem (most likely a CD) isn't mounted?"; \ - ${ECHO_MSG} ">> Please correct this problem and try again."; \ - exit 1; \ - fi ; \ - ${ECHO_MSG} ">> $$bfile doesn't seem to exist on this system."; \ - for site in ${PATCH_SITES}; do \ - ${ECHO_MSG} ">> Attempting to fetch from $${site}."; \ - if ${FETCH_CMD} ${FETCH_BEFORE_ARGS} $${site}$${bfile} ${FETCH_AFTER_ARGS}; then \ - if [ "X${FAILOVER_FETCH}" != X"" -a -f ${MD5_FILE} ]; then \ - CKSUM=`${MD5} < ${_DISTDIR}/$$bfile`; \ - CKSUM2=`${AWK} '$$1 == "MD5" && $$2 == "\('$$file'\)"{print $$4;}' ${MD5_FILE}`; \ - if [ "$$CKSUM" = "$$CKSUM2" -o "$$CKSUM2" = "IGNORE" ]; then \ - continue 2; \ - else \ - ${ECHO_MSG} ">> Checksum failure - trying next site."; \ - fi; \ - else \ - continue 2; \ - fi; \ - fi \ - done; \ - ${ECHO_MSG} ">> Couldn't fetch it - please try to retrieve this";\ - ${ECHO_MSG} ">> file manually into ${_DISTDIR} and try again."; \ - exit 1; \ - fi \ + @(cd ${_DISTDIR}; \ + sites="${PATCH_SITES}"; \ + for file in ${_PATCHFILES}; do \ + ${_FETCH_FILE} \ done) .endif .endif |