summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Sachs <stephenmsachs@gmail.com>2022-07-26 15:05:41 +0200
committerGitHub <noreply@github.com>2022-07-26 13:05:41 +0000
commit6a240c9b392d9d519b5df14943732bd1831d25bf (patch)
tree49b272f00dfc4beaca3497ce9eb4282c1d25daa0
parent0662bbdc4342031250e464b844f98ee7313d42ca (diff)
downloadspack-6a240c9b392d9d519b5df14943732bd1831d25bf.tar.gz
spack-6a240c9b392d9d519b5df14943732bd1831d25bf.tar.bz2
spack-6a240c9b392d9d519b5df14943732bd1831d25bf.tar.xz
spack-6a240c9b392d9d519b5df14943732bd1831d25bf.zip
Fix `self.extension` for symlinks (#31743)
`self.archive_file` is (among others) a symlink to a tarball. `extension()` on a symlink will result in no extension. This patch fixes the behavior introduced in https://github.com/spack/spack/pull/31618. Co-authored-by: Stephen Sachs <stesachs@amazon.com>
-rw-r--r--lib/spack/spack/fetch_strategy.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index e52cceeaa0..4fc2d3b449 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -48,6 +48,7 @@ from llnl.util.symlink import symlink
import spack.config
import spack.error
+import spack.url
import spack.util.crypto as crypto
import spack.util.pattern as pattern
import spack.util.url as url_util
@@ -529,8 +530,9 @@ class URLFetchStrategy(FetchStrategy):
"Couldn't find archive file",
"Failed on expand() for URL %s" % self.url)
+ # TODO: replace this by mime check.
if not self.extension:
- self.extension = extension(self.archive_file)
+ self.extension = spack.url.determine_url_file_extension(self.url)
if self.stage.expanded:
tty.debug('Source already staged to %s' % self.stage.source_path)