From 420aa02bdbfae0dd97c711e7d5137c59c13f9437 Mon Sep 17 00:00:00 2001 From: nazunalika Date: Sat, 21 May 2022 23:20:15 -0700 Subject: [PATCH] Final commit for 5/21 --- iso/py/README.md | 4 +- iso/py/common.py | 16 +-- iso/py/configs/el8.yaml | 4 +- iso/py/configs/el9.yaml | 4 +- iso/py/sync-all-peridot | 13 --- iso/py/sync-from-peridot | 18 ++++ iso/py/util/dnf_utils.py | 221 +++++++++++++++++++++++++++++++++++---- 7 files changed, 233 insertions(+), 47 deletions(-) delete mode 100755 iso/py/sync-all-peridot create mode 100755 iso/py/sync-from-peridot diff --git a/iso/py/README.md b/iso/py/README.md index 90d0f63..2e90592 100644 --- a/iso/py/README.md +++ b/iso/py/README.md @@ -4,8 +4,8 @@ * sync-variant-pungi * sync-variant-peridot -* sync-all-pungi -* sync-all-peridot +* sync-from-pungi +* sync-from-peridot * sync-sig * build-all-iso * sign-repos-only diff --git a/iso/py/common.py b/iso/py/common.py index 3a2a6d4..b36c728 100644 --- a/iso/py/common.py +++ b/iso/py/common.py @@ -25,12 +25,13 @@ rldict = {} config = { "rlmacro": rpm.expandMacro('%rhel'), "arch": platform.machine(), - "date_stamp": time.strftime("%Y%m%d", time.localtime()), + "date_stamp": time.strftime("%Y%m%d.%H%M%S", time.localtime()), + "compose_root": "/mnt/compose", "staging_root": "/mnt/repos-staging", "production_root": "/mnt/repos-production", - "category_stub": "/mirror/pub/rocky", - "sig_category_stub": "/mirror/pub/sig", - "repo_base_url": "https://yumrepofs.build.resf.org/v1/projects/" + "category_stub": "mirror/pub/rocky", + "sig_category_stub": "mirror/pub/sig", + "repo_base_url": "https://yumrepofs.build.resf.org/v1/projects" } # Importing the config from yaml @@ -39,7 +40,7 @@ for conf in glob.iglob('configs/*.yaml'): rldict.update(yaml.safe_load(file)) # The system needs to be a RHEL-like system. It cannot be Fedora or SuSE. -#if "%rhel" in config['RLMACRO']: +#if "%rhel" in config['rlmacro']: # raise SystemExit(Color.BOLD + 'This is not a RHEL-like system.' + Color.END # + '\n\nPlease verify you are running on a RHEL-like system that is ' # 'not Fedora nor SuSE. This means that the %rhel macro will be ' @@ -49,7 +50,6 @@ for conf in glob.iglob('configs/*.yaml'): # These will be set in their respective var files #REVISION = rlvars['revision'] + '-' + rlvars['rclvl'] -#rlvars = rldict[RLVER] -#rlvars = rldict[RLMACRO] -#COMPOSE_ROOT = "/mnt/compose/" + RLVER +#rlvars = rldict[rlver] +#rlvars = rldict[rlmacro] #COMPOSE_ISO_WORKDIR = COMPOSE_ROOT + "work/" + arch + "/" + date_stamp diff --git a/iso/py/configs/el8.yaml b/iso/py/configs/el8.yaml index 67e0701..fa070d2 100644 --- a/iso/py/configs/el8.yaml +++ b/iso/py/configs/el8.yaml @@ -18,9 +18,9 @@ all_repos: - 'BaseOS' - 'AppStream' + - 'PowerTools' - 'HighAvailability' - 'ResilientStorage' - - 'PowerTools' - 'RT' - 'NFV' - 'extras' @@ -35,9 +35,9 @@ comps_or_groups: - 'BaseOS' - 'AppStream' + - 'PowerTools' - 'HighAvailability' - 'ResilientStorage' - - 'PowerTools' - 'RT' - 'NFV' has_modules: diff --git a/iso/py/configs/el9.yaml b/iso/py/configs/el9.yaml index c43ae84..fa4911d 100644 --- a/iso/py/configs/el9.yaml +++ b/iso/py/configs/el9.yaml @@ -22,9 +22,9 @@ - 'all' - 'BaseOS' - 'AppStream' + - 'CRB' - 'HighAvailability' - 'ResilientStorage' - - 'CRB' - 'RT' - 'NFV' - 'SAP' @@ -40,9 +40,9 @@ comps_or_groups: - 'BaseOS' - 'AppStream' + - 'CRB' - 'HighAvailability' - 'ResilientStorage' - - 'CRB' - 'RT' - 'NFV' - 'SAP' diff --git a/iso/py/sync-all-peridot b/iso/py/sync-all-peridot deleted file mode 100755 index 97820be..0000000 --- a/iso/py/sync-all-peridot +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env python3 - -from common import * -import argparse -from util import Checks -from util import RepoSync - -rlvars = rldict['9'] -r = Checks(rlvars, config['arch']) -r.check_valid_arch() - -a = RepoSync(rlvars, config, repo="BaseOS") -print(a.sync()) diff --git a/iso/py/sync-from-peridot b/iso/py/sync-from-peridot new file mode 100755 index 0000000..a883ce2 --- /dev/null +++ b/iso/py/sync-from-peridot @@ -0,0 +1,18 @@ +#!/usr/bin/env python3 + +# This is intended for doing "full" syncs, not periodic update syncs. + +from common import * +import argparse +from util import Checks +from util import RepoSync + +rlvars = rldict['9'] +r = Checks(rlvars, config['arch']) +r.check_valid_arch() + +a = RepoSync(rlvars, config, major="9", repo="BaseOS") +a.run() +#a.generate_conf() +#somedir = a.generate_compose_dirs() +#print(a.sync()) diff --git a/iso/py/util/dnf_utils.py b/iso/py/util/dnf_utils.py index e509044..37a7359 100644 --- a/iso/py/util/dnf_utils.py +++ b/iso/py/util/dnf_utils.py @@ -1,13 +1,21 @@ -HAS_LIBREPO = True +""" +Syncs yum repos for mirroring and composing. + +Louis Abel