diff --git a/iso/py/build-iso b/iso/py/build-iso old mode 100644 new mode 100755 diff --git a/iso/py/configs/el9-beta.yaml b/iso/py/configs/el9-beta.yaml new file mode 100644 index 0000000..13eca3e --- /dev/null +++ b/iso/py/configs/el9-beta.yaml @@ -0,0 +1,118 @@ +--- +'9-beta': + fullname: 'Rocky Linux 9' + revision: '9.1' + rclvl: 'RC1' + bugurl: 'https://bugs.rockylinux.org' + allowed_arches: + - x86_64 + - aarch64 + - ppc64le + - s390x + provide_multilib: True + project_id: '' + repo_symlinks: + NFV: 'nfv' + renames: + all: 'devel' + all_repos: + - 'all' + - 'BaseOS' + - 'AppStream' + - 'CRB' + - 'HighAvailability' + - 'ResilientStorage' + - 'RT' + - 'NFV' + - 'SAP' + - 'SAPHANA' + - 'extras' + - 'plus' + no_comps_or_groups: + - 'all' + - 'extras' + - 'plus' + comps_or_groups: + - 'BaseOS' + - 'AppStream' + - 'CRB' + - 'HighAvailability' + - 'ResilientStorage' + - 'RT' + - 'NFV' + - 'SAP' + - 'SAPHANA' + has_modules: + - 'AppStream' + - 'CRB' + iso_map: + hosts: + x86_64: '' + aarch64: '' + ppc64le: '' + s390x: '' + images: + - dvd1 + - minimal + - boot + repos: + - 'BaseOS' + - 'AppStream' + variant: 'BaseOS' + lorax_removes: + - 'libreport-rhel-anaconda-bugzilla' + required_pkgs: + - 'lorax' + - 'genisoimage' + - 'isomd5sum' + - 'lorax-templates-rhel' + - 'lorax-templates-generic' + repoclosure_map: + arches: + x86_64: '--forcearch=x86_64 --arch=x86_64 --arch=athlon --arch=i686 --arch=i586 --arch=i486 --arch=i386 --arch=noarch' + aarch64: '--forcearch=aarch64 --arch=aarch64 --arch=noarch' + ppc64le: '--forcearch=ppc64le --arch=ppc64le --arch=noarch' + s390x: '--forcearch=s390x --arch=s390x --arch=noarch' + repos: + devel: [] + BaseOS: [] + AppStream: + - BaseOS + CRB: + - BaseOS + - AppStream + HighAvailability: + - BaseOS + - AppStream + ResilientStorage: + - BaseOS + - AppStream + RT: + - BaseOS + - AppStream + NFV: + - BaseOS + - AppStream + SAP: + - BaseOS + - AppStream + - HighAvailability + SAPHANA: + - BaseOS + - AppStream + - HighAvailability + extra_files: + git_repo: 'https://git.rockylinux.org/staging/src/rocky-release.git' + git_raw_path: 'https://git.rockylinux.org/staging/src/rocky-release/-/raw/r9/' + branch: 'r9' + gpg: + stable: 'SOURCES/RPM-GPG-KEY-Rocky-9' + testing: 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' + list: + - 'SOURCES/Contributors' + - 'SOURCES/COMMUNITY-CHARTER' + - 'SOURCES/EULA' + - 'SOURCES/LICENSE' + - 'SOURCES/RPM-GPG-KEY-Rocky-9' + - 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' +... diff --git a/iso/py/configs/el9.yaml b/iso/py/configs/el9.yaml index b0a371b..faacbdb 100644 --- a/iso/py/configs/el9.yaml +++ b/iso/py/configs/el9.yaml @@ -109,6 +109,7 @@ stable: 'SOURCES/RPM-GPG-KEY-Rocky-9' testing: 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' list: + - 'SOURCES/Contributors' - 'SOURCES/COMMUNITY-CHARTER' - 'SOURCES/EULA' - 'SOURCES/LICENSE' diff --git a/iso/py/configs/el9lh.yaml b/iso/py/configs/el9lh.yaml new file mode 100644 index 0000000..1aa3f54 --- /dev/null +++ b/iso/py/configs/el9lh.yaml @@ -0,0 +1,118 @@ +--- +'9-lookahead': + fullname: 'Rocky Linux 9' + revision: '9.1' + rclvl: 'RC1' + bugurl: 'https://bugs.rockylinux.org' + allowed_arches: + - x86_64 + - aarch64 + - ppc64le + - s390x + provide_multilib: True + project_id: '' + repo_symlinks: + NFV: 'nfv' + renames: + all: 'devel' + all_repos: + - 'all' + - 'BaseOS' + - 'AppStream' + - 'CRB' + - 'HighAvailability' + - 'ResilientStorage' + - 'RT' + - 'NFV' + - 'SAP' + - 'SAPHANA' + - 'extras' + - 'plus' + no_comps_or_groups: + - 'all' + - 'extras' + - 'plus' + comps_or_groups: + - 'BaseOS' + - 'AppStream' + - 'CRB' + - 'HighAvailability' + - 'ResilientStorage' + - 'RT' + - 'NFV' + - 'SAP' + - 'SAPHANA' + has_modules: + - 'AppStream' + - 'CRB' + iso_map: + hosts: + x86_64: '' + aarch64: '' + ppc64le: '' + s390x: '' + images: + - dvd1 + - minimal + - boot + repos: + - 'BaseOS' + - 'AppStream' + variant: 'BaseOS' + lorax_removes: + - 'libreport-rhel-anaconda-bugzilla' + required_pkgs: + - 'lorax' + - 'genisoimage' + - 'isomd5sum' + - 'lorax-templates-rhel' + - 'lorax-templates-generic' + repoclosure_map: + arches: + x86_64: '--forcearch=x86_64 --arch=x86_64 --arch=athlon --arch=i686 --arch=i586 --arch=i486 --arch=i386 --arch=noarch' + aarch64: '--forcearch=aarch64 --arch=aarch64 --arch=noarch' + ppc64le: '--forcearch=ppc64le --arch=ppc64le --arch=noarch' + s390x: '--forcearch=s390x --arch=s390x --arch=noarch' + repos: + devel: [] + BaseOS: [] + AppStream: + - BaseOS + CRB: + - BaseOS + - AppStream + HighAvailability: + - BaseOS + - AppStream + ResilientStorage: + - BaseOS + - AppStream + RT: + - BaseOS + - AppStream + NFV: + - BaseOS + - AppStream + SAP: + - BaseOS + - AppStream + - HighAvailability + SAPHANA: + - BaseOS + - AppStream + - HighAvailability + extra_files: + git_repo: 'https://git.rockylinux.org/staging/src/rocky-release.git' + git_raw_path: 'https://git.rockylinux.org/staging/src/rocky-release/-/raw/r9/' + branch: 'r9lh' + gpg: + stable: 'SOURCES/RPM-GPG-KEY-Rocky-9' + testing: 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' + list: + - 'SOURCES/Contributors' + - 'SOURCES/COMMUNITY-CHARTER' + - 'SOURCES/EULA' + - 'SOURCES/LICENSE' + - 'SOURCES/RPM-GPG-KEY-Rocky-9' + - 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' +... diff --git a/iso/py/sync-from-peridot-test b/iso/py/sync-from-peridot-test index 1166376..6d286e9 100755 --- a/iso/py/sync-from-peridot-test +++ b/iso/py/sync-from-peridot-test @@ -7,10 +7,10 @@ import argparse from util import Checks from util import RepoSync -rlvars = rldict['9'] +rlvars = rldict['9-lookahead'] r = Checks(rlvars, config['arch']) r.check_valid_arch() #a = RepoSync(rlvars, config, major="9", repo="ResilientStorage", parallel=True, ignore_debug=False, ignore_source=False) a = RepoSync(rlvars, config, major="9", repo="BaseOS", parallel=True, ignore_debug=False, ignore_source=False, hashed=True) -a.run() +#a.run() diff --git a/iso/py/templates/buildImage.tmpl.sh b/iso/py/templates/buildImage.tmpl.sh index 3cc055e..a0f0231 100644 --- a/iso/py/templates/buildImage.tmpl.sh +++ b/iso/py/templates/buildImage.tmpl.sh @@ -1,19 +1,47 @@ #!/bin/bash +VOLID="{{ shortname }}-{{ major }}-{{ minor }}{{ rc }}-{{ arch }}-boot1" +LOGFILE="{{ builddir }}/lorax-{{ arch }}.log" +VARIANT="{{ variant }}" +ARCH="{{ arch }}" +VERSION="{{ revision }}" +PRODUCT="{{ distname }}" +MOCKBLD="{{ builddir }}" +LORAXRES="{{ lorax_work_root }}" +LORAX_TAR="lorax-{{ major }}-{{ arch }}.tar.gz" + {% for pkg in lorax %} sed -i '/{{ pkg }}/ s/^/#/' /usr/share/lorax/templates.d/80-rhel/runtime-install.tmpl {% endfor %} -lorax --product='{{ distname }}' \ - --version='{{ revision }}' \ - --release='{{ revision }}' \ +lorax --product="${PRODUCT}" \ + --version="${VERSION}" \ + --release="${VERSION}" \ {%- for repo in repos %} --source={{ repo.url }} \ {%- endfor %} - --variant={{ variant }} \ + --variant="${VARIANT}" \ --nomacboot \ - --buildarch={{ arch }} \ - --volid={{ shortname }}-{{ major }}-{{ minor }}{{ rc }}-{{ arch }}-boot1 \ - --logfile={{ mock_work_root }}/lorax.log \ + --buildarch="${ARCH}" \ + --volid="${VOLID}" \ + --logfile="${LOGFILE}" \ --rootfs-size=3 \ - {{ lorax_work_root }} + "${LORAXRES}" + +ret_val=$? +if [ $ret_val -ne 0 ]; then + echo "!! LORAX FAILED !!" + exit 1 +fi + +# If we didn't fail, let's pack up everything! +cd "${MOCKBLD}" +tar czf "${LORAX_TAR}" lorax "${LOGFILE}" + +tar_ret_val=$? +if [ $ret_val -ne 0 ]; then + echo "!! PROBLEM CREATING ARCHIVE !!" + exit 1 +fi + +exit 0 diff --git a/iso/py/templates/isobuild.tmpl.sh b/iso/py/templates/isobuild.tmpl.sh index 21b03f1..bb4d410 100644 --- a/iso/py/templates/isobuild.tmpl.sh +++ b/iso/py/templates/isobuild.tmpl.sh @@ -2,28 +2,44 @@ # 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. +# Vars +MOCK_CFG="/var/tmp/lorax-{{ major }}.cfg" +MOCK_ROOT="/var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}" +MOCK_RESL="${MOCK_ROOT}/result" +MOCK_CHRO="${MOCK_ROOT}/root" +MOCK_LOG="${MOCK_RESL}/mock-output.log" +LORAX_SCR="/var/tmp/buildImage.sh" +LORAX_TAR="lorax-{{ major }}-{{ arch }}.tar.gz" +ISOLATION="{{ isolation }}" +BUILDDIR="{{ builddir }}" + # Init the container mock \ - -r /var/tmp/lorax-{{ major }}.cfg \ - --isolation={{ isolation }} \ + -r "${MOCK_CFG}" \ + --isolation="${ISOLATION}" \ --enable-network \ --init -cp /var/tmp/buildImage.sh \ - /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/root/var/tmp +init_ret_val=$? +if [ $init_ret_val -ne 0 ]; then + echo "!! MOCK INIT FAILED !!" + exit 1 +fi + +mkdir -p "${MOCK_RESL}" +cp "${LORAX_SCR}" "${MOCK_CHRO}${LORAX_SCR}" mock \ - -r /var/tmp/lorax-{{ major }}.cfg \ + -r "${MOCK_CFG}" \ --shell \ - --isolation={{ isolation }} \ - --enable-network -- /bin/bash /var/tmp/buildImage.sh + --isolation="${ISOLATION}" \ + --enable-network -- /bin/bash /var/tmp/buildImage.sh | tee -a "${MOCK_LOG}" -ret_val=$? -if [ $ret_val -eq 0 ]; then +mock_ret_val=$? +if [ $mock_ret_val -eq 0 ]; then # Copy resulting data to /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result - mkdir /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result - cp /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/root/{{ builddir }}/lorax-{{ major }}-{{ arch }}.tar.gz \ - /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result + mkdir -p "${MOCK_RESL}" + cp "${MOCK_CHRO}${BUILDDIR}/${LORAX_TAR}" "${MOCK_RESL}" else echo "!! LORAX RUN FAILED !!" exit 1 diff --git a/iso/py/templates/isomock.tmpl.cfg b/iso/py/templates/isomock.tmpl.cfg index 69f84e3..53cd821 100644 --- a/iso/py/templates/isomock.tmpl.cfg +++ b/iso/py/templates/isomock.tmpl.cfg @@ -1,4 +1,4 @@ -config_opts['root'] = 'rocky-{{ major }}-{{ arch }}' +config_opts['root'] = '{{ shortname|lower }}-{{ major }}-{{ arch }}' config_opts['description'] = '{{ fullname }}' config_opts['target_arch'] = '{{ arch }}' config_opts['legal_host_arches'] = ('{{ arch }}',) @@ -8,7 +8,7 @@ config_opts['dist'] = '{{ dist }}' # only useful for --resultdir variable subst config_opts['releasever'] = '{{ major }}' config_opts['package_manager'] = '{{ pkgmanager|default("dnf") }}' config_opts['extra_chroot_dirs'] = [ '/run/lock', ] -# config_opts['bootstrap_image'] = 'quay.io/rockylinux/rockylinux:{{ major }}' +# config_opts['bootstrap_image'] = 'quay.io/{{ shortname|lower }}/{{ shortname|lower }}:{{ major }}' # If compose is local, the bind mounts will be here {% if compose_dir_is_here %} diff --git a/iso/py/util/dnf_utils.py b/iso/py/util/dnf_utils.py index bfdb88a..a965d59 100644 --- a/iso/py/util/dnf_utils.py +++ b/iso/py/util/dnf_utils.py @@ -46,6 +46,7 @@ class RepoSync: fullrun: bool = False, nofail: bool = False, gpgkey: str = 'stable', + rlmode: str = 'stable', logger=None ): self.nofail = nofail diff --git a/iso/py/util/iso_utils.py b/iso/py/util/iso_utils.py index 88de9fd..286a6d9 100644 --- a/iso/py/util/iso_utils.py +++ b/iso/py/util/iso_utils.py @@ -176,11 +176,12 @@ class IsoBuild: # local AND arch cannot be used together, local supersedes. print # warning. self.generate_iso_scripts() - print() + self.run_lorax() def generate_iso_scripts(self): """ - Generates the scripts needed to be ran in the mock roots + Generates the scripts needed to be ran to run lorax in mock as well as + package up the results. """ self.log.info('Generating ISO configuration and scripts') mock_iso_template = self.tmplenv.get_template('isomock.tmpl.cfg') @@ -199,6 +200,7 @@ class IsoBuild: arch=self.current_arch, major=self.major_version, fullname=self.fullname, + shortname=self.shortname, required_pkgs=self.required_pkgs, dist=self.disttag, repos=self.repolist, @@ -224,6 +226,8 @@ class IsoBuild: distname=self.distname, revision=self.release, rc=rclevel, + builddir=self.mock_work_root, + lorax_work_root=self.lorax_result_root, ) mock_iso_entry = open(mock_iso_path, "w+") @@ -238,6 +242,25 @@ class IsoBuild: iso_template_entry.write(iso_template_output) iso_template_entry.close() + os.chmod(mock_sh_path, 0o755) + os.chmod(iso_template_path, 0o755) + + def run_lorax(self): + """ + This actually runs lorax on this system. It will call the right scripts + to do so. + """ + lorax_cmd = '/bin/bash /var/tmp/isobuild.sh' + self.log.info('Starting lorax...') + + try: + subprocess.call(shlex.split(lorax_cmd)) + except: + self.log.error('An error occured during execution.') + self.log.error('See the logs for more information.') + raise SystemExit() + + # !!! Send help, we would prefer to do this using the productmd python # !!! library. If you are reading this and you can help us, please do so! def treeinfo_write(self):