mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 16:22:55 +00:00
Fix download sources on SIG branches
This commit is contained in:
parent
6dcfcfba3c
commit
5754c66891
1 changed files with 15 additions and 16 deletions
|
@ -207,32 +207,31 @@ class SIGLookasideCache(CGILookasideCache):
|
||||||
|
|
||||||
It inherits most of its behavior from `pyrpkg.lookasideCGILookasideCache`.
|
It inherits most of its behavior from `pyrpkg.lookasideCGILookasideCache`.
|
||||||
"""
|
"""
|
||||||
def __init__(self, hashtype, download_url, upload_url, name, branch, structure='hash'):
|
def __init__(self, hashtype, download_url, upload_url, name, branch, structure='hash', client_cert=None, ca_cert=None):
|
||||||
super(SIGLookasideCache, self).__init__(
|
super(SIGLookasideCache, self).__init__(
|
||||||
hashtype, download_url, upload_url,
|
hashtype, download_url, upload_url, client_cert=client_cert, ca_cert=ca_cert)
|
||||||
client_cert=client_cert, ca_cert=ca_cert)
|
|
||||||
|
|
||||||
self.name = name
|
self.name = name
|
||||||
self.branch = branch
|
self.branch = branch
|
||||||
self.structure = structure
|
self.structure = structure
|
||||||
|
|
||||||
@property
|
|
||||||
def download_path(self):
|
|
||||||
if self.structure == 'hash':
|
|
||||||
return '%(name)s/%(filename)s/%(hashtype)s/%(hash)s'
|
|
||||||
return '%(name)s/%(branch)s/%(hash)s'
|
|
||||||
|
|
||||||
def get_download_url(self, name, filename, hash, hashtype=None, **kwargs):
|
def get_download_url(self, name, filename, hash, hashtype=None, **kwargs):
|
||||||
if self.structure == 'hash':
|
if self.structure == 'hash':
|
||||||
|
download_path = '%(name)s/%(branch)s/%(hash)s'
|
||||||
|
if "/" in name:
|
||||||
|
real_name = name.split("/")[-1]
|
||||||
|
else:
|
||||||
|
real_name = name
|
||||||
path_dict = {
|
path_dict = {
|
||||||
'name': name,
|
'name': real_name,
|
||||||
'filename': filename,
|
'filename': filename,
|
||||||
'hash': hash,
|
'branch': self.branch,
|
||||||
'hashtype': hashtype
|
'hash': hash,
|
||||||
|
'hashtype': hashtype
|
||||||
}
|
}
|
||||||
path = self.download_path % path_dict
|
path = download_path % path_dict
|
||||||
return os.path.join(self.download_url, path)
|
return os.path.join(self.download_url, path)
|
||||||
|
|
||||||
return super(SIGLookasideCache, self).get_download_url(name, filename, hash, hashtype, **kwargs)
|
return super(SIGLookasideCache, self).get_download_url(name, filename, hash, hashtype, **kwargs)
|
||||||
|
|
||||||
def remote_file_exists(self, name, filename, hash):
|
def remote_file_exists(self, name, filename, hash):
|
||||||
|
|
Loading…
Add table
Reference in a new issue