diff options
author | xtraeme <xtraeme@pkgsrc.org> | 2004-07-27 03:59:26 +0000 |
---|---|---|
committer | xtraeme <xtraeme@pkgsrc.org> | 2004-07-27 03:59:26 +0000 |
commit | 2f4220cc9d0685e07cc22f4f661c2dbea5ab2e22 (patch) | |
tree | ea567b7d7e205cca5c6d71420e9339e8016d0cb1 /mk | |
parent | 20f3ee085af5d4295935ea7c957a2ab8fcddc46d (diff) | |
download | pkgsrc-2f4220cc9d0685e07cc22f4f661c2dbea5ab2e22.tar.gz |
Add support to resume transfers, by default it will be disabled if
$http_proxy or $ftp_proxy are defined (for the moment, NetBSD's ftp(1)
doesn't support this).
While I'm here, move FETCH_CMD from bsd.pkg.mk to bsd.pkg.defaults.mk,
and add the new variable FETCH_RESUME_ARGS (-R by default with ftp(1)
from NetBSD/pkgsrc).
If you want to use wget to resume transfers, you should use something
like:
FETCH_CMD=wget
FETCH_RESUME_ARGS=-c
Diffstat (limited to 'mk')
-rw-r--r-- | mk/bsd.pkg.defaults.mk | 17 | ||||
-rw-r--r-- | mk/bsd.pkg.mk | 31 |
2 files changed, 39 insertions, 9 deletions
diff --git a/mk/bsd.pkg.defaults.mk b/mk/bsd.pkg.defaults.mk index 137f9643cf1..2fc5359dbd6 100644 --- a/mk/bsd.pkg.defaults.mk +++ b/mk/bsd.pkg.defaults.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.defaults.mk,v 1.264 2004/07/25 06:51:33 grant Exp $ +# $NetBSD: bsd.pkg.defaults.mk,v 1.265 2004/07/27 03:59:26 xtraeme Exp $ # # A file providing defaults for pkgsrc and the packages collection. @@ -212,6 +212,21 @@ DEFAULT_VIEW?= "" # This is the default view to which packages are added after installation. # Default: "" (the empty view) +.if exists(${LOCALBASE}/bin/ftp) +FETCH_CMD?= ${LOCALBASE}/bin/ftp +.else +FETCH_CMD?= /usr/bin/ftp +.endif +# Default program to fetch the files with pkgsrc. +# Default: NetBSD's ftp(1). +# Possible: any. + +FETCH_RESUME_ARGS?= -R +# Default argument to resume transferencies on pkgsrc, when using ftp(1) +# from NetBSD/pkgsrc. +# Default: -R +# Possible: depends on your FETCH_CMD value. + PKG_INSTALLATION_PREFS?= overwrite pkgviews # This is a whitespace-separated list of installation types to try when # building a package, in order of preference. diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk index f737d7930c2..efdb967131b 100644 --- a/mk/bsd.pkg.mk +++ b/mk/bsd.pkg.mk @@ -1,4 +1,4 @@ -# $NetBSD: bsd.pkg.mk,v 1.1476 2004/07/25 06:51:33 grant Exp $ +# $NetBSD: bsd.pkg.mk,v 1.1477 2004/07/27 03:59:26 xtraeme Exp $ # # This file is in the public domain. # @@ -476,12 +476,6 @@ MAKE_ENV+= CPP="${CPP}" MAKE_ENV+= PTHREAD_CFLAGS="${PTHREAD_CFLAGS}" MAKE_ENV+= PTHREAD_LDFLAGS="${PTHREAD_LDFLAGS}" -.if exists(${LOCALBASE}/bin/ftp) -FETCH_CMD?= ${LOCALBASE}/bin/ftp -.else -FETCH_CMD?= /usr/bin/ftp -.endif - TOUCH_FLAGS?= -f # determine if we need a working patch(1). @@ -1418,6 +1412,26 @@ package: # adding pre-* or post-* targets/scripts, override these. ################################################################ +# 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 \ + ${ECHO_MSG} "===> Resume is not supported by ftp(1) using http/ftp proxies."; \ + break; \ + else \ + if [ `echo $$dsize` != `echo $$tsize` ]; 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; \ + fi; \ + fi # # Define the elementary fetch macros. # @@ -1598,7 +1612,8 @@ do-fetch: unsorted_sites="${SITES_${fetchfile:T:S/=/--/}} ${_MASTER_SITE_BACKUP}"; \ sites="${ORDERED_SITES}"; \ ${_CHECK_DIST_PATH}; \ - ${_FETCH_FILE}; + ${_FETCH_FILE}; \ + ${_RESUME_TRANSFER} . endif # defined(_FETCH_MESSAGE) . endfor . endif # INTERACTIVE_STAGE == fetch |