pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk Change the way the fetch process is organised as pr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/0619036995d6
branches:  trunk
changeset: 554226:0619036995d6
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Tue Feb 10 18:55:54 2009 +0000

description:
Change the way the fetch process is organised as proposed on tech-pkg:
- Introduce FETCH_USING, which specifies the mechanism to use; possible
  values are ftp, fetch, curl, wget, manual and custom.
- Depend on the correct tool/program if not using manual or custom.
- For manual, just use /usr/bin/false to bail out if a distfile is
  missing.
- For custom, FETCH_CMD and related variables are used as before.
- Default value is ftp.

diffstat:

 mk/defaults/mk.conf        |  15 ++++++++++-----
 mk/fetch/bsd.fetch-vars.mk |  16 +++++++++++-----
 mk/fetch/fetch-list.mk     |   6 +++---
 mk/fetch/fetch.mk          |  45 ++++++++++++++++++++++++++-------------------
 4 files changed, 50 insertions(+), 32 deletions(-)

diffs (176 lines):

diff -r 8e593bc4b8f6 -r 0619036995d6 mk/defaults/mk.conf
--- a/mk/defaults/mk.conf       Tue Feb 10 18:54:57 2009 +0000
+++ b/mk/defaults/mk.conf       Tue Feb 10 18:55:54 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: mk.conf,v 1.180 2008/11/29 13:38:52 rillig Exp $
+# $NetBSD: mk.conf,v 1.181 2009/02/10 18:55:54 joerg Exp $
 #
 
 # This file provides default values for variables that may be overridden
@@ -347,10 +347,15 @@
 # This is the default view to which packages are added after installation.
 # Default: "" (the empty view)
 
-FETCH_CMD?=             ${TOOLS_PATH.ftp}
-# Default program to fetch the files with pkgsrc.
-# Default: NetBSD's ftp(1).
-# Possible: any.
+FETCH_USING?=  ftp
+# The program type to fetch files.
+# "manual" will explicitly fail if the DISTFILES don't exist locally.
+# "custom" requires setting FETCH_CMD, FETCH_BEFORE_ARGS, FETCH_AFTER_ARGS,
+# FETCH_RESUME_ARGS and FETCH_OUTPUT_ARGS.
+#
+# The default value can be overriden by a package before including
+# bsd.prefs.mk and by the user in mk.conf.
+# Possible: curl, custom, fetch, ftp, manual, wget
 
 #FIX_SYSTEM_HEADERS=
 # Make pkgtools/posix_headers an automatic build dependency for all 
diff -r 8e593bc4b8f6 -r 0619036995d6 mk/fetch/bsd.fetch-vars.mk
--- a/mk/fetch/bsd.fetch-vars.mk        Tue Feb 10 18:54:57 2009 +0000
+++ b/mk/fetch/bsd.fetch-vars.mk        Tue Feb 10 18:55:54 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.fetch-vars.mk,v 1.11 2008/05/22 20:11:55 joerg Exp $
+# $NetBSD: bsd.fetch-vars.mk,v 1.12 2009/02/10 18:55:54 joerg Exp $
 #
 # This Makefile fragment is included separately by bsd.pkg.mk and
 # defines some variables which must be defined earlier than where
@@ -73,9 +73,15 @@
 _BOOTSTRAP_VERBOSE=    # defined
 .endif
 
-.if !empty(_CKSUMFILES)
-USE_TOOLS+=    ftp:bootstrap
-.  if defined(FAILOVER_FETCH)
+.if !empty(_CKSUMFILES) && defined(FAILOVER_FETCH)
 USE_TOOLS+=    digest:bootstrap
-.  endif
 .endif
+
+_FETCH_TOOLS.ftp=              ftp
+_FETCH_TOOLS.fetch=            fetch
+_FETCH_DEPENDS.wget=           wget-[0-9]*:../../net/wget
+_FETCH_DEPENDS.curl=           curl-[0-9]*:../../www/curl
+_FETCH_TOOLS.manual=           false
+
+USE_TOOLS+=    ${_FETCH_TOOLS.${FETCH_USING}:C/$/:bootstrap/}
+BOOTSTRAP_DEPENDS+=    ${_FETCH_DEPENDS.${FETCH_USING}}
diff -r 8e593bc4b8f6 -r 0619036995d6 mk/fetch/fetch-list.mk
--- a/mk/fetch/fetch-list.mk    Tue Feb 10 18:54:57 2009 +0000
+++ b/mk/fetch/fetch-list.mk    Tue Feb 10 18:55:54 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: fetch-list.mk,v 1.10 2009/02/08 23:16:08 wiz Exp $
+# $NetBSD: fetch-list.mk,v 1.11 2009/02/10 18:55:54 joerg Exp $
 
 ######################################################################
 ### fetch-list (PUBLIC)
