tech-pkg archive

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

Re: FETCH_CMD and dependencies



On Fri, Feb 06, 2009 at 04:28:59PM +0100, Joerg Sonnenberger wrote:
> On Fri, Jan 30, 2009 at 05:11:01PM +0100, Joerg Sonnenberger wrote:
> > A check in bsd.prefs.mk will bail out explicitly if FETCH_CMD is set,
> > but FETCH_USING is not manual. Is that too restrictive?
> > 
> > Do we want to have a fallback mechasnim with associated magic so that
> > fetching wget when using FETCH_USING=wget does use ftp or fetch?
> 
> Attached is a patch to implement this without the check for FETCH_CMD
> being set and without the magic to break cycles.

Patch.

Joerg
Index: defaults/mk.conf
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/mk/defaults/mk.conf,v
retrieving revision 1.180
diff -u -p -r1.180 mk.conf
--- defaults/mk.conf    29 Nov 2008 13:38:52 -0000      1.180
+++ defaults/mk.conf    6 Feb 2009 13:08:41 -0000
@@ -347,10 +347,15 @@ DEFAULT_VIEW?= ""
 # 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 
Index: fetch/bsd.fetch-vars.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/mk/fetch/bsd.fetch-vars.mk,v
retrieving revision 1.11
diff -u -p -r1.11 bsd.fetch-vars.mk
--- fetch/bsd.fetch-vars.mk     22 May 2008 20:11:55 -0000      1.11
+++ fetch/bsd.fetch-vars.mk     6 Feb 2009 15:23:57 -0000
@@ -73,9 +73,15 @@ NO_SKIP=             # defined
 _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}}
Index: fetch/fetch.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/mk/fetch/fetch.mk,v
retrieving revision 1.37
diff -u -p -r1.37 fetch.mk
--- fetch/fetch.mk      8 Oct 2008 15:39:07 -0000       1.37
+++ fetch/fetch.mk      6 Feb 2009 15:23:50 -0000
@@ -163,9 +163,9 @@ fetch-check-interactive: .USEBEFORE
 ### 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 @@ fetch-check-interactive: .USEBEFORE
 #      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_BEFORE_ARGS.ftp+=  ${PASSIVE_FETCH
 _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