feature: allow alternate_spec_name for kernel-rt and scl pkgs

This commit is contained in:
Louis Abel 2023-07-10 22:33:56 -07:00
parent dcf9aee5cf
commit 5e9f751b67
Signed by: label
GPG Key ID: 3331F061D1D9990E
2 changed files with 15 additions and 1 deletions

View File

@ -15,6 +15,7 @@ parser.add_argument('--dest-branch', type=str, required=False, default='')
parser.add_argument('--release', type=str, required=False, default='')
parser.add_argument('--distprefix', type=str, required=False, default='el')
parser.add_argument('--upstream-lookaside', type=str, required=True)
parser.add_argument('--alternate-spec-name', type=str, required=False, default='', description='e.g. if kernel-rt, use kernel')
results = parser.parse_args()
classy = importutil.GitImport(
results.srpm,
@ -26,7 +27,8 @@ classy = importutil.GitImport(
branch=results.branch,
dest_branch=results.dest_branch,
upstream_lookaside=results.upstream_lookaside,
distprefix=results.distprefix
distprefix=results.distprefix,
alternate_spec_name=results.alternate_spec_name
)
classy.pkg_import()

View File

@ -514,6 +514,7 @@ class GitImport(Import):
upstream_lookaside: str,
scl_mode: bool = False,
scl_package: str = '',
alternate_spec_name: str = '',
dest_lookaside: str = '/var/www/html/sources',
source_git_protocol: str = 'https',
dest_branch: str = '',
@ -539,6 +540,7 @@ class GitImport(Import):
self.__dest_lookaside = dest_lookaside
self.__upstream_lookaside = upstream_lookaside
self.__upstream_lookaside_url = self.get_lookaside_template_path(upstream_lookaside)
self.__alternate_spec_name = alternate_spec_name
if len(dest_branch) > 0:
self.__dest_branch = dest_branch
@ -570,6 +572,9 @@ class GitImport(Import):
if not check_source_repo:
raise err.GitInitError('Upstream git repo does not exist')
if len(self.alternate_spec_name) > 0:
source_git_repo_spec = f'{source_git_repo_path}/{self.alternate_spec_name}.spec'
# If the source branch has "stream" in the name, it should be assumed
# it'll be a module. Since this should always be the case, we'll change
# dest_branch to be: {dest_branch}-stream-{stream_name}
@ -732,6 +737,13 @@ class GitImport(Import):
new_name = self.__rpm.replace('+', 'plus')
return new_name
@property
def alternate_spec_name(self):
"""
Returns the actual name of the spec file if it's not the package name.
"""
return self.__alternate_spec_name
@property
def source_branch(self):
"""