@@ -82,7 +82,7 @@
                ${ECHO} "${MKDIR} ${_DISTDIR}";                         \
                ${ECHO} 'cd ${_DISTDIR} && { [ -f ${fetchfile} -o -f ${fetchfile:T} ] ||'; \
                ${ECHO} 'for site in $$sites; do';                      \
-               ${ECHO} '       ${FETCH_CMD} ${FETCH_BEFORE_ARGS} "$${site}${fetchfile:T}" ${FETCH_AFTER_ARGS} && break ||'; \
+               ${ECHO} '       ${_FETCH_CMD.${FETCH_USING}:Q} ${_FETCH_BEFORE_ARGS.${FETCH_USING}:Q} "$${site}${fetchfile:T}" ${_FETCH_AFTER_ARGS.${FETCH_USING}:Q} && break ||'; \
                ${ECHO} '       ${ECHO} ${fetchfile:T} not fetched';    \
                ${ECHO} 'done; }';                                      \
                ${ECHO} ')';                                            \
@@ -100,7 +100,7 @@
                ${ECHO} "${MKDIR} ${_DISTDIR}";                         \
                ${ECHO} 'cd ${_DISTDIR} && { [ -f ${fetchfile} -o -f ${fetchfile:T} ] ||'; \
                ${ECHO} 'for site in $$sites; do';                      \
-               ${ECHO} '       ${FETCH_CMD} ${FETCH_BEFORE_ARGS} "$${site}${fetchfile:T}" ${FETCH_AFTER_ARGS} && break ||'; \
+               ${ECHO} '       ${_FETCH_CMD.${FETCH_USING}:Q} ${_FETCH_BEFORE_ARGS.${FETCH_USING}:Q} "$${site}${fetchfile:T}" ${_FETCH_AFTER_ARGS.${FETCH_USING}:Q} && break ||'; \
                ${ECHO} '       ${ECHO} ${fetchfile:T} not fetched';    \
                ${ECHO} 'done; }';                                      \
        fi)
diff -r 8e593bc4b8f6 -r 0619036995d6 mk/fetch/fetch.mk
--- a/mk/fetch/fetch.mk Tue Feb 10 18:54:57 2009 +0000
+++ b/mk/fetch/fetch.mk Tue Feb 10 18:55:54 2009 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: fetch.mk,v 1.37 2008/10/08 15:39:07 joerg Exp $
+# $NetBSD: fetch.mk,v 1.38 2009/02/10 18:55:54 joerg Exp $
 
 _MASTER_SITE_BACKUP=   ${MASTER_SITE_BACKUP:=${DIST_SUBDIR}${DIST_SUBDIR:D/}}
 _MASTER_SITE_OVERRIDE= ${MASTER_SITE_OVERRIDE:=${DIST_SUBDIR}${DIST_SUBDIR:D/}}
@@ -163,9 +163,9 @@
 ### transfer the files from the appropriate sites if needed.
 ###
 #
-# FETCH_CMD is the program used to fetch files.  It must understand
-#      fetching files located via URLs, e.g. NetBSD's ftp, net/tnftp,
-#      etc.  The default value is set in pkgsrc/mk/defaults/mk.conf.
+# FETCH_CMD is the program used to fetch files for FETCH_USING=manual.
+#       It must understand fetching files located via URLs,
+#      e.g. NetBSD's ftp, net/tnftp, etc.
 #
 # The following variables are all lists of options to pass to he command
 # used to do the actual fetching of the file.
@@ -188,11 +188,6 @@
 #      to try to resume interrupted file transfers to avoid downloading
 #      the whole file.  The default is set in pkgsrc/mk/defaults/mk.conf.
 #
-#FETCH_CMD?=           ftp     # default is set by pkgsrc/mk/defaults/mk.conf
-FETCH_BEFORE_ARGS?=    ${_FETCH_BEFORE_ARGS.${FETCH_CMD:T}}
-FETCH_AFTER_ARGS?=     ${_FETCH_AFTER_ARGS.${FETCH_CMD:T}}
-FETCH_RESUME_ARGS?=    ${_FETCH_RESUME_ARGS.${FETCH_CMD:T}}
-FETCH_OUTPUT_ARGS?=    ${_FETCH_OUTPUT_ARGS.${FETCH_CMD:T}}
 
 _FETCH_BEFORE_ARGS.ftp=                # empty
 # If this host is behind a filtering firewall, use passive ftp(1)
