centpkg-sig works pulling sources and srpm

Signed-off-by: Troy Dawson <tdawson@redhat.com>
This commit is contained in:
Troy Dawson 2022-09-23 14:13:17 -07:00
parent 73d52905ad
commit 6dcfcfba3c
2 changed files with 60 additions and 8 deletions

View file

@ -25,7 +25,7 @@ from pyrpkg.utils import cached_property
# doc/centpkg_man_page.py uses the 'cli' import
from . import cli # noqa
from .lookaside import StreamLookasideCache, SIGLookasideCache
from .lookaside import StreamLookasideCache, SIGLookasideCache, CLLookasideCache
_DEFAULT_VERSION = '9'
@ -38,6 +38,7 @@ class DistGitDirectory(object):
projectname = None
releasename = None
distrobranch = False
sigbranch = False
repo = None
git_origin_substr = 'git@gitlab.com/redhat/centos-stream'
@ -60,6 +61,7 @@ class DistGitDirectory(object):
self.centosversion = gd['major']
elif sigmatch:
gd = sigmatch.groupdict()
self.sigbranch = True
self.signame = gd['signame']
self.centosversion = gd['centosversion']
@ -163,18 +165,30 @@ class Commands(Commands):
@cached_property
def lookasidecache(self):
if self.distgitdir.distrobranch:
if self.layout.sources_file_template == "sources":
return StreamLookasideCache(self.lookasidehash,
self.lookaside,
self.lookaside_cgi,
)
else:
if self.distgitdir.sigbranch:
self.log.info(" Centpkg: Commands lookasidecache: SIGLookasideCache")
self.log.info(" lookaside_structure " + self.lookaside_structure)
return SIGLookasideCache(self.lookasidehash,
self.lookaside,
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
def load_rpmdefines(self):

View file

@ -168,7 +168,45 @@ class StreamLookasideCache(CGILookasideCache):
_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):
"""
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'):
super(SIGLookasideCache, self).__init__(
hashtype, download_url, upload_url,