add modularitylabel support

This commit is contained in:
Louis Abel 2023-06-28 14:43:14 -07:00
parent 06b4e59d9d
commit 60e197c9e1
Signed by: label
GPG Key ID: 3331F061D1D9990E
2 changed files with 14 additions and 1 deletions

View File

@ -114,7 +114,7 @@ class Import:
else: else:
shutil.move(src=source_path, dst=dest_path) shutil.move(src=source_path, dst=dest_path)
if os.path.exists('/usr/sbin/restorecon'): if os.path.exists('/usr/sbin/restorecon'):
processor.run_proc_foreground_shell('/usr/sbin/restorecon {dest_path}') processor.run_proc_foreground_shell(f'/usr/sbin/restorecon {dest_path}')
class SrpmImport(Import): class SrpmImport(Import):
""" """
@ -178,6 +178,13 @@ class SrpmImport(Import):
git_repo_path = f'/var/tmp/{self.rpm_name}' git_repo_path = f'/var/tmp/{self.rpm_name}'
branch = self.__branch branch = self.__branch
repo_tags = [] repo_tags = []
# We need to determine if this package has a modularity label. If it
# does, we need to augment the branch name.
if len(self.__srpm_metadata['modularitylabel']) > 0:
stream_version = self.__srpm_metadata['modularitylabel'].split(':')[1]
branch = f'{self.__branch}-stream-{stream_version}'
# If we return None, we need to assume that this is a brand new repo, # If we return None, we need to assume that this is a brand new repo,
# so we will try to set it up accordingly. If we return refs, we'll see # so we will try to set it up accordingly. If we return refs, we'll see
# if the branch we want to work with exists. If it does not exist, # if the branch we want to work with exists. If it does not exist,

View File

@ -184,6 +184,11 @@ def get_rpm_metadata_from_hdr(hdr) -> dict:
if not found_epoch: if not found_epoch:
found_epoch = '' found_epoch = ''
# This avoids the modularity label being None or 'None' in the dict.
found_modularitylabel = header_data[rpm.RPMTAG_MODULARITYLABEL]
if not found_modularitylabel:
found_modularitylabel = ''
metadata = { metadata = {
'changelog_xml': changelog_result, 'changelog_xml': changelog_result,
'files': file_stuff['file'], 'files': file_stuff['file'],
@ -205,6 +210,7 @@ def get_rpm_metadata_from_hdr(hdr) -> dict:
'release': generic.to_unicode(header_data[rpm.RPMTAG_RELEASE]), 'release': generic.to_unicode(header_data[rpm.RPMTAG_RELEASE]),
'epoch': found_epoch, 'epoch': found_epoch,
'arch': pkg_arch, 'arch': pkg_arch,
'modularitylabel': found_modularitylabel,
'signature': header_data[rpm.RPMTAG_RSAHEADER], 'signature': header_data[rpm.RPMTAG_RSAHEADER],
} }
for key, rpmkey, in (('archivesize', rpm.RPMTAG_ARCHIVESIZE), for key, rpmkey, in (('archivesize', rpm.RPMTAG_ARCHIVESIZE),