summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authoragc <agc@pkgsrc.org>2004-07-27 09:57:57 +0000
committeragc <agc@pkgsrc.org>2004-07-27 09:57:57 +0000
commita60952e252c605e068e103df8dc51ef9df0c5668 (patch)
treefc11361fa3eb80dd8e75ca1fc3100b45a691cbbd /mk
parent296ddc88b75c084042d6c774b508a16fafc7726d (diff)
downloadpkgsrc-a60952e252c605e068e103df8dc51ef9df0c5668.tar.gz
Fix some problems with REFETCH mods:
1. don't hardcode true, echo and [ 2. Cope with distfiles which are located in a DIST_SUBDIR 3. Don't always assume there will be a size field in the ${DISTINFO_FILE} XXX The refetch mods make an assumption that an exit code of 0 from a ${FETCH_CMD} means that the transfer has been completed successfully, and this used not to be the case. I haven't tested this assumption recently.
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk22
1 files changed, 15 insertions, 7 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index efdb967131b..52f6225066e 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1477 2004/07/27 03:59:26 xtraeme Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1478 2004/07/27 09:57:57 agc Exp $
#
# This file is in the public domain.
#
@@ -1415,23 +1415,31 @@ package:
# Resume a previous transfer not finished totally.
_RESUME_TRANSFER= \
dsize=`${LS} -l ${_DISTDIR}/$$bfile | ${AWK} '{print $$5}'`; \
- tsize=`${AWK} '/^Size/ && $$2 == '"\"($$bfile)\""' { print $$4 }' ${DISTINFO_FILE}` || true; \
- if [ -n "$$ftp_proxy" -o -n "$$http_proxy" ]; then \
+ case "${DIST_SUBDIR}" in \
+ "") f=$$bfile ;; \
+ *) f="${DIST_SUBDIR}/$$bfile" ;; \
+ esac; \
+ tsize=`${AWK} '/^Size/ && $$2 == '"\"($$f)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \
+ case "$$tsize" in \
+ "") ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
+ break ;; \
+ esac; \
+ if ${TEST} -n "$$ftp_proxy" -o -n "$$http_proxy"; then \
${ECHO_MSG} "===> Resume is not supported by ftp(1) using http/ftp proxies."; \
break; \
else \
- if [ `echo $$dsize` != `echo $$tsize` ]; then \
+ if ${TEST} "$$dsize" -ne "$$dsize"; then \
for res_site in $$sites; do \
${ECHO_MSG} "===> $$bfile not completed, resuming..."; \
cd ${_DISTDIR}; \
- ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} \
- $${res_site}$${bfile}; \
+ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} $${res_site}$${bfile}; \
if [ $$? -eq 0 ]; then \
break; \
fi; \
done; \
- fi; \
+ fi; \
fi
+
#
# Define the elementary fetch macros.
#