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)
This commit is contained in:
parent
bd5abb2922
commit
06c98320a8
@ -107,6 +107,8 @@ def reset(self): pass # Revert to freshly downloaded state.
|
||||
|
||||
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 @@ def archive_file(self):
|
||||
"""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 @@ def archive(self, destination, **kwargs):
|
||||
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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user