diff options
author | xtraeme <xtraeme> | 2004-07-27 10:34:53 +0000 |
---|---|---|
committer | xtraeme <xtraeme> | 2004-07-27 10:34:53 +0000 |
commit | 343ded0d4490bb12ded99b427f1f6724eac92046 (patch) | |
tree | 3b0843edde74eb165f9c152e845c828972f44c5a /mk | |
parent | fbc3d20bfd106defd92e36eeec9df9c6004ccc3a (diff) | |
download | pkgsrc-343ded0d4490bb12ded99b427f1f6724eac92046.tar.gz |
Fix some more troubles with my modification for resume transfers:
o Use ${WC} -c instead of using ${LS} -l, which works with
symlinks.
o Only assign -R to FETCH_RESUME_ARGS when FETCH_CMD is the
default value (NetBSD's ftp).
o Fix for www/navigator package, which uses DIST_SUBDIR.
o Replace another [ with ${TEST}.
o Print a warning when FETCH_CMD != ftp and FETCH_RESUME_ARGS
is empty (resume will not be possible).
Thanks to cube@ and tron@ for reporting/helping with the problems.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.defaults.mk | 6 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 37 |
2 files changed, 26 insertions, 17 deletions
diff --git a/mk/bsd.pkg.defaults.mk b/mk/bsd.pkg.defaults.mk index 2fc5359dbd6..01912d66bf3 100644 --- a/mk/bsd.pkg.defaults.mk +++ b/mk/bsd.pkg.defaults.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.defaults.mk,v 1.265 2004/07/27 03:59:26 xtraeme Exp $ +# $NetBSD: bsd.pkg.defaults.mk,v 1.266 2004/07/27 10:34:53 xtraeme Exp $ # # A file providing defaults for pkgsrc and the packages collection. @@ -221,7 +221,11 @@ FETCH_CMD?= /usr/bin/ftp # Default: NetBSD's ftp(1). # Possible: any. +.if ${FETCH_CMD:T} == "ftp" FETCH_RESUME_ARGS?= -R +.else +FETCH_RESUME_ARGS?= # empty +.endif # Default argument to resume transferencies on pkgsrc, when using ftp(1) # from NetBSD/pkgsrc. # Default: -R diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index 52f6225066e..5e700af22ba 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1478 2004/07/27 09:57:57 agc Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1479 2004/07/27 10:34:53 xtraeme Exp $ # # This file is in the public domain. # @@ -1414,12 +1414,8 @@ package: # Resume a previous transfer not finished totally. _RESUME_TRANSFER= \ - dsize=`${LS} -l ${_DISTDIR}/$$bfile | ${AWK} '{print $$5}'`; \ - case "${DIST_SUBDIR}" in \ - "") f=$$bfile ;; \ - *) f="${DIST_SUBDIR}/$$bfile" ;; \ - esac; \ - tsize=`${AWK} '/^Size/ && $$2 == '"\"($$f)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \ + dsize=`${WC} -c ${DISTDIR}/${DIST_SUBDIR}/$$bfile | ${AWK} '{print $$1}'`; \ + tsize=`${AWK} '/^Size/ && $$2 == '"\"($$file)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \ case "$$tsize" in \ "") ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \ break ;; \ @@ -1428,15 +1424,24 @@ _RESUME_TRANSFER= \ ${ECHO_MSG} "===> Resume is not supported by ftp(1) using http/ftp proxies."; \ break; \ else \ - 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}; \ - if [ $$? -eq 0 ]; then \ - break; \ - fi; \ - done; \ + if ${TEST} "$$dsize" -lt "$$tsize"; then \ + if ${TEST} "${FETCH_CMD:T}" != "ftp" -a \ + -z "${FETCH_RESUME_ARGS}"; then \ + ${ECHO_MSG} "=> Resume transfers are not supported, FETCH_RESUME_ARGS is empty."; \ + break; \ + else \ + 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}; \ + if ${TEST} $$? -eq 0; then \ + break; \ + fi; \ + done; \ + fi; \ + elif ${TEST} "$$dsize" -gt "$$tsize"; then \ + ${ECHO_MSG} "==> Downloaded file larger than the recorded size."; \ + break; \ fi; \ fi |