mirror of
https://git.centos.org/centos/centpkg.git
synced 2025-02-23 16:22:55 +00:00
centpkg-sig works pulling sources and srpm
Signed-off-by: Troy Dawson <tdawson@redhat.com>
This commit is contained in:
parent
73d52905ad
commit
6dcfcfba3c
2 changed files with 60 additions and 8 deletions
|
@ -25,7 +25,7 @@ from pyrpkg.utils import cached_property
|
||||||
|
|
||||||
# doc/centpkg_man_page.py uses the 'cli' import
|
# doc/centpkg_man_page.py uses the 'cli' import
|
||||||
from . import cli # noqa
|
from . import cli # noqa
|
||||||
from .lookaside import StreamLookasideCache, SIGLookasideCache
|
from .lookaside import StreamLookasideCache, SIGLookasideCache, CLLookasideCache
|
||||||
|
|
||||||
|
|
||||||
_DEFAULT_VERSION = '9'
|
_DEFAULT_VERSION = '9'
|
||||||
|
@ -38,6 +38,7 @@ class DistGitDirectory(object):
|
||||||
projectname = None
|
projectname = None
|
||||||
releasename = None
|
releasename = None
|
||||||
distrobranch = False
|
distrobranch = False
|
||||||
|
sigbranch = False
|
||||||
repo = None
|
repo = None
|
||||||
git_origin_substr = 'git@gitlab.com/redhat/centos-stream'
|
git_origin_substr = 'git@gitlab.com/redhat/centos-stream'
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ class DistGitDirectory(object):
|
||||||
self.centosversion = gd['major']
|
self.centosversion = gd['major']
|
||||||
elif sigmatch:
|
elif sigmatch:
|
||||||
gd = sigmatch.groupdict()
|
gd = sigmatch.groupdict()
|
||||||
|
self.sigbranch = True
|
||||||
self.signame = gd['signame']
|
self.signame = gd['signame']
|
||||||
self.centosversion = gd['centosversion']
|
self.centosversion = gd['centosversion']
|
||||||
|
|
||||||
|
@ -163,18 +165,30 @@ class Commands(Commands):
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def lookasidecache(self):
|
def lookasidecache(self):
|
||||||
if self.distgitdir.distrobranch:
|
if self.layout.sources_file_template == "sources":
|
||||||
return StreamLookasideCache(self.lookasidehash,
|
return StreamLookasideCache(self.lookasidehash,
|
||||||
self.lookaside,
|
self.lookaside,
|
||||||
self.lookaside_cgi,
|
self.lookaside_cgi,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return SIGLookasideCache(self.lookasidehash,
|
if self.distgitdir.sigbranch:
|
||||||
self.lookaside,
|
self.log.info(" Centpkg: Commands lookasidecache: SIGLookasideCache")
|
||||||
self.lookaside_cgi,
|
self.log.info(" lookaside_structure " + self.lookaside_structure)
|
||||||
self.repo_name,
|
return SIGLookasideCache(self.lookasidehash,
|
||||||
self.branch_merge,
|
self.lookaside,
|
||||||
structure=self.lookaside_structure)
|
self.lookaside_cgi,
|
||||||
|
self.repo_name,
|
||||||
|
self.branch_merge,
|
||||||
|
structure=self.lookaside_structure)
|
||||||
|
else:
|
||||||
|
self.log.info(" Centpkg: Commands lookasidecache: CLLookasideCache")
|
||||||
|
self.log.info(" lookaside_structure " + self.lookaside_structure)
|
||||||
|
return CLLookasideCache(self.lookasidehash,
|
||||||
|
self.lookaside,
|
||||||
|
self.lookaside_cgi,
|
||||||
|
self.repo_name,
|
||||||
|
self.branch_merge,
|
||||||
|
)
|
||||||
|
|
||||||
# redefined loaders
|
# redefined loaders
|
||||||
def load_rpmdefines(self):
|
def load_rpmdefines(self):
|
||||||
|
|
|
@ -168,7 +168,45 @@ class StreamLookasideCache(CGILookasideCache):
|
||||||
_name, filename, hashstr, outfile, hashtype=hashtype, **kwargs)
|
_name, filename, hashstr, outfile, hashtype=hashtype, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
class CLLookasideCache(CGILookasideCache):
|
||||||
|
"""
|
||||||
|
Centos Linux lookaside specialized class.
|
||||||
|
|
||||||
|
It inherits most of its behavior from `pyrpkg.lookasideCGILookasideCache`.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, hashtype, download_url, upload_url, name, branch):
|
||||||
|
super(CLLookasideCache, self).__init__(
|
||||||
|
hashtype, download_url, upload_url, name, branch)
|
||||||
|
self.log.info(" Centpkg: CLLookasideCache __init__")
|
||||||
|
self.name = name
|
||||||
|
self.branch = branch
|
||||||
|
|
||||||
|
def get_download_url(self, name, filename, hash, hashtype=None, **kwargs):
|
||||||
|
print(" Centpkg: CLLookasideCache get_download_url")
|
||||||
|
self.download_path='%(name)s/%(branch)s/%(hash)s'
|
||||||
|
print(" Centpkg: CLLookasideCache get_download_url download_path: " + self.download_path)
|
||||||
|
if "/" in name:
|
||||||
|
real_name = name.split("/")[-1]
|
||||||
|
else:
|
||||||
|
real_name = name
|
||||||
|
path_dict = {
|
||||||
|
'name': real_name,
|
||||||
|
'filename': filename,
|
||||||
|
'branch': self.branch,
|
||||||
|
'hash': hash,
|
||||||
|
'hashtype': hashtype
|
||||||
|
}
|
||||||
|
path = self.download_path % path_dict
|
||||||
|
return os.path.join(self.download_url, path)
|
||||||
|
|
||||||
|
|
||||||
class SIGLookasideCache(CGILookasideCache):
|
class SIGLookasideCache(CGILookasideCache):
|
||||||
|
"""
|
||||||
|
Centos SIG lookaside specialized class.
|
||||||
|
|
||||||
|
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'):
|
||||||
super(SIGLookasideCache, self).__init__(
|
super(SIGLookasideCache, self).__init__(
|
||||||
hashtype, download_url, upload_url,
|
hashtype, download_url, upload_url,
|
||||||
|
|
Loading…
Add table
Reference in a new issue