pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Fix some problems with REFETCH mods:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/602e706a07bd
branches:  trunk
changeset: 478611:602e706a07bd
user:      agc <agc%pkgsrc.org@localhost>
date:      Tue Jul 27 09:57:57 2004 +0000

description:
Fix some problems with REFETCH mods:

1. don't hardcode true, echo and [
2. Cope with distfiles which are located in a DIST_SUBDIR
3. Don't always assume there will be a size field in the ${DISTINFO_FILE}

XXX The refetch mods make an assumption that an exit code of 0 from a
${FETCH_CMD} means that the transfer has been completed successfully,
and this used not to be the case.  I haven't tested this assumption
recently.

diffstat:

 mk/bsd.pkg.mk |  22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (47 lines):

diff -r 516b0e9bd17b -r 602e706a07bd mk/bsd.pkg.mk
--- a/mk/bsd.pkg.mk     Tue Jul 27 08:00:50 2004 +0000
+++ b/mk/bsd.pkg.mk     Tue Jul 27 09:57:57 2004 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: bsd.pkg.mk,v 1.1477 2004/07/27 03:59:26 xtraeme Exp $
+#      $NetBSD: bsd.pkg.mk,v 1.1478 2004/07/27 09:57:57 agc Exp $
 #
 # This file is in the public domain.
 #
@@ -1415,23 +1415,31 @@
 # 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              \
+       case "${DIST_SUBDIR}" in                                        \
+       "")     f=$$bfile ;;                                            \
+       *)      f="${DIST_SUBDIR}/$$bfile" ;;                           \
+       esac;                                                           \
+       tsize=`${AWK} '/^Size/ && $$2 == '"\"($$f)\""' { print $$4 }' ${DISTINFO_FILE}` || ${TRUE}; \
+       case "$$tsize" in                                               \
+       "")     ${ECHO_MSG} "No size in distinfo file (${DISTINFO_FILE})"; \
+               break ;;                                                \
+       esac;                                                           \
+       if ${TEST} -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           \
+               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};          \
+                               ${FETCH_CMD} ${FETCH_BEFORE_ARGS} ${FETCH_RESUME_ARGS} $${res_site}$${bfile}; \
                                if [ $$? -eq 0 ]; then                  \
                                        break;                          \
                                fi;                                     \
                        done;                                           \
-               fi;                                                     \
+               fi;                                                     \
        fi
+
 #
 # Define the elementary fetch macros.
 #



Home | Main Index | Thread Index | Old Index