Add extension='tar.gz' option to version()#1758
Conversation
f6870c2 to
c12d685
Compare
This closes spack#1757 which provides an example of a url scheme where the version appears after the extension. Instead of extending the parsing logic to handle this case, this commit allows the user to specify their extension type. This helps Spack choose the appropriate decompressor and mirror archive filename.
c12d685 to
10a3a98
Compare
|
@scheibelp: Spack relies on I think there's probably a better way to do this if we change The only reason Spack currently cares much about extensions is that it tars up repositories that need to be mirrored. I'd like to avoid having it know too much about URL extensions if possible. Do you think this is possible? |
|
If we want to identify the compression scheme, what about something like http://stackoverflow.com/a/19120764/5828163? Decompression shouldn't be hard. We can assume zip if the file ends with .zip, otherwise assume tar and use |
I don't see how this is an issue with expected_archive_files - that function is finding the file OK, and it doesn't place any constraints on it. The issue that was coming up is that later there is an attempt to determine the file extension. I think the core issue is with url.downloaded_file_extension: what Adam suggests would make it more robust (although linux-specific). The strategy I offered here was to argue there will be cases where the extension cannot be determined so allow the user to set it up if the logic is getting in the way. Assuming tar.gz would work in this case but not if a maintainer chose to name their packages like foo.zip.1.0.3 On the side though, all the fetch strategy/resource interaction logic is hard to understand and I really want to refactor it (which is why I left this a WIP - because it makes things more complex in an already-overly-complex section) |
|
@scheibelp This came up in #1202 as well as here. I think this is a good solution for now but I really like the idea of refactoring the fetch logic. Do you have ideas about how that could be done cleanly? Packages, stages, and fetch strategies all started out life as part of |
|
@scheibelp @robertdfrench: note that in the case of #1757 I don't think that looking for @adamjstewart's suggestion of using The disadvantage is that mirrors would be invalidated when the packager changes the package URL from something non-parseable to something parseable. So in the case of MFEM, if @tzanio decided to get rid of the |
|
If you're going to refactor fetching, can you take a stab at #282 while you're at it? A majority of the Xorg/X11 packages I added ran into this same problem. It's not a big deal when running |
I'm still thinking on it. Currently tabled for other work but I'd like to get back to it by the middle of next week. |
+1 on refactoring fetch / stage logic |
Example:
version('2.0.5', '84029e969b5b37e1ba791d0572895133', extension='tar.gz')Note: this removes Package.validate_package_url, which would have to be updated in this PR but is not used so I decided to remove it instead.
This allows the user to set the extension type on a per-version basis. I was reluctant to set a Package-level extension field.
Commit message:
This closes #1757 which provides an example of a url scheme where the
version appears after the extension. Instead of extending the parsing
logic to handle this case, this commit allows the user to specify
their extension type. This helps Spack choose the appropriate
decompressor and mirror archive filename.