[41513] trunk/dports/devel
nox
nox at macports.org
Thu Nov 6 01:01:41 PST 2008
Le 6 nov. 08 à 03:29, Ryan Schmidt a écrit :
> On Nov 5, 2008, at 16:55, nox wrote:
>
>> Le 5 nov. 08 à 23:26, Ryan Schmidt a écrit :
>>
>>> On Nov 5, 2008, at 02:27, devans at macports.org wrote:
>>>
>>>> +master_sites ${homepage}attachment/wiki/WikiStart/
>>>> +distfiles ${distname}${extract.suffix}?format=raw
>>>
>>> Cool trick!
>>>
>>> Hmm, except for the fact that that's the filename that ends up on
>>> the user's system, and on the mirror; see:
>>>
>>> http://distfiles.macports.org/gtkimageview/
>>>
>>> See attached patch for a better solution.
>>>
>>> <gtkimageview.diff>
>>
>> By the way, shouldn't it be better to create a new variable
>> `fetchfiles` which would
>> replace the default mechanism offered with master_sites distname
>> extract.suffix and all?
>> Tricky ports like this one would just have to write the url of the
>> file(s) to fetch in `fetchfiles`.
>
> I'm not seeing how "fetchfiles" would work, in all the variations
> that we have to support (one or multiple distfiles, on one or
> multiple master sites).
>
> I'm comfortable with the workaround presented in my patch. It's used
> by several ports already. We could document it in the Guide and in
> that way make it an official recommendation for this situation (when
> downloading through a server-side script instead of just downloading
> from a server directory).
Indeed I haven't thought about how to guess the filename from the URL.
The filename should be the filename part of the url if the url is not
a list.
Otherwise if the url is a list of two elements, the fetched file
should be saved under the name in the second element of the list
For example, for the following code:
fetchfiles http://example.com/foo.tar.gz \
http://example.com/foo-doc.tar.gz?format=raw \
{http://example.com/file.php?id=42 thing-without-a-name.zip}
3 files would be fetch: foo.tar.gz, foo-doc.tar.gz and thing-without-a-
name.zip.
As the filename is written in the Portfile, curl could use it when
fetching the url to save the response under a correct filename,
regardless of the headers sent by the webserver.
More information about the macports-dev
mailing list