Make the option to resume transfer optional, as suggested by

Robert Elz in PR pkg/26448 (at least for now).

If you want to use it, PKG_RESUME_TRANSFERS must be set to [Yy][Ee][Ss].

While here, no need to use ${AWK} to get the size with ${WC} -c,
${WC} -c < file is enough.

Thanks to Robert Elz for suggestions, still I have to fix the problems
reported in the PR.
This commit is contained in:
xtraeme 2004-07-27 15:56:19 +00:00
parent b6722d40b6
commit 088cc6d2d6
2 changed files with 14 additions and 5 deletions

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.defaults.mk,v 1.266 2004/07/27 10:34:53 xtraeme Exp $
# $NetBSD: bsd.pkg.defaults.mk,v 1.267 2004/07/27 15:56:19 xtraeme Exp $
#
# A file providing defaults for pkgsrc and the packages collection.
@ -237,6 +237,12 @@ PKG_INSTALLATION_PREFS?= overwrite pkgviews
# Possible: any of: overwrite, pkgviews
# Default: overwrite pkgviews
PKG_RESUME_TRANSFERS?= YES
# Used in pkgsrc to resume transfers, if enabled the whole file won't be
# downloaded from scratch again.
# Possible: yes or no.
# Default: YES.
PKG_SYSCONFBASE?= ${PREFIX}/etc
# This is the main config directory under which all package configuration
# files should be found.

View file

@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.mk,v 1.1479 2004/07/27 10:34:53 xtraeme Exp $
# $NetBSD: bsd.pkg.mk,v 1.1480 2004/07/27 15:56:19 xtraeme Exp $
#
# This file is in the public domain.
#
@ -1414,7 +1414,7 @@ package:
# Resume a previous transfer not finished totally.
_RESUME_TRANSFER= \
dsize=`${WC} -c ${DISTDIR}/${DIST_SUBDIR}/$$bfile | ${AWK} '{print $$1}'`; \
dsize=`${WC} -c < ${DISTDIR}/${DIST_SUBDIR}/$$bfile`; \
tsize=`${AWK} '/^Size/ && $$2 == '"\"($$file)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \
case "$$tsize" in \
"") ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
@ -1625,8 +1625,11 @@ do-fetch:
unsorted_sites="${SITES_${fetchfile:T:S/=/--/}} ${_MASTER_SITE_BACKUP}"; \
sites="${ORDERED_SITES}"; \
${_CHECK_DIST_PATH}; \
${_FETCH_FILE}; \
${_RESUME_TRANSFER}
if ${TEST} "${PKG_RESUME_TRANSFERS:M[Yy][Ee][Ss]}" ; then \
${_FETCH_FILE}; ${_RESUME_TRANSFER}; \
else \
${_FETCH_FILE}; \
fi
. endif # defined(_FETCH_MESSAGE)
. endfor
. endif # INTERACTIVE_STAGE == fetch