tech-pkg archive

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

Re: Fetching files in non-standard ways



David Sainty schrieb:
> I'm not sure if you mean "download the URL itself" or "download the
> source file at the given URL"?  All the clients of this facility I can
> see are in the former case, they make a request to find the correct URL
> (minus the trailing filename, I assume based on the documentation). 
> That use doesn't solve our problem.

Sorry, my fault. I just saw the "ftp" commands and thought of
downloading the actual file.

The appended patch makes the problem disappear for me.

Roland
? mk/fetch/fetch.patch
Index: mk/fetch/fetch
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/fetch,v
retrieving revision 1.9
diff -u -p -r1.9 fetch
--- mk/fetch/fetch      4 Aug 2007 15:00:29 -0000       1.9
+++ mk/fetch/fetch      14 Sep 2008 07:16:35 -0000
@@ -43,7 +43,7 @@
 #      fetch -- fetch files via URLs
 #
 # SYNOPSIS
-#      fetch [-c] [-d dir] [-f distinfo] file site ..."
+#      fetch [-a str] [-c] [-d dir] [-f distinfo] [-r] [-v] file site ..."
 #
 # DESCRIPTION
 #      fetch will attempt to fetch the file from the list of specified
@@ -56,6 +56,8 @@
 #      no fetch action is taken.
 #
 # OPTIONS
+#      -a str  A string to be appended to every URL that is downloaded.
+#
 #      -c      Verify the checksum for the file.  If the checksum
 #              does not match, then the fetch is determined to be
 #              not successful.
@@ -118,10 +120,11 @@
 self="${0##*/}"
 
 usage() {
-       ${ECHO} 1>&2 "usage: $self [-c] [-f distinfo] [-r] file site ..."
+       ${ECHO} 1>&2 "usage: $self [-a str] [-c] [-d dir] [-f distinfo] [-r] 
[-v] file site ..."
 }
 
 # Process optional arguments
+append_to_url=
 checksum=
 distinfo=
 fetchdir=.                     # A relative directory or "."
@@ -129,6 +132,7 @@ resume=
 verbose=
 while ${TEST} $# -gt 0; do
        case "$1" in
+       -a)     append_to_url="$2"; shift 2 ;;
        -c)     checksum=yes; shift ;;
        -d)     fetchdir="$2"; shift 2 ;;
        -f)     distinfo="$2"; shift 2 ;;
@@ -260,9 +264,9 @@ while ${TEST} $# -gt 0; do
 
        ( cd $fetchdir
          if ${TEST} -n "$resume"; then
-               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} 
${FETCH_RESUME_ARGS} ${FETCH_OUTPUT_ARGS} $outputfile $site$file"
+               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} 
${FETCH_RESUME_ARGS} ${FETCH_OUTPUT_ARGS} $outputfile $site$file$append_to_url"
          else
-               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} $site$file 
${FETCH_AFTER_ARGS}"
+               fetch_cmd="${FETCH_CMD} ${FETCH_BEFORE_ARGS} 
${FETCH_OUTPUT_ARGS} $outputfile $site$file$append_to_url ${FETCH_AFTER_ARGS}"
          fi
          ${TEST} -z "$verbose" || ${ECHO} "$fetch_cmd"
          $fetch_cmd )
Index: mk/fetch/fetch.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/fetch/fetch.mk,v
retrieving revision 1.34
diff -u -p -r1.34 fetch.mk
--- mk/fetch/fetch.mk   22 May 2008 16:27:22 -0000      1.34
+++ mk/fetch/fetch.mk   14 Sep 2008 07:16:35 -0000
@@ -229,6 +229,9 @@ _FETCH_ARGS+=       -r
 .if defined(DIST_SUBDIR) && !empty(DIST_SUBDIR)
 _FETCH_ARGS+=  -d ${DIST_SUBDIR}
 .endif
+.if ${FETCH_APPEND_TO_URL:U} != ""
+_FETCH_ARGS+=  -a ${FETCH_APPEND_TO_URL:Q}
+.endif
 
 .PHONY: do-fetch-file
 do-fetch-file: .USE
Index: graphics/gtkimageview/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/gtkimageview/Makefile,v
retrieving revision 1.4
diff -u -p -r1.4 Makefile
--- graphics/gtkimageview/Makefile      1 Sep 2008 14:31:53 -0000       1.4
+++ graphics/gtkimageview/Makefile      14 Sep 2008 07:16:35 -0000
@@ -3,9 +3,7 @@
 DISTNAME=      gtkimageview-1.6.1
 PKGREVISION=   1
 CATEGORIES=    graphics
-# See http://trac.bjourne.webfactional.com/ticket/27
-# MASTER_SITES=        
http://trac.bjourne.webfactional.com/attachment/wiki/WikiStart/broken
-MASTER_SITES=  http://www.lexort.com/pkgsrc/distfiles/
+MASTER_SITES=  http://trac.bjourne.webfactional.com/attachment/wiki/WikiStart/
 # This package has no NEWS, and it is very difficult to find the summary of 
changes.
 # See http://trac.bjourne.webfactional.com/ticket/28 in which the author points
 # to the following URL for the content that would normally be in NEWS:
@@ -15,6 +13,7 @@ MAINTAINER=   gdt%NetBSD.org@localhost
 HOMEPAGE=      http://trac.bjourne.webfactional.com/
 COMMENT=       Image viewer widget for GTK
 
+FETCH_APPEND_TO_URL=   ?format=raw
 GNU_CONFIGURE= yes
 USE_LIBTOOL=   yes
 USE_TOOLS+=    gmake pkg-config


Home | Main Index | Thread Index | Old Index