diff --git a/examples/import_git.py b/examples/import_git.py index 858c852..df4c500 100644 --- a/examples/import_git.py +++ b/examples/import_git.py @@ -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() diff --git a/pv2/importer/operation.py b/pv2/importer/operation.py index 61863eb..53c4969 100644 --- a/pv2/importer/operation.py +++ b/pv2/importer/operation.py @@ -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): """