Changes between Initial Version and Version 1 of howto/AvoidRedirects


Ignore:
Timestamp:
Oct 21, 2012, 6:32:51 PM (12 years ago)
Author:
ctreleaven (Craig Treleaven)
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • howto/AvoidRedirects

    v1 v1  
     1[wiki:howto <- Back to the HOWTO section]
     2
     3= How to build Avoid master_sites Redirects  =
     4
     5 * Audience: Portfile authors
     6 * Requires: MacPorts >=2.0
     7
     8== Introduction ==
     9
     10In order to be a good 'Net citizen, it is worthwhile to minimize the load on other's servers.  One simple technique is to specify the `master_sites` parameter as specifically as possible so that the other side does not have to supply redirects in order to serve the file we want.  This how-to currently addresses only SourceForge.
     11
     12== SourceForge ==
     13
     14Hopefully, the following example, using mediainfo version 0.7.60, will illuminate the process.  The SourceForge home page for mediainfo is [[http://mediainfo.sourceforge.net]].  Initially, just specifying  `'master_sites  sourceforge'` in the portfile under development worked to retrieve the distfile.  The log for `'port fetch'` showed:
     15
     16{{{
     17DEBUG: Executing org.macports.fetch (mediainfo)
     18--->  MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2 doesn't seem to exist in /opt/local/var/macports/distfiles/mediainfo
     19--->  Attempting to fetch MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2 from http://iweb.dl.sourceforge.net/mediainfo
     20}}}
     21
     22Use 'curl -IL !http://iweb.dl.sourceforge.net/mediainfo/MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2' to check for redirects.  In this case the output indicated redirects to a final address of:
     23
     24{{{
     25Location: http://voxel.dl.sourceforge.net/project/mediainfo/binary/mediainfo/0.7.60/MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2
     26}}}
     27
     28To improve the `master_sites` parameter, extract the bit: `project/mediainfo/binary/mediainfo/0.7.60` (and replace "0.7.60"--the version number in this case--with ${version}).  Thus `'master_sites sourceforge:project/mediainfo/binary/mediainfo/${version}'`.
     29
     30Pat yourself on the back--you're done!
     31
     32
     33
     34[wiki:howto <- Back to the HOWTO section]