[MacPorts] howto/AvoidRedirects modified

MacPorts noreply at macports.org
Tue Aug 6 14:43:51 PDT 2013


Page "howto/AvoidRedirects" was changed by ryandesign at macports.org
Diff URL: <https://trac.macports.org/wiki/howto/AvoidRedirects?action=diff&version=4>
Revision 4
Comment: fix title; rewrite introduction; add introduction to sourceforge section about why managing redirects there is extra important; add pointer to branch variable
Changes:
-------8<------8<------8<------8<------8<------8<------8<------8<--------
Index: howto/AvoidRedirects
=========================================================================
--- howto/AvoidRedirects (version: 3)
+++ howto/AvoidRedirects (version: 4)
@@ -1,15 +1,22 @@
 [wiki:howto <- Back to the HOWTO section]
 
-= How to build Avoid master_sites Redirects  =
+= How to 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.
+`master_sites` should usually be specified in such a way that HTTP redirects are avoided.
+This not only reduces network traffic and server load but also lets the user start their download more quickly.
+This how-to currently addresses only SourceForge but similar techniques can be used for any other site.
 
 == SourceForge ==
+
+In addition to the aforementioned general reasons for avoiding redirects, it's especially important for files hosted at SourceForge.
+For all ports, MacPorts tries to download from a server near to the user (measured by ping time).
+SourceForge has a network of mirror servers, of which MacPorts maintains [browser:trunk/dports/_resources/port1.0/fetch/mirror_sites.tcl a list].
+But if the server MacPorts has chosen to use issues a redirect, it might redirect to a different server which might have a worse ping time, which we want to avoid.
 
 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  `'sourceforge'` in the portfile under development worked to retrieve the distfile.  
 
@@ -37,6 +44,8 @@
 master_sites  sourceforge:project/mediainfo/binary/mediainfo/${version}
 }}}
 
+In the event that the URL had included "0.7" (and not "0.7.60") you would want to define and employ [PortfileRecipes#branch the ${branch} variable] instead of ${version}.
+
 Pat yourself on the back--you're done!
 
 [wiki:howto <- Back to the HOWTO section]
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/howto/AvoidRedirects>
MacPorts <http://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'howto/AvoidRedirects' page.
If it was not you, please report to .


More information about the macports-changes mailing list