commit iso build portions

This commit is contained in:
Louis Abel 2022-06-16 22:55:07 -07:00
parent c17e721633
commit 37cd4e1b2e
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
10 changed files with 331 additions and 26 deletions

0
iso/py/build-iso Normal file → Executable file
View File

View File

@ -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'
...

View File

@ -109,6 +109,7 @@
stable: 'SOURCES/RPM-GPG-KEY-Rocky-9' stable: 'SOURCES/RPM-GPG-KEY-Rocky-9'
testing: 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing' testing: 'SOURCES/RPM-GPG-KEY-Rocky-9-Testing'
list: list:
- 'SOURCES/Contributors'
- 'SOURCES/COMMUNITY-CHARTER' - 'SOURCES/COMMUNITY-CHARTER'
- 'SOURCES/EULA' - 'SOURCES/EULA'
- 'SOURCES/LICENSE' - 'SOURCES/LICENSE'

118
iso/py/configs/el9lh.yaml Normal file
View File

@ -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'
...

View File

@ -7,10 +7,10 @@ import argparse
from util import Checks from util import Checks
from util import RepoSync from util import RepoSync
rlvars = rldict['9'] rlvars = rldict['9-lookahead']
r = Checks(rlvars, config['arch']) r = Checks(rlvars, config['arch'])
r.check_valid_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="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 = RepoSync(rlvars, config, major="9", repo="BaseOS", parallel=True, ignore_debug=False, ignore_source=False, hashed=True)
a.run() #a.run()

View File

@ -1,19 +1,47 @@
#!/bin/bash #!/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 %} {% for pkg in lorax %}
sed -i '/{{ pkg }}/ s/^/#/' /usr/share/lorax/templates.d/80-rhel/runtime-install.tmpl sed -i '/{{ pkg }}/ s/^/#/' /usr/share/lorax/templates.d/80-rhel/runtime-install.tmpl
{% endfor %} {% endfor %}
lorax --product='{{ distname }}' \ lorax --product="${PRODUCT}" \
--version='{{ revision }}' \ --version="${VERSION}" \
--release='{{ revision }}' \ --release="${VERSION}" \
{%- for repo in repos %} {%- for repo in repos %}
--source={{ repo.url }} \ --source={{ repo.url }} \
{%- endfor %} {%- endfor %}
--variant={{ variant }} \ --variant="${VARIANT}" \
--nomacboot \ --nomacboot \
--buildarch={{ arch }} \ --buildarch="${ARCH}" \
--volid={{ shortname }}-{{ major }}-{{ minor }}{{ rc }}-{{ arch }}-boot1 \ --volid="${VOLID}" \
--logfile={{ mock_work_root }}/lorax.log \ --logfile="${LOGFILE}" \
--rootfs-size=3 \ --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

View File

@ -2,28 +2,44 @@
# This is a template that is used to build ISO's for Rocky Linux. Only under # 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. # 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 # Init the container
mock \ mock \
-r /var/tmp/lorax-{{ major }}.cfg \ -r "${MOCK_CFG}" \
--isolation={{ isolation }} \ --isolation="${ISOLATION}" \
--enable-network \ --enable-network \
--init --init
cp /var/tmp/buildImage.sh \ init_ret_val=$?
/var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/root/var/tmp 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 \ mock \
-r /var/tmp/lorax-{{ major }}.cfg \ -r "${MOCK_CFG}" \
--shell \ --shell \
--isolation={{ isolation }} \ --isolation="${ISOLATION}" \
--enable-network -- /bin/bash /var/tmp/buildImage.sh --enable-network -- /bin/bash /var/tmp/buildImage.sh | tee -a "${MOCK_LOG}"
ret_val=$? mock_ret_val=$?
if [ $ret_val -eq 0 ]; then if [ $mock_ret_val -eq 0 ]; then
# Copy resulting data to /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result # Copy resulting data to /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result
mkdir /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result mkdir -p "${MOCK_RESL}"
cp /var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/root/{{ builddir }}/lorax-{{ major }}-{{ arch }}.tar.gz \ cp "${MOCK_CHRO}${BUILDDIR}/${LORAX_TAR}" "${MOCK_RESL}"
/var/lib/mock/{{ shortname|lower }}-{{ major }}-{{ arch }}/result
else else
echo "!! LORAX RUN FAILED !!" echo "!! LORAX RUN FAILED !!"
exit 1 exit 1

View File

@ -1,4 +1,4 @@
config_opts['root'] = 'rocky-{{ major }}-{{ arch }}' config_opts['root'] = '{{ shortname|lower }}-{{ major }}-{{ arch }}'
config_opts['description'] = '{{ fullname }}' config_opts['description'] = '{{ fullname }}'
config_opts['target_arch'] = '{{ arch }}' config_opts['target_arch'] = '{{ arch }}'
config_opts['legal_host_arches'] = ('{{ 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['releasever'] = '{{ major }}'
config_opts['package_manager'] = '{{ pkgmanager|default("dnf") }}' config_opts['package_manager'] = '{{ pkgmanager|default("dnf") }}'
config_opts['extra_chroot_dirs'] = [ '/run/lock', ] 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 is local, the bind mounts will be here
{% if compose_dir_is_here %} {% if compose_dir_is_here %}

View File

@ -46,6 +46,7 @@ class RepoSync:
fullrun: bool = False, fullrun: bool = False,
nofail: bool = False, nofail: bool = False,
gpgkey: str = 'stable', gpgkey: str = 'stable',
rlmode: str = 'stable',
logger=None logger=None
): ):
self.nofail = nofail self.nofail = nofail

View File

@ -176,11 +176,12 @@ class IsoBuild:
# local AND arch cannot be used together, local supersedes. print # local AND arch cannot be used together, local supersedes. print
# warning. # warning.
self.generate_iso_scripts() self.generate_iso_scripts()
print() self.run_lorax()
def generate_iso_scripts(self): 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') self.log.info('Generating ISO configuration and scripts')
mock_iso_template = self.tmplenv.get_template('isomock.tmpl.cfg') mock_iso_template = self.tmplenv.get_template('isomock.tmpl.cfg')
@ -199,6 +200,7 @@ class IsoBuild:
arch=self.current_arch, arch=self.current_arch,
major=self.major_version, major=self.major_version,
fullname=self.fullname, fullname=self.fullname,
shortname=self.shortname,
required_pkgs=self.required_pkgs, required_pkgs=self.required_pkgs,
dist=self.disttag, dist=self.disttag,
repos=self.repolist, repos=self.repolist,
@ -224,6 +226,8 @@ class IsoBuild:
distname=self.distname, distname=self.distname,
revision=self.release, revision=self.release,
rc=rclevel, rc=rclevel,
builddir=self.mock_work_root,
lorax_work_root=self.lorax_result_root,
) )
mock_iso_entry = open(mock_iso_path, "w+") mock_iso_entry = open(mock_iso_path, "w+")
@ -238,6 +242,25 @@ class IsoBuild:
iso_template_entry.write(iso_template_output) iso_template_entry.write(iso_template_output)
iso_template_entry.close() 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 # !!! 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! # !!! library. If you are reading this and you can help us, please do so!
def treeinfo_write(self): def treeinfo_write(self):