pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Add support to resume transfers, by default it will...
details: https://anonhg.NetBSD.org/pkgsrc/rev/945c4f073f8d
branches: trunk
changeset: 478601:945c4f073f8d
user: xtraeme <xtraeme%pkgsrc.org@localhost>
date: Tue Jul 27 03:59:26 2004 +0000
description:
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:
mk/bsd.pkg.defaults.mk | 17 ++++++++++++++++-
mk/bsd.pkg.mk | 31 +++++++++++++++++++++++--------
2 files changed, 39 insertions(+), 9 deletions(-)
diffs (90 lines):
diff -r 4b0bf36760a2 -r 945c4f073f8d mk/bsd.pkg.defaults.mk
--- a/mk/bsd.pkg.defaults.mk Tue Jul 27 02:30:29 2004 +0000
+++ b/mk/bsd.pkg.defaults.mk Tue Jul 27 03:59:26 2004 +0000
@@ -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 @@
# 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 -r 4b0bf36760a2 -r 945c4f073f8d mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue Jul 27 02:30:29 2004 +0000
+++ b/mk/bsd.pkg.mk Tue Jul 27 03:59:26 2004 +0000
@@ -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+= 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 @@
# 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 @@
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
Home |
Main Index |
Thread Index |
Old Index