From 602553e878ea54fc99529758ec8b12877f2af2eb Mon Sep 17 00:00:00 2001 From: nazunalika Date: Mon, 13 Jun 2022 07:37:50 -0700 Subject: [PATCH] add more color for next sync --- iso/py/common.py | 1 + iso/py/configs/el8.yaml | 1 + iso/py/configs/el9.yaml | 2 ++ iso/py/templates/isobuild.tmpl.sh | 15 +++++++++ iso/py/templates/isolorax.tmpl.sh | 2 ++ iso/py/templates/isomock.tmpl | 47 ++++++++++++++++++++++++++++ iso/py/util/dnf_utils.py | 5 +++ iso/py/util/iso_utils.py | 51 ++++++++++++++++++++++++++++++- 8 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 iso/py/templates/isobuild.tmpl.sh create mode 100644 iso/py/templates/isolorax.tmpl.sh create mode 100644 iso/py/templates/isomock.tmpl diff --git a/iso/py/common.py b/iso/py/common.py index 509e89e..8032efd 100644 --- a/iso/py/common.py +++ b/iso/py/common.py @@ -25,6 +25,7 @@ rldict = {} sigdict = {} config = { "rlmacro": rpm.expandMacro('%rhel'), + "dist": 'el' + rpm.expandMacro('%rhel'), "arch": platform.machine(), "date_stamp": time.strftime("%Y%m%d.%H%M%S", time.localtime()), "compose_root": "/mnt/compose", diff --git a/iso/py/configs/el8.yaml b/iso/py/configs/el8.yaml index c232bb0..f7f64d2 100644 --- a/iso/py/configs/el8.yaml +++ b/iso/py/configs/el8.yaml @@ -1,5 +1,6 @@ --- '8': + fullname: 'Rocky Linux 8' revision: '8.6' rclvl: 'RC2' allowed_arches: diff --git a/iso/py/configs/el9.yaml b/iso/py/configs/el9.yaml index 22b6cd1..cf5c49e 100644 --- a/iso/py/configs/el9.yaml +++ b/iso/py/configs/el9.yaml @@ -1,5 +1,6 @@ --- '9': + fullname: 'Rocky Linux 9' revision: '9.0' rclvl: 'RC1' allowed_arches: @@ -60,6 +61,7 @@ repos: - 'BaseOS' - 'AppStream' + variant: 'BaseOS' repoclosure_map: arches: x86_64: '--forcearch=x86_64 --arch=x86_64 --arch=athlon --arch=i686 --arch=i586 --arch=i486 --arch=i386 --arch=noarch' diff --git a/iso/py/templates/isobuild.tmpl.sh b/iso/py/templates/isobuild.tmpl.sh new file mode 100644 index 0000000..880aa16 --- /dev/null +++ b/iso/py/templates/isobuild.tmpl.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# This is a template that is used to build ISO's for Rocky Linux. Only under +# extreme circumstances should you be filling this out and running manually. + +# Init the container +mock \ + -r /mnt/compose/9/latest-Rocky-9/work/entries/lorax-{{ major }}-{{ arch }}.cfg \ + --init + +mock \ + -r /mnt/compose/9/latest-Rocky-9/work/entries/lorax-{{ major }}-{{ arch }}.cfg \ + --shell \ + --enable-network -- /bin/bash /mnt/compose/9/latest-Rocky-9/work/entries/runLorax-{{ arch }}.sh + +# Clean up? diff --git a/iso/py/templates/isolorax.tmpl.sh b/iso/py/templates/isolorax.tmpl.sh new file mode 100644 index 0000000..5dba11d --- /dev/null +++ b/iso/py/templates/isolorax.tmpl.sh @@ -0,0 +1,2 @@ +#!/bin/bash +# You should not be running this manually. diff --git a/iso/py/templates/isomock.tmpl b/iso/py/templates/isomock.tmpl new file mode 100644 index 0000000..a07589c --- /dev/null +++ b/iso/py/templates/isomock.tmpl @@ -0,0 +1,47 @@ +config_opts['root'] = 'rocky-{{ major }}-{{ arch }}' +config_opts['description'] = '{{ fullname }}' +config_opts['target_arch'] = '{{ arch }}' +config_opts['legal_host_arches'] = ('{{ arch }}',) + +config_opts['chroot_setup_cmd'] = 'install bash bzip2 coreutils cpio diffutils redhat-release findutils gawk glibc-minimal-langpack grep gzip info patch redhat-rpm-config rpm-build sed shadow-utils tar unzip util-linux which xz genisoimage isomd5sum lorax lorax-templates-rhel lorax-templates-generic' +config_opts['dist'] = '{{ dist }}' # only useful for --resultdir variable subst +config_opts['releasever'] = '{{ major }}' +config_opts['package_manager'] = 'dnf' +config_opts['extra_chroot_dirs'] = [ '/run/lock', ] +# config_opts['bootstrap_image'] = 'quay.io/rockylinux/rockylinux:{{ major }}' + +config_opts['plugin_conf']['bind_mount_enable'] = True +config_opts['plugin_conf']['bind_mount_opts']['dirs'].append(('/mnt/compose', '/mnt/compose')) + + +config_opts['dnf.conf'] = """ +[main] +keepcache=1 +debuglevel=2 +reposdir=/dev/null +logfile=/var/log/yum.log +retries=20 +obsoletes=1 +gpgcheck=0 +assumeyes=1 +syslog_ident=mock +syslog_device= +metadata_expire=0 +mdpolicy=group:primary +best=1 +install_weak_deps=0 +protected_packages= +module_platform_id=platform:{{ dist }} +user_agent={{ user_agent }} + +{% for repo in repos %} +[{{ repo }}] +name={{ repo }} +baseurl=file:///mnt/compose/{{ major }}/latest-Rocky-{{ major }}/compose/{{ repo }}/{{ arch }}/os +enabled=1 +gpgcheck=0 + +{% endfor %} + +""" + diff --git a/iso/py/util/dnf_utils.py b/iso/py/util/dnf_utils.py index 7221e72..ecc75b9 100644 --- a/iso/py/util/dnf_utils.py +++ b/iso/py/util/dnf_utils.py @@ -505,6 +505,11 @@ class RepoSync: ) for issue in bad_exit_list: self.log.error(issue) + else: + self.log.info( + '[' + Color.BOLD + Color.GREEN + ' OK ' + Color.END + '] ' + 'No issues detected.' + ) def generate_compose_dirs(self) -> str: """ diff --git a/iso/py/util/iso_utils.py b/iso/py/util/iso_utils.py index c19ebc6..6bc2c19 100644 --- a/iso/py/util/iso_utils.py +++ b/iso/py/util/iso_utils.py @@ -12,6 +12,7 @@ import subprocess import shlex import time import re +from productmd.common import SortedConfigParser from common import Color class IsoBuild: @@ -34,12 +35,15 @@ class IsoBuild: self.arch = arch self.image = image self.host = host + self.fullname = rlvars['fullname'] # Relevant config items self.major_version = major + self.disttag = config['dist'] self.date_stamp = config['date_stamp'] + self.timestamp = time.time() self.compose_root = config['compose_root'] self.compose_base = config['compose_root'] + "/" + major - self.iso_base = config['compose_root'] + "/" + major + "/isos" + self.iso_drop = config['compose_root'] + "/" + major + "/isos" self.current_arch = config['arch'] self.extra_files = rlvars['extra_files'] @@ -145,6 +149,51 @@ class IsoBuild: """ print() + def generate_iso_scripts(self): + """ + Generates the scripts needed to be ran in the mock roots + """ + print() + + def treeinfo_write(self): + """ + Ensure treeinfo is written correctly + """ + print() + + def discinfo_write(self): + """ + Ensure discinfo is written correctly + """ + #with open(file_path, "w") as f: + # f.write("%s\n" % self.timestamp) + # f.write("%s\n" % self.fullname) + # f.write("%s\n" % self.arch) + # if disc_numbers: + # f.write("%s\n" % ",".join([str(i) for i in disc_numbers])) + print() + + def write_media_repo(self): + """ + Ensure media.repo exists + """ + data = [ + "[InstallMedia]", + "name=%s" % self.fullname, + "mediaid=%s" % self.timestamp, + "metadata_expire=-1", + "gpgcheck=0", + "cost=500", + "", + ] + + + def generate_graft_points(self): + """ + Get a list of packages for an ISO + """ + print() + class LiveBuild: """