Open paulmelis opened 7 years ago
@paulmelis It seems like you got things backwards... download_filename
is the name of the file under which it can be downloaded, filename
is the name of the file that EasyBuild should store it with. So you got the values reversed?
Right, it seems I indeed got the arguments switched. Flipping them indeed succeeds in downloading.
I also think I understand why my mistake happened. In the normal case (when the filename in the URL has an extension and so can be unpacked) you only specify the mandatory filename
value, which together with source_urls
specifies the URL to use and also the name to save to. In the case where the URL doesn't contain a file extension the optional extra argument download_filename
in my mind specified the name under which to save the file locally, as the URL part is already covered by filename
and I only need to specify the exception. But in the latter case filename
changes meaning in that it has nothing to do with the URL anymore and you need to switch to download_filename
for that part. So, that turned out (for me) to be somewhat non-intuitive.
I actually still don't understand that this works, as the comment above on obtain_file()
still holds: download_filename
isn't used when filename
is a URL. But I'm a bit tired and might not be clear enough at the moment to figure this out.
@paulmelis Your point is still valid about download_filename
not being used when the source filename being provided is a URL by itself.
This relates to a use case like this, where source_urls
is not used at all:
sources = ['http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz']
We don't use this in the central easyconfig repository though...
So, how would we take download_filename
into account there? I don't think it would make much sense, since you are already explicitly specifying the filename you are downloading with?
W.r.t. your comment about the semantics of filename
changing if download_filename
is specified: I see it differently... The filename
value indicates the filename that EasyBuild should use to i) store the file, ii) look for the file later (before trying to download it). By default, that's also the filename to use when downloading the file, unless download_filename
is specified...
According to http://easybuild.readthedocs.io/en/latest/Writing_easyconfig_files.html#alternative-formats-for-sources it should be possible to use the key
download_filename
in a sources dict to specify the file name to which a downloaded file is saved.But looking at
EasyBlock.obtain_file()
(https://github.com/easybuilders/easybuild-framework/blob/c1dabed9d6882f34f351f754bcd529b5a0b5f5a7/easybuild/framework/easyblock.py#L554) the parameterdownload_filename
isn't used in case the source comes from a URL. This matches the behaviour I'm seeing with EB 3.4.0: the fetched file isn't renamed and unpacking fails because it doesn't have an extension:EB config to reproduce: