[cmake-developers] [patch] One more pattern for extracting file name from URL

Ruslan Baratov ruslan_baratov at yahoo.com
Tue Jul 5 12:49:46 EDT 2016


On 05-Jul-16 18:50, Ben Boeckel wrote:
> On Tue, Jul 05, 2016 at 18:43:25 +0300, Ruslan Baratov wrote:
>> By default not, goes to <project-name>-prefix/src/archive.tar .
> Right, but if a download directory is set, this won't work. Can the
> project name at least be added to the name?
If user are forcing directory then it is user's responsibility I think. 
For example GitHub releases goes without name of the project so both:

* https://github.com/ruslo/polly/archive/v0.10.1.tar.gz
* https://github.com/ruslo/hunter/archive/v0.10.1.tar.gz

will be downloaded to v0.10.1.tar.gz - this filename extracted from URL 
by CMake. In general patch made in a code branch where was FATAL_ERROR 
before, so it doesn't affect backward compatibility.

>
> Though I'm partial to keeping the extension still; if I need to add a
> patch to a project, it'd be nice if the extension weren't a lie when I
> go to extract the tarball.
Archive can be unpacked by "cmake -E tar xf" which detect type 
automatically as far as I understand. At least this one used internally 
by ExternalProject (see the testing I've made before).

Also note that in fact name of the file extracted from URL can differ 
from real:
|
 > curl --head 
https://gitlab.com/gitlab-org/gitlab-ce/repository/archive.tar.gz\?ref\=v8.9.3 
| grep file
Content-Disposition: attachment; 
filename="gitlab-ce-v8.9.3-5e546d9b4728fc9c9623992a678cbea9eb2098f1.tar.gz"|

So even if it seems that archive name is `|archive.tar.gz` it should be 
downloaded to 
`||gitlab-ce-v8.9.3-5e546d9b4728fc9c9623992a678cbea9eb2098f1.tar.gz`. So 
I think it's easily can be file with another extension.|

Ruslo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20160705/5dfffb6d/attachment.html>


More information about the cmake-developers mailing list