@@ -200,34 +195,46 @@
 _FETCH_AFTER_ARGS.ftp=         # empty
 _FETCH_RESUME_ARGS.ftp=                -R
 _FETCH_OUTPUT_ARGS.ftp=                -o
+_FETCH_CMD.ftp=                        ${TOOLS_PATH.ftp}
 
 _FETCH_BEFORE_ARGS.fetch=      # empty
 _FETCH_AFTER_ARGS.fetch=       # empty
 _FETCH_RESUME_ARGS.fetch=      -r
 _FETCH_OUTPUT_ARGS.fetch=      -o
+_FETCH_CMD.fetch=              ${TOOLS_PATH.fetch}
 
 _FETCH_BEFORE_ARGS.wget=       # empty
 _FETCH_AFTER_ARGS.wget=                # empty
 _FETCH_RESUME_ARGS.wget=       -c
 _FETCH_OUTPUT_ARGS.wget=       -O
+_FETCH_CMD.wget=               ${PREFIX}/bin/wget
 
 _FETCH_BEFORE_ARGS.curl=       # empty
 _FETCH_BEFORE_ARGS.curl+=      ${PASSIVE_FETCH:D--ftp-pasv}
 _FETCH_AFTER_ARGS.curl=                -O # must be here to honor -o option
 _FETCH_RESUME_ARGS.curl=       -C -
 _FETCH_OUTPUT_ARGS.curl=       -o
+_FETCH_CMD.curl=               ${PREFIX}/bin/wget
+
+_FETCH_CMD.manual=             ${TOOLS_PATH.false}
+
+_FETCH_CMD.custom=             ${FETCH_CMD}
+_FETCH_BEFORE_ARGS.custom=     ${FETCH_BEFORE_ARGS}
+_FETCH_AFTER_ARGS.custom=      ${FETCH_AFTER_ARGS}
+_FETCH_RESUME_ARGS.custom=     ${FETCH_RESUME_ARGS}
+_FETCH_OUTPUT_ARGS.custom=     ${FETCH_OUTPUT_ARGS}
 
 _FETCH_CMD=    ${SETENV} CHECKSUM=${_CHECKSUM_CMD:Q}                   \
-                       CP=${TOOLS_CP:Q}                                \
-                       ECHO=${TOOLS_ECHO:Q}                            \
-                       FETCH_CMD=${FETCH_CMD:Q}                        \
-                       FETCH_BEFORE_ARGS=${FETCH_BEFORE_ARGS:Q}        \
-                       FETCH_AFTER_ARGS=${FETCH_AFTER_ARGS:Q}          \
-                       FETCH_RESUME_ARGS=${FETCH_RESUME_ARGS:Q}        \
-                       FETCH_OUTPUT_ARGS=${FETCH_OUTPUT_ARGS:Q}        \
-                       MKDIR=${TOOLS_MKDIR:Q} MV=${TOOLS_MV:Q}         \
-                       TEST=${TOOLS_TEST:Q} TOUCH=${TOOLS_TOUCH:Q}     \
-                       WC=${TOOLS_WC:Q}                                \
+               CP=${TOOLS_CP:Q}                                \
+               ECHO=${TOOLS_ECHO:Q}                            \
+               FETCH_CMD=${_FETCH_CMD.${FETCH_USING}:Q}        \
+               FETCH_BEFORE_ARGS=${_FETCH_BEFORE_ARGS.${FETCH_USING}:Q} \
+               FETCH_AFTER_ARGS=${_FETCH_AFTER_ARGS.${FETCH_USING}:Q}   \
+               FETCH_RESUME_ARGS=${_FETCH_RESUME_ARGS.${FETCH_USING}:Q} \
+               FETCH_OUTPUT_ARGS=${_FETCH_OUTPUT_ARGS.${FETCH_USING}:Q} \
+               MKDIR=${TOOLS_MKDIR:Q} MV=${TOOLS_MV:Q}         \
+               TEST=${TOOLS_TEST:Q} TOUCH=${TOOLS_TOUCH:Q}     \
+               WC=${TOOLS_WC:Q}                                \
                ${SH} ${PKGSRCDIR}/mk/fetch/fetch
 
 _FETCH_ARGS+=  ${PKG_VERBOSE:D-v}



Home | Main Index | Thread Index | Old Index