distfiles in URL in mirror_sites.tcl

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


On 2013-02-23 15:19, Ryan Schmidt wrote:
> Can I have ${distfiles} within a URL defined in a fetch group?
> 
> I have been informed [1] by the PHP people that instead of downloading from e.g.:
> 
>   http://us2.php.net/distributions/php-5.4.12.tar.bz2
> 
> they want us to download from:
> 
>   http://us2.php.net/get/php-5.4.12.tar.bz2/from/this/mirror
> 
> But when I try to use URLs like this in mirror_sites.tcl:
> 
>   http://us2.php.net/get/${distfiles}/from/this/mirror?dummy=:nosubdir
>
> I get this error:
> 
> $ port distfiles php54
> --->  Distfiles for php54
> Error: org.macports.distfiles for port php54 returned: can't read "distfiles": no such variable

The only variables currently being allowed in an URL is ${name} and that
is due to special handling in proc portfetch::mirror_sites in
port1.0/fetch_common.tcl.

Furthermore, ${distfiles} is meant to be list of all files to be
downloaded. If a port has multiple files to be downloaded that URL would
be invalid.

Notwithstanding possible changes to base to accommodate such an URL in a
better way, I would propose to use the following:

mirror_sites.tcl:
  set portfetch::mirror_sites::sites(php) {
      http://us2.php.net/get/:nosubdir
  }

Portfile:
  distname        php-${version}
  use_bzip2       yes
  master_sites    php:[suffix ${distname}]/from/this/mirror?dummy=

If multiple files are required for a port, these could still be pinned
to a specific master_site using tags. My solution is kind of a hack, as
it abuses the subdir component, but I can't think of anything better
with the current base.

Rainer


More information about the macports-dev mailing list