[wiki:howto <- Back to the HOWTO section] = How to build Avoid master_sites Redirects = * Audience: Portfile authors * Requires: MacPorts >=2.0 == Introduction == In 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. == SourceForge == Hopefully, 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: {{{ DEBUG: Executing org.macports.fetch (mediainfo) ---> MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2 doesn't seem to exist in /opt/local/var/macports/distfiles/mediainfo ---> Attempting to fetch MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2 from http://iweb.dl.sourceforge.net/mediainfo }}} Use '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: {{{ Location: http://voxel.dl.sourceforge.net/project/mediainfo/binary/mediainfo/0.7.60/MediaInfo_CLI_0.7.60_GNU_FromSource.tar.bz2 }}} To 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}'`. Pat yourself on the back--you're done! [wiki:howto <- Back to the HOWTO section]