distfiles in URL in mirror_sites.tcl

Rainer Müller raimue at macports.org
Sun Feb 24 04:59:42 PST 2013

Keeping discussions about changes to base in a separate thread:

On 2013-02-24 13:13, Rainer Müller wrote:
> Notwithstanding possible changes to base to accommodate such an URL in a
> better way [...]

A possible way to handle file names in the middle of an URL would be to
introduce variables/placeholders in mirror URLs, which will be
substituted at the time of assembling the URL for fetching.

To handle compatibility, a URL automatically gets the distfile name
appended (current base behavior), unless the variable/placeholder
${distfile} is being used in the URL. Other variables are always replaced.

This means that use of bare special characters in master_sites would
need to be escaped twice, once for the Portfile evaluation and once more
for the variable substitution. Use of simple variables such as ${branch}
or ${version} would be okay and they are replaced at time of parsing the

There would still be some possible options open for discussion:

a) Allow all variables in mirror URLs.

b) Allow only some special variables.
   Other variables are either left unreplaced or raise an error.

c) Use special placeholders instead of variables, e.g. @distfile@,
   %{distfile} or similar strings.
   This would be similar to b), but makes more clear that not all
   variables and options are allowed to be used in this context.

With a) I have the concern that I am not sure if all variables should
always be percent encoded for use in a URL (a space character becomes
%20 and so on). With b) or c), we could have different
variables/placeholders for the encoded and unencoded strings.


More information about the macports-dev mailing list