pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/mk Fix some more troubles with my modification for res...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e49b8d88a345
branches:  trunk
changeset: 478615:e49b8d88a345
user:      xtraeme <xtraeme%pkgsrc.org@localhost>
date:      Tue Jul 27 10:34:53 2004 +0000

description:
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:

 mk/bsd.pkg.defaults.mk |   6 +++++-
 mk/bsd.pkg.mk          |  37 +++++++++++++++++++++----------------
 2 files changed, 26 insertions(+), 17 deletions(-)

diffs (79 lines):

diff -r bacefe883de5 -r e49b8d88a345 mk/bsd.pkg.defaults.mk
--- a/mk/bsd.pkg.defaults.mk    Tue Jul 27 10:27:05 2004 +0000
+++ b/mk/bsd.pkg.defaults.mk    Tue Jul 27 10:34:53 2004 +0000
@@ -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 @@
 # 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 -r bacefe883de5 -r e49b8d88a345 mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Tue Jul 27 10:27:05 2004 +0000
+++ b/mk/bsd.pkg.mk     Tue Jul 27 10:34:53 2004 +0000
@@ -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 @@
 
 # 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 @@
                ${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
 



Home | Main Index | Thread Index | Old Index