WIP: support running toolkit against staging in addition to Peridot

This commit is contained in:
Neil Hanlon 2024-10-03 17:04:00 -04:00
parent 8b643fd566
commit 364e92dcb8
Signed by untrusted user: neil
GPG Key ID: 705BC21EC3C70F34
5 changed files with 46 additions and 19 deletions

View File

@ -65,6 +65,7 @@ config = {
"category_stub": "mirror/pub/rocky", "category_stub": "mirror/pub/rocky",
"sig_category_stub": "mirror/pub/sig", "sig_category_stub": "mirror/pub/sig",
"repo_base_url": "https://yumrepofs.build.resf.org/v1/projects", "repo_base_url": "https://yumrepofs.build.resf.org/v1/projects",
"staging_base_url": "https://dl.rockylinux.org/stg/rocky",
"mock_work_root": "/builddir", "mock_work_root": "/builddir",
"container": "centos:stream9", "container": "centos:stream9",
"distname": "Rocky Linux", "distname": "Rocky Linux",

View File

@ -2,8 +2,7 @@
import argparse import argparse
from empanadas.common import * from empanadas.common import config, rldict
from empanadas.util import Checks
from empanadas.util import IsoBuild from empanadas.util import IsoBuild
parser = argparse.ArgumentParser(description="ISO Compose") parser = argparse.ArgumentParser(description="ISO Compose")
@ -29,5 +28,6 @@ a = IsoBuild(
logger=results.logger, logger=results.logger,
) )
def run(): def run():
a.run() a.run()

View File

@ -33,6 +33,7 @@ parser.add_argument('--logger', type=str)
parser.add_argument('--disable-gpg-check', action='store_false') parser.add_argument('--disable-gpg-check', action='store_false')
parser.add_argument('--disable-repo-gpg-check', action='store_false') parser.add_argument('--disable-repo-gpg-check', action='store_false')
parser.add_argument('--clean-old-packages', action='store_true') parser.add_argument('--clean-old-packages', action='store_true')
parser.add_argument('--use-staging', action='store_true')
# Parse them # Parse them
results = parser.parse_args() results = parser.parse_args()
@ -64,6 +65,7 @@ a = RepoSync(
gpg_check=results.disable_gpg_check, gpg_check=results.disable_gpg_check,
repo_gpg_check=results.disable_repo_gpg_check, repo_gpg_check=results.disable_repo_gpg_check,
reposync_clean_old=results.clean_old_packages, reposync_clean_old=results.clean_old_packages,
use_staging=results.use_staging,
) )
def run(): def run():

View File

@ -62,7 +62,9 @@ class RepoSync:
fpsync: bool = False, fpsync: bool = False,
logger=None, logger=None,
log_level='INFO', log_level='INFO',
): use_staging: bool = False,
):
self.nofail = nofail self.nofail = nofail
self.dryrun = dryrun self.dryrun = dryrun
self.fullrun = fullrun self.fullrun = fullrun
@ -80,11 +82,14 @@ class RepoSync:
# This makes it so every repo is synced at the same time. # This makes it so every repo is synced at the same time.
# This is EXTREMELY dangerous. # This is EXTREMELY dangerous.
self.just_pull_everything = just_pull_everything self.just_pull_everything = just_pull_everything
# Use staging url instead of pulling from peridot (or, for EL8)
self.use_staging = use_staging
# Relevant config items # Relevant config items
self.major_version = major self.major_version = major
self.date_stamp = config['date_stamp'] self.date_stamp = config['date_stamp']
self.timestamp = time.time() self.timestamp = time.time()
self.repo_base_url = config['repo_base_url'] self.repo_base_url = config['repo_base_url']
self.staging_base_url = config['staging_base_url']
self.compose_root = config['compose_root'] self.compose_root = config['compose_root']
self.compose_base = config['compose_root'] + "/" + major self.compose_base = config['compose_root'] + "/" + major
self.profile = rlvars['profile'] self.profile = rlvars['profile']
@ -271,7 +276,9 @@ class RepoSync:
self.gpg_check, self.gpg_check,
self.repo_gpg_check, self.repo_gpg_check,
self.tmplenv, self.tmplenv,
self.log self.log,
staging_base_url=self.staging_base_url,
use_staging=self.use_staging,
) )
if self.dryrun: if self.dryrun:
@ -1447,7 +1454,8 @@ class RepoSync:
self.gpg_check, self.gpg_check,
self.repo_gpg_check, self.repo_gpg_check,
self.tmplenv, self.tmplenv,
self.log self.log,
staging_base_url=self.staging_base_url,
) )

View File

@ -446,8 +446,10 @@ class Shared:
repo_gpg_check, repo_gpg_check,
templates, templates,
logger, logger,
dest_path='/var/tmp' dest_path='/var/tmp',
) -> str: staging_base_url='https://dl.rockylinux.org/stg',
use_staging=False,
) -> str:
""" """
Generates the necessary repo conf file for the operation. This repo Generates the necessary repo conf file for the operation. This repo
file should be temporary in nature. This will generate a repo file file should be temporary in nature. This will generate a repo file
@ -475,22 +477,36 @@ class Shared:
if not os.path.exists(dest_path): if not os.path.exists(dest_path):
os.makedirs(dest_path, exist_ok=True) os.makedirs(dest_path, exist_ok=True)
config_file = open(fname, "w+") config_file = open(fname, "w+")
repolist = [] repolist = []
for repo in repos: for repo in repos:
constructed_url = '{}/{}/repo/{}{}/$basearch'.format( if use_staging:
repo_base_url, constructed_url = '{}/{}/{}/$basearch/os'.format(
project_id, staging_base_url,
prehashed, major_version,
repo, repo,
) )
constructed_url_src = '{}/{}/repo/{}{}/src'.format( constructed_url_src = '{}/{}/{}/source/tree'.format(
repo_base_url, staging_base_url,
project_id, major_version,
prehashed, repo,
repo, )
) else:
constructed_url = '{}/{}/repo/{}{}/$basearch'.format(
repo_base_url,
project_id,
prehashed,
repo,
)
constructed_url_src = '{}/{}/repo/{}{}/src'.format(
repo_base_url,
project_id,
prehashed,
repo,
)
repodata = { repodata = {
'name': repo, 'name': repo,