pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk Some changes for PKG_RESUME_TRANSFERS:
details: https://anonhg.NetBSD.org/pkgsrc/rev/23fd226ab1a1
branches: trunk
changeset: 491312:23fd226ab1a1
user: xtraeme <xtraeme%pkgsrc.org@localhost>
date: Tue Mar 22 22:20:21 2005 +0000
description:
Some changes for PKG_RESUME_TRANSFERS:
o If origfile is already downloaded (size ok) and there's
a temp file with incomplete size, don't try to resume the
transfer on the temp file, remove it.
o Clean the code a bit.
diffstat:
mk/bsd.pkg.mk | 108 +++++++++++++++++++++++++++++++++------------------------
1 files changed, 63 insertions(+), 45 deletions(-)
diffs (124 lines):
diff -r 633cdf337fdb -r 23fd226ab1a1 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk Tue Mar 22 20:03:12 2005 +0000
+++ b/mk/bsd.pkg.mk Tue Mar 22 22:20:21 2005 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1601 2005/03/20 18:18:09 jmmv Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1602 2005/03/22 22:20:21 xtraeme Exp $
#
# This file is in the public domain.
#
@@ -1223,52 +1223,70 @@
### the original name.
###
-_RESUME_TRANSFER= \
+_RESUME_TRANSFER= \
+ ofile="${DISTDIR}/${DIST_SUBDIR}/$$bfile"; \
+ tfile="${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp"; \
tsize=`${AWK} '/^Size/ && $$2 == '"\"($$file)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \
- if [ ! -f "${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp" ]; then \
- ${CP} ${DISTDIR}/${DIST_SUBDIR}/$$bfile ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp; \
- fi; \
- dsize=`${WC} -c < ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp`; \
- if [ "$$dsize" -eq "$$tsize" -a -f "${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp" ]; then \
- ${MV} ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp ${DISTDIR}/${DIST_SUBDIR}/$$bfile; \
- fi; \
- case "$$tsize" in \
- "") ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
- break ;; \
- esac; \
- if [ -n "$$ftp_proxy" -o -n "$$http_proxy" ]; then \
+ osize=`${WC} -c < $$ofile`; \
+ \
+ case "$$tsize" in \
+ "") ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
+ break;; \
+ esac; \
+ \
+ if [ "$$osize" -eq "$$tsize" ]; then \
+ if [ -f "$$tfile" ]; then \
+ ${RM} $$tfile; \
+ fi; \
+ need_fetch=no; \
+ break; \
+ elif [ "$$osize" -lt "$$tsize" -a ! -f "$$tfile" ]; then \
+ ${CP} $$ofile $$tfile; \
+ dsize=`${WC} -c < $$tfile`; \
+ need_fetch=yes; \
+ elif [ -f "$$tfile" -a "$$dsize" -gt "$$ossize" ]; then \
+ dsize=`${WC} -c < $$tfile`; \
+ need_fetch=yes; \
+ else \
+ dsize=`${WC} -c < $$tfile`; \
+ need_fetch=yes; \
+ fi; \
+ if [ "$$need_fetch" = "no" ]; then \
+ break; \
+ elif [ -f "$$tfile" -a "$$dsize" -eq "$$tsize" ]; then \
+ ${MV} $$tfile $$ofile; \
+ break; \
+ elif [ -n "$$ftp_proxy" -o -n "$$http_proxy" ]; then \
${ECHO_MSG} "===> Resume is not supported by ftp(1) using http/ftp proxies."; \
- break; \
- else \
- if [ "$$dsize" -lt "$$tsize" ]; then \
- if [ "${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 \
- if [ -z "${FETCH_OUTPUT_ARGS}" ]; then \
- ${ECHO_MSG} "=> FETCH_OUTPUT_ARGS has to be defined."; \
- break; \
- fi; \
- ${ECHO_MSG} "=> $$bfile not completed, resuming:"; \
- ${ECHO_MSG} "=> Downloaded: $$dsize Total: $$tsize."; \
- ${ECHO_MSG}; \
- cd ${_DISTDIR}; \
- ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} \
- ${FETCH_OUTPUT_ARGS} $${bfile}.temp $${res_site}$${bfile}; \
- if [ $$? -eq 0 ]; then \
- ndsize=`${WC} -c < ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp`; \
- if [ "$$tsize" -eq "$$ndsize" ]; then \
- ${MV} ${DISTDIR}/${DIST_SUBDIR}/$$bfile.temp ${DISTDIR}/${DIST_SUBDIR}/$$bfile; \
- fi; \
- break; \
- fi; \
- done; \
- fi; \
- elif [ "$$dsize" -gt "$$tsize" ]; then \
- ${ECHO_MSG} "==> Downloaded file larger than the recorded size."; \
- break; \
- fi; \
+ break; \
+ elif [ "$$need_fetch" = "yes" -a "$$dsize" -lt "$$tsize" ]; then \
+ if [ "${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 \
+ if [ -z "${FETCH_OUTPUT_ARGS}" ]; then \
+ ${ECHO_MSG} "=> FETCH_OUTPUT_ARGS has to be defined."; \
+ break; \
+ fi; \
+ ${ECHO_MSG} "=> $$bfile not completed, resuming:"; \
+ ${ECHO_MSG} "=> Downloaded: $$dsize Total: $$tsize."; \
+ ${ECHO_MSG}; \
+ cd ${DISTDIR}; \
+ ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} \
+ ${FETCH_OUTPUT_ARGS} $${bfile}.temp $${res_site}$${bfile}; \
+ if [ $$? -eq 0 ]; then \
+ ndsize=`${WC} -c < $$tfile`; \
+ if [ "$$tsize" -eq "$$ndsize" ]; then \
+ ${MV} $$tfile $$ofile; \
+ fi; \
+ break; \
+ fi; \
+ done; \
+ fi; \
+ elif [ "$$dsize" -gt "$$tsize" ]; then \
+ ${ECHO_MSG} "==> Downloaded file larger than the recorded size."; \
+ break; \
fi
#
Home |
Main Index |
Thread Index |
Old Index