[41513] trunk/dports/devel

Bryan Blackburn blb at macports.org
Wed Nov 5 20:57:52 PST 2008


On Wed, Nov 05, 2008 at 10:31:37PM -0600, Ryan Schmidt said:
> On Nov 5, 2008, at 22:22, Bryan Blackburn wrote:
>
>> On Wed, Nov 05, 2008 at 09:53:11PM -0600, Ryan Schmidt said:
>>
>>>> Perhaps a different approach could be to use just a placeholder in
>>>> master_sites:
>>>>
>>>> master_sites ${homepage}attachment/wiki/WikiStart/<file>?
>>>> format=raw&dummy=
>>>>
>>>> or something to that effect (since <> are not valid in HTTP URLs).
>>>> When no
>>>> <file> is present, append to the end like we do now.
>>>
>>> Placeholder sounds very good. I might prefer a sprintf placeholder, 
>>> like
>>> %s (% isn't valid by itself in a URL either).
>>
>> % is valid for escaping; I wanted to pick something that wouldn't  
>> otherwise
>> appear in any URL so the template-replacing code would be simpler.
>
> But %s by itself is not valid in URLs, and %s is the standard string  
> replacement placeholder for the printf function. Um, which in tcl is the 
> format function. So the replacement code is simple:
>
> [format ${url} ${distfile}]
>
> Or something like that.
>

% format "http://distfiles.macports.org/stuff/%s" "test-1.2.3.tar.gz"
http://distfiles.macports.org/stuff/test-1.2.3.tar.gz

Okay, makes sense, but

% format "http://distfiles.macports.org/stuff%20here/%s" "test-1.2.3.tar.gz"
expected floating-point number but got "test-1.2.3.tar.gz"

So if there's any % escaping, format may not be the best choice...granted
some work would have to go into using a different style as well, so it's
hard to say which is the better way to go.

Bryan



More information about the macports-dev mailing list