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

2016-07-05 Thread Ruslan Baratov via cmake-developers
On 05-Jul-16 23:26, Brad King wrote: On 07/05/2016 04:13 PM, Ruslan Baratov wrote: Works fine on my tests. Thanks for testing! However I still vote for using default value for 'fname' instead of FATAL_ERROR. I think that behavior would be surprising. Not such surprising as some error in

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

2016-07-05 Thread Brad King
On 07/05/2016 04:13 PM, Ruslan Baratov wrote: > Works fine on my tests. Thanks for testing! > However I still vote for using default value for 'fname' instead > of FATAL_ERROR. I think that behavior would be surprising. > If something bad will happen user always can use DOWNLOAD_NAME. > >

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

2016-07-05 Thread Ruslan Baratov via cmake-developers
On 05-Jul-16 22:03, Brad King wrote: On 07/01/2016 03:35 PM, Brad King wrote: I don't think we should duplicate the "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$" expression. The stripping of ?.* can be done earlier, or done as part of the main match. Please try this

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

2016-07-05 Thread Ben Boeckel
On Tue, Jul 05, 2016 at 13:46:06 -0400, Brad King wrote: > On 07/05/2016 01:31 PM, Ben Boeckel wrote: > > Here's another idea: add an `OUTPUT_FILE ` keyword argument to > > `file(DOWNLOAD)` to get the actual filename after content disposition > > resolution (probably similar for 30x rewrites).

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

2016-07-05 Thread Ben Boeckel
On Tue, Jul 05, 2016 at 21:01:36 +0300, Ruslan Baratov wrote: > Well it's never too late to learn something new. Also `tar` is not > widely used on Windows so to write nice code you should convert it to > `cmake -E tar`. That the whole point of `cmake -E` feature. > I don't see the problem here,

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

2016-07-05 Thread Ruslan Baratov via cmake-developers
On 05-Jul-16 20:31, Ben Boeckel wrote: On Tue, Jul 05, 2016 at 19:49:46 +0300, Ruslan Baratov wrote: 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).

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

2016-07-05 Thread Brad King
On 07/05/2016 01:31 PM, Ben Boeckel wrote: > Here's another idea: add an `OUTPUT_FILE ` keyword argument to > `file(DOWNLOAD)` to get the actual filename after content disposition > resolution (probably similar for 30x rewrites). This would also be > useful for things other than ExternalProject.

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

2016-07-05 Thread Ben Boeckel
On Tue, Jul 05, 2016 at 19:49:46 +0300, Ruslan Baratov wrote: > 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). CMake is not my go-to tool for

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

2016-07-05 Thread Ruslan Baratov via cmake-developers
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 -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

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

2016-07-05 Thread Ben Boeckel
On Tue, Jul 05, 2016 at 18:43:25 +0300, Ruslan Baratov wrote: > By default not, goes to -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? Though I'm partial to keeping the extension still; if I need to add a

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

2016-07-05 Thread Ben Boeckel
On Tue, Jul 05, 2016 at 16:26:54 +0300, Ruslan Baratov via cmake-developers wrote: > + # Do not put warning message here. If everything works OK it will > + # only distract. If unpack will fail the standard name can be > found in logs. > + # (see

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

2016-07-05 Thread Ruslan Baratov via cmake-developers
Got another idea. We can use default name like 'archive.tar'. Seems that internal type of archive determined automatically and doesn't depends on the filename. I've tried one example for each extension: 7z, tar.bz2, tar.gz, tar.xz, tbz2, tgz, txz, zip and it just works. Patch attached. Ruslo

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

2016-07-01 Thread Brad King
On 07/01/2016 11:48 AM, Ruslan Baratov wrote: > On 01-Jul-16 15:58, Brad King wrote: >> Please try to structure the logic right in the if/elseif part. >> Matching in those also sets `CMAKE_MATCH_*` variables so one >> does not need to double-match. > 'elseif' part try to find 'archive.tar.gz' in

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

2016-07-01 Thread Ben Boeckel
On Fri, Jul 01, 2016 at 18:48:41 +0300, Ruslan Baratov wrote: > On 01-Jul-16 16:04, Ben Boeckel wrote: > > On Fri, Jul 01, 2016 at 08:58:16 -0400, Brad King wrote: > >> Also, the `([^/]*)\\?.*` part of the regex should be more > >> like `([^/?]*)\\?.*` to avoid eagerly matching early `?`. > > This

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

2016-07-01 Thread Ruslan Baratov via cmake-developers
On 01-Jul-16 16:04, Ben Boeckel wrote: On Fri, Jul 01, 2016 at 08:58:16 -0400, Brad King wrote: Also, the `([^/]*)\\?.*` part of the regex should be more like `([^/?]*)\\?.*` to avoid eagerly matching early `?`. This should also probably skip '#' characters for URLs with anchors. --Ben

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

2016-07-01 Thread Ruslan Baratov via cmake-developers
On 01-Jul-16 15:58, Brad King wrote: On 07/01/2016 08:01 AM, Ruslan Baratov via cmake-developers wrote: With attached patch it's possible to extract name from URLs like 'https://.../archive.tar.gz?a=x=y'. Thanks. elseif(NOT "${fname}" MATCHES

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

2016-07-01 Thread Brad King
On 07/01/2016 08:01 AM, Ruslan Baratov via cmake-developers wrote: > With attached patch it's possible to extract name from URLs like > 'https://.../archive.tar.gz?a=x=y'. Thanks. > elseif(NOT "${fname}" MATCHES > "(\\.|=)(7z|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tbz2|tgz|txz|zip)$") > -

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

2016-07-01 Thread Ruslan Baratov via cmake-developers
Hi, With attached patch it's possible to extract name from URLs like 'https://.../archive.tar.gz?a=x=y'. Ruslo >From 0bab30e859541dde51e9e21d3a22ec80a649a30a Mon Sep 17 00:00:00 2001 From: Ruslan Baratov Date: Fri, 1 Jul 2016 14:55:29 +0300 Subject: [PATCH] Add