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%dtsp.co.nz@localhost schrieb:
> The MASTER site may need this appended, but f.n.o (for example, but
> any other mirror too) should retain the file without the appended
> string.  So, whatever the fix it needs to be linked to individual
> download URLs.

You're right. Next try, which is a bit ugly: If a MASTER_SITE contains
%s, it is replaced by the filename, otherwise the filename is appended
to it.

It loses the property that concat(MASTER_SITE, filename) is the complete
URL of the distfile.

Roland

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 08:23:12 -0000
@@ -43,7 +43,7 @@
 #      fetch -- fetch files via URLs
 #
 # SYNOPSIS
-#      fetch [-c] [-d dir] [-f distinfo] file site ..."
+#      fetch [-c] [-d dir] [-f distinfo] [-r] [-v] file site ..."
 #
 # DESCRIPTION
 #      fetch will attempt to fetch the file from the list of specified
@@ -118,7 +118,7 @@
 self="${0##*/}"
 
 usage() {
-       ${ECHO} 1>&2 "usage: $self [-c] [-f distinfo] [-r] file site ..."
+       ${ECHO} 1>&2 "usage: $self [-c] [-d dir] [-f distinfo] [-r] [-v] file 
site ..."
 }
 
 # Process optional arguments
@@ -259,10 +259,14 @@ while ${TEST} $# -gt 0; do
        site="$1"; shift
 
        ( cd $fetchdir
+         case $site in
+         *%s*) url=`echo "$site" | sed "s/%s/$outputfile/"` ;;
+         *)    url="$site$file" ;;
+         esac
          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 $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 $url ${FETCH_AFTER_ARGS}"
          fi
          ${TEST} -z "$verbose" || ${ECHO} "$fetch_cmd"
          $fetch_cmd )
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 08:23:12 -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/%s?format=raw
 # 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:


Home | Main Index | Thread Index | Old Index