mirror of
https://github.com/peridotbuild/pv2.git
synced 2024-11-24 06:01:25 +00:00
add find spec file
This commit is contained in:
parent
5e9f751b67
commit
1f8e5fc3aa
@ -15,7 +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')
|
||||
parser.add_argument('--alternate-spec-name', type=str, required=False, default='', help='e.g. if kernel-rt, use kernel')
|
||||
results = parser.parse_args()
|
||||
classy = importutil.GitImport(
|
||||
results.srpm,
|
||||
|
@ -48,6 +48,25 @@ class Import:
|
||||
elif os.path.isdir(file):
|
||||
shutil.rmtree(file)
|
||||
|
||||
@staticmethod
|
||||
def find_spec_file(local_repo_path):
|
||||
"""
|
||||
Identifies the spec file in the repo. In the event there's two spec
|
||||
files, we will error out. Only one spec file is allowed per
|
||||
repo/package.
|
||||
"""
|
||||
file_list = fileutil.filter_files(
|
||||
local_repo_path,
|
||||
lambda file: file.endswith('.spec'))
|
||||
|
||||
if len(file_list) > 1:
|
||||
raise err.ConfigurationError('This repo has more than one spec file.')
|
||||
|
||||
if len(file_list) == 0:
|
||||
raise err.ConfigurationError('This repo has no spec files.')
|
||||
|
||||
return file_list[0]
|
||||
|
||||
@staticmethod
|
||||
def unpack_srpm(srpm_path, local_repo_path):
|
||||
"""
|
||||
@ -667,6 +686,9 @@ class GitImport(Import):
|
||||
generic.download_file(the_url, download_file, download_checksum,
|
||||
download_hashtype)
|
||||
|
||||
if not os.path.exists(source_git_repo_spec) and len(self.alternate_spec_name) == 0:
|
||||
source_git_repo_spec = self.find_spec_file(source_git_repo_path)
|
||||
|
||||
# attempt to pack up the RPM, get metadata
|
||||
packed_srpm = self.pack_srpm(source_git_repo_path, source_git_repo_spec, _dist_tag)
|
||||
if not packed_srpm:
|
||||
|
Loading…
Reference in New Issue
Block a user