start python conversion
This commit is contained in:
parent
7602ae1a44
commit
b0bd9a8367
4
iso/py/.gitignore
vendored
Normal file
4
iso/py/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
*.so
|
19
iso/py/README.md
Normal file
19
iso/py/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
iso
|
||||
===
|
||||
|
||||
scripts
|
||||
-------
|
||||
|
||||
* sync-variant-pungi
|
||||
* sync-variant-peridot
|
||||
* sync-all-pungi
|
||||
* sync-all-peridot
|
||||
* sync-sig
|
||||
* build-all-iso
|
||||
* sign-repos-only
|
||||
|
||||
wrappers
|
||||
--------
|
||||
|
||||
* lorax-generators
|
||||
* sync-generators
|
57
iso/py/common.py
Normal file
57
iso/py/common.py
Normal file
@ -0,0 +1,57 @@
|
||||
# All imports are here
|
||||
import platform
|
||||
import time
|
||||
import glob
|
||||
import rpm
|
||||
import yaml
|
||||
|
||||
# These are a bunch of colors we may use in terminal output
|
||||
class Color:
|
||||
RED = '\033[91m'
|
||||
GREEN = '\033[92m'
|
||||
PURPLE = '\033[95m'
|
||||
CYAN = '\033[96m'
|
||||
DARKCYAN = '\033[36m'
|
||||
BLUE = '\033[94m'
|
||||
YELLOW = '\033[93m'
|
||||
UNDERLINE = '\033[4m'
|
||||
BOLD = '\033[1m'
|
||||
END = '\033[0m'
|
||||
|
||||
# vars and additional checks
|
||||
#RLVER = rpm.expandMacro('%rhel')
|
||||
RLVER = '9'
|
||||
rldict = {}
|
||||
arch = platform.machine()
|
||||
|
||||
# Importing the config from yaml
|
||||
for conf in glob.iglob('configs/*.yaml'):
|
||||
with open(conf, 'r', encoding="utf-8") as file:
|
||||
rldict.update(yaml.safe_load(file))
|
||||
|
||||
# The system needs to be a RHEL-like system. It cannot be Fedora or SuSE.
|
||||
#if "%rhel" in RLVER:
|
||||
# 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 '
|
||||
# 'defined with a value equal to the version you are targetting. RHEL'
|
||||
# ' and its derivatives have this set.')
|
||||
|
||||
# Generic rlvars for the particular EL release we're on. This does not have to
|
||||
# be used. A different one can be assigned based on script need.
|
||||
rlvars = rldict[RLVER]
|
||||
|
||||
# Is our arch allowed for this particular release? Some previous releases do
|
||||
# not support ppc or s390x
|
||||
if arch not in rlvars['allowed_arches']:
|
||||
raise SystemExit(Color.BOLD + 'This architecture is not supported.'
|
||||
+ Color.END + '\n\nEnsure that the architecture you are building '
|
||||
'for is supported for this compose process.')
|
||||
|
||||
date_stamp = time.strftime("%Y%m%d", time.localtime())
|
||||
COMPOSE_ROOT = "/mnt/compose/" + RLVER
|
||||
COMPOSE_ISO_WORKDIR = COMPOSE_ROOT + "work/" + arch + "/" + date_stamp
|
||||
STAGING_ROOT = "/mnt/repos-staging"
|
||||
PRODUCTION_ROOT = "/mnt/repos-production"
|
||||
CATEGORY_STUB = "/mirror/pub/rocky"
|
||||
REVISION = rlvars['revision'] + '-' + rlvars['rclvl']
|
45
iso/py/configs/el8.yaml
Normal file
45
iso/py/configs/el8.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
---
|
||||
'8':
|
||||
revision: '8.6'
|
||||
rclvl: 'RC2'
|
||||
allowed_arches:
|
||||
- x86_64
|
||||
- aarch64
|
||||
provide_multilib: False
|
||||
repo_url_list: []
|
||||
required_packages:
|
||||
- 'lorax'
|
||||
- 'genisoimage'
|
||||
- 'isomd5sum'
|
||||
symlink_refs:
|
||||
devel: 'Devel'
|
||||
NFV: 'nfv'
|
||||
all_repos:
|
||||
- 'BaseOS'
|
||||
- 'AppStream'
|
||||
- 'HighAvailability'
|
||||
- 'ResilientStorage'
|
||||
- 'PowerTools'
|
||||
- 'RT'
|
||||
- 'NFV'
|
||||
- 'extras'
|
||||
- 'devel'
|
||||
- 'plus'
|
||||
- 'rockyrpi'
|
||||
no_comps_or_groups:
|
||||
- 'extras'
|
||||
- 'devel'
|
||||
- 'plus'
|
||||
- 'rockyrpi'
|
||||
comps_or_groups:
|
||||
- 'BaseOS'
|
||||
- 'AppStream'
|
||||
- 'HighAvailability'
|
||||
- 'ResilientStorage'
|
||||
- 'PowerTools'
|
||||
- 'RT'
|
||||
- 'NFV'
|
||||
has_modules:
|
||||
- 'AppStream'
|
||||
- 'PowerTools'
|
||||
...
|
66
iso/py/configs/el9.yaml
Normal file
66
iso/py/configs/el9.yaml
Normal file
@ -0,0 +1,66 @@
|
||||
---
|
||||
'9':
|
||||
revision: '9.0'
|
||||
rclvl: 'RC1'
|
||||
allowed_arches:
|
||||
- x86_64
|
||||
- aarch64
|
||||
- ppc64le
|
||||
- s390x
|
||||
provide_multilib: True
|
||||
repo_url_list:
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/all'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/BaseOS'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/AppStream'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/CRB'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/HighAvailability'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/ResilientStorage'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/RT'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/NFV'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/SAP'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/SAPHANA'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/extras'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/devel'
|
||||
- 'https://yumrepofs.build.resf.org/v1/projects/55b17281-bc54-4929-8aca-a8a11d628738/repo/plus'
|
||||
required_packages:
|
||||
- 'lorax'
|
||||
- 'genisoimage'
|
||||
- 'isomd5sum'
|
||||
symlink_refs:
|
||||
devel: 'Devel'
|
||||
NFV: 'nfv'
|
||||
renames:
|
||||
all: 'nplb'
|
||||
all_repos:
|
||||
- 'nplb'
|
||||
- 'BaseOS'
|
||||
- 'AppStream'
|
||||
- 'HighAvailability'
|
||||
- 'ResilientStorage'
|
||||
- 'CRB'
|
||||
- 'RT'
|
||||
- 'NFV'
|
||||
- 'SAP'
|
||||
- 'SAPHANA'
|
||||
- 'extras'
|
||||
- 'devel'
|
||||
- 'plus'
|
||||
no_comps_or_groups:
|
||||
- 'nplb'
|
||||
- 'extras'
|
||||
- 'devel'
|
||||
- 'plus'
|
||||
comps_or_groups:
|
||||
- 'BaseOS'
|
||||
- 'AppStream'
|
||||
- 'HighAvailability'
|
||||
- 'ResilientStorage'
|
||||
- 'CRB'
|
||||
- 'RT'
|
||||
- 'NFV'
|
||||
- 'SAP'
|
||||
- 'SAPHANA'
|
||||
has_modules:
|
||||
- 'AppStream'
|
||||
- 'CRB'
|
||||
...
|
6
iso/py/test.py
Normal file
6
iso/py/test.py
Normal file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from common import *
|
||||
|
||||
print(platform.machine())
|
||||
print(arch)
|
38
iso/py/test2.py
Normal file
38
iso/py/test2.py
Normal file
@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import desert
|
||||
from attrs import define, field
|
||||
import typing as t
|
||||
|
||||
CONFIG = {
|
||||
"8": {
|
||||
"allowed_arches": ["x86_64", "aarch64"],
|
||||
"repo_url_list": ["some", "shit", "here"]
|
||||
},
|
||||
"9": {
|
||||
"allowed_arches": ["x86_64", "aarch64", "ppc64le", "s390x"],
|
||||
"repo_url_list": ["some", "other", "shit", "here"]
|
||||
}
|
||||
}
|
||||
|
||||
@define
|
||||
class VersionConfig:
|
||||
allowed_arches: t.List[str] = field()
|
||||
repo_url_list: t.List[str] = field()
|
||||
|
||||
@allowed_arches.validator
|
||||
def check(self, attribute, value):
|
||||
if not all(v in ["x86_64", "aarch64", "ppc64le", "s390x"] for v in value):
|
||||
raise ValueError("Architecture list does not match")
|
||||
|
||||
def new(version):
|
||||
schema = desert.schema(VersionConfig)
|
||||
config = CONFIG[str(version)]
|
||||
return schema.load(config)
|
||||
|
||||
eight = new(8)
|
||||
nine = new(9)
|
||||
|
||||
print(eight)
|
||||
print(eight.allowed_arches)
|
||||
print(nine)
|
Loading…
Reference in New Issue
Block a user