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,30 +207,29 @@ class SIGLookasideCache(CGILookasideCache):
|
|||
|
||||
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__(
|
||||
hashtype, download_url, upload_url,
|
||||
client_cert=client_cert, ca_cert=ca_cert)
|
||||
hashtype, download_url, upload_url, client_cert=client_cert, ca_cert=ca_cert)
|
||||
|
||||
self.name = name
|
||||
self.branch = branch
|
||||
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):
|
||||
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 = {
|
||||
'name': name,
|
||||
'filename': filename,
|
||||
'hash': hash,
|
||||
'hashtype': hashtype
|
||||
'name': real_name,
|
||||
'filename': filename,
|
||||
'branch': self.branch,
|
||||
'hash': hash,
|
||||
'hashtype': hashtype
|
||||
}
|
||||
path = self.download_path % path_dict
|
||||
path = download_path % path_dict
|
||||
return os.path.join(self.download_url, path)
|
||||
|
||||
return super(SIGLookasideCache, self).get_download_url(name, filename, hash, hashtype, **kwargs)
|
||||
|
|
Loading…
Add table
Reference in a new issue