diff options
author | Peter Scheibel <scheibel1@llnl.gov> | 2016-03-25 18:38:26 -0700 |
---|---|---|
committer | Peter Scheibel <scheibel1@llnl.gov> | 2016-03-25 18:38:26 -0700 |
commit | 06c98320a88924234a86b038ca7d3a60a8361f8c (patch) | |
tree | f12a364c710ad6ccfa97c97c810fe27b94724597 | |
parent | bd5abb292254b40140d1b61849cb86851718b335 (diff) | |
download | spack-06c98320a88924234a86b038ca7d3a60a8361f8c.tar.gz spack-06c98320a88924234a86b038ca7d3a60a8361f8c.tar.bz2 spack-06c98320a88924234a86b038ca7d3a60a8361f8c.tar.xz spack-06c98320a88924234a86b038ca7d3a60a8361f8c.zip |
handle case where file contents change but resource name does not (e.g. if resource maintainer uses same name for each new version of a package)
-rw-r--r-- | lib/spack/spack/fetch_strategy.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/mirror.py | 5 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index b696a12e7a..9938f011d0 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -107,6 +107,8 @@ class FetchStrategy(object): def archive(self, destination): pass # Used to create tarball for mirror. + def file_hash(self): pass # Identifies the resource to be retrieved + def __str__(self): # Should be human readable URL. return "FetchStrategy.__str___" @@ -217,6 +219,10 @@ class URLFetchStrategy(FetchStrategy): """Path to the source archive within this stage directory.""" return self.stage.archive_file + @property + def file_hash(self): + return self.digest + @_needs_stage def expand(self): if not self.expand_archive: @@ -349,6 +355,10 @@ class VCSFetchStrategy(FetchStrategy): self.stage.chdir() tar('-czf', destination, os.path.basename(self.stage.source_path)) + @property + def file_hash(self): + return None + def __str__(self): return "VCS: %s" % self.url diff --git a/lib/spack/spack/mirror.py b/lib/spack/spack/mirror.py index 6981f69ac0..cb2588fb29 100644 --- a/lib/spack/spack/mirror.py +++ b/lib/spack/spack/mirror.py @@ -61,7 +61,10 @@ def mirror_archive_filename(spec, fetcher): # Otherwise we'll make a .tar.gz ourselves ext = 'tar.gz' - filename = "%s-%s" % (spec.package.name, spec.version) + tokens = [spec.package.name, spec.version] + if fetcher.file_hash: + tokens.append(fetcher.file_hash) + filename = '-'.join(str(t) for t in tokens) if ext: filename += ".%s" % ext return filename |