Metadata updates (part 3)

* Allow multiple repos in a single command with comma separation
* Add metadata paths for pungi-like composeinfo.json
This commit is contained in:
Louis Abel 2022-10-14 22:29:09 -07:00
parent dea32e0fd0
commit da3901d742
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
3 changed files with 40 additions and 16 deletions

View File

@ -10,9 +10,13 @@ from empanadas.util import RepoSync
parser = argparse.ArgumentParser(description="Peridot Sync and Compose")
# All of our options
parser.add_argument('--release', type=str, help="Major Release Version or major-type (eg 9-beta)", required=True)
parser.add_argument('--repo', type=str, help="Repository name")
parser.add_argument('--arch', type=str, help="Architecture")
parser.add_argument('--release',
type=str,
help="Major Release Version or major-type (eg 9-beta)",
required=True
)
parser.add_argument('--repo', type=str, help="Repository name (comma separated list allowed)")
parser.add_argument('--arch', type=str, help="Architecture (comma separated list allowed)")
parser.add_argument('--ignore-debug', action='store_true')
parser.add_argument('--ignore-source', action='store_true')
parser.add_argument('--repoclosure', action='store_true')

View File

@ -354,13 +354,13 @@ class RepoSync:
arches_to_sync = self.arches
if arch:
sync_single_arch = True
arches_to_sync = [arch]
arches_to_sync = arch.split(',')
sync_single_repo = False
repos_to_sync = self.repos
if repo and not self.fullrun:
sync_single_repo = True
repos_to_sync = [repo]
repos_to_sync = repo.split(',')
for r in repos_to_sync:
entry_name_list = []
@ -907,7 +907,7 @@ class RepoSync:
# TODO: Add in each repo and their corresponding arch.
productmd_date = self.date_stamp.split('.')[0]
Shared.composeinfo_write(
metadata_dir + '/composeinfo',
sync_root,
self.distname,
self.shortname,
self.fullversion,
@ -941,11 +941,11 @@ class RepoSync:
arches_to_tree = self.arches
if arch:
arches_to_tree = [arch]
arches_to_tree = arch.split(',')
repos_to_tree = self.repos
if repo and not self.fullrun:
repos_to_tree = [repo]
repos_to_tree = repo.split(',')
# If a treeinfo or discinfo file exists, it should be skipped.
for r in repos_to_tree:
@ -1270,11 +1270,11 @@ class RepoSync:
arches_to_tree = self.arches
if arch:
arches_to_tree = [arch]
arches_to_tree = arch.split(',')
repos_to_tree = self.repos
if repo and not self.fullrun:
repos_to_tree = [repo]
repos_to_tree = repo.split(',')
for r in repos_to_tree:
entry_name_list = []
@ -1976,7 +1976,7 @@ class SigRepoSync:
repos_to_sync = self.sigrepos
if repo and not self.fullrun:
repos_to_sync = [repo]
repos_to_sync = repo.split(',')
for r in repos_to_sync:
entry_name_list = []
@ -1987,7 +1987,7 @@ class SigRepoSync:
# we have to pass it with a warning.
arch_sync = self.sigvars['repo'][r]['allowed_arches'].copy()
if arch:
arch_sync = [arch]
arch_sync = arch.split(',')
for a in arch_sync:
entry_name = '{}-{}'.format(r, a)
@ -2304,7 +2304,7 @@ class SigRepoSync:
# TODO: Add in each repo and their corresponding arch.
productmd_date = self.date_stamp.split('.')[0]
Shared.composeinfo_write(
metadata_dir + '/composeinfo',
sync_root,
self.distname,
self.shortname,
self.fullversion,

View File

@ -950,7 +950,7 @@ class Shared:
@staticmethod
def composeinfo_write(
file_path,
compose_path,
distname,
shortname,
release,
@ -965,8 +965,10 @@ class Shared:
arches and repos may be better suited for a dictionary. that is a
future thing we will work on for 0.5.0.
"""
cijson = file_path + '.json'
ciyaml = file_path + '.yaml'
metadata_dir = compose_path + '/metadata'
composeinfo_path = metadata_dir + '/composeinfo'
cijson = composeinfo_path + '.json'
ciyaml = composeinfo_path + '.yaml'
ci = productmd.composeinfo.ComposeInfo()
ci.release.name = distname
ci.release.short = shortname
@ -985,6 +987,24 @@ class Shared:
variant_repo.name = repo
variant_repo.type = "variant"
variant_repo.arches = set(arches)
# directories...
# if the repo is BaseOS, set the "isos" to isos/ARCH
for arch in variant_repo.arches:
variant_repo.paths.os_tree[arch] = repo + "/" + arch + "/os"
variant_repo.paths.repository[arch] = repo + "/" + arch + "/os"
variant_repo.paths.packages[arch] = repo + "/" + arch + "/os/Packages"
# Debug
variant_repo.paths.debug_packages[arch] = repo + "/" + arch + "/debug/tree/Packages"
variant_repo.paths.debug_repository[arch] = repo + "/" + arch + "/debug/tree"
variant_repo.paths.debug_tree[arch] = repo + "/" + arch + "/debug/tree"
# Source
variant_repo.paths.source_packages[arch] = repo + "/source/tree/Packages"
variant_repo.paths.source_repository[arch] = repo + "/source/tree"
variant_repo.paths.source_tree[arch] = repo + "/source/tree"
if "BaseOS" or "Minimal" in repo:
variant_repo.paths.isos[arch] = "isos/" + arch
variant_repo.paths.images[arch] = "images/" + arch
ci.variants.add(variant_repo)