From b75fe6289980248a46c816cddf11e29b66d480c5 Mon Sep 17 00:00:00 2001 From: nazunalika Date: Thu, 23 Jun 2022 15:29:22 -0700 Subject: [PATCH] scripts now generate --- iso/empanadas/empanadas/configs/el8.yaml | 2 + iso/empanadas/empanadas/configs/el9-beta.yaml | 3 + iso/empanadas/empanadas/configs/el9.yaml | 3 + iso/empanadas/empanadas/configs/el9lh.yaml | 3 + .../empanadas/scripts/build_iso_extra.py | 2 +- .../templates/buildExtraImage.tmpl.sh | 1 + .../empanadas/templates/extraisobuild.tmpl.sh | 2 +- iso/empanadas/empanadas/util/iso_utils.py | 91 +++++++++++++++---- 8 files changed, 88 insertions(+), 19 deletions(-) diff --git a/iso/empanadas/empanadas/configs/el8.yaml b/iso/empanadas/empanadas/configs/el8.yaml index 5cf0ed1..f6c1a67 100644 --- a/iso/empanadas/empanadas/configs/el8.yaml +++ b/iso/empanadas/empanadas/configs/el8.yaml @@ -69,6 +69,8 @@ packages: 'os/Packages' repodata: 'os/repodata' iso_map: + xorrisofs: False + iso_level: False hosts: x86_64: '' aarch64: '' diff --git a/iso/empanadas/empanadas/configs/el9-beta.yaml b/iso/empanadas/empanadas/configs/el9-beta.yaml index f8bd8a6..ea6a94a 100644 --- a/iso/empanadas/empanadas/configs/el9-beta.yaml +++ b/iso/empanadas/empanadas/configs/el9-beta.yaml @@ -51,6 +51,8 @@ packages: 'os/Packages' repodata: 'os/repodata' iso_map: + xorrisofs: False + iso_level: False hosts: x86_64: '' aarch64: '' @@ -58,6 +60,7 @@ s390x: '' images: dvd: + discnum: '1' repos: - 'BaseOS' - 'AppStream' diff --git a/iso/empanadas/empanadas/configs/el9.yaml b/iso/empanadas/empanadas/configs/el9.yaml index a13c859..e50fbdf 100644 --- a/iso/empanadas/empanadas/configs/el9.yaml +++ b/iso/empanadas/empanadas/configs/el9.yaml @@ -51,6 +51,8 @@ packages: 'os/Packages' repodata: 'os/repodata' iso_map: + xorrisofs: False + iso_level: False hosts: x86_64: '' aarch64: '' @@ -58,6 +60,7 @@ s390x: '' images: dvd: + discnum: '1' repos: - 'BaseOS' - 'AppStream' diff --git a/iso/empanadas/empanadas/configs/el9lh.yaml b/iso/empanadas/empanadas/configs/el9lh.yaml index 680a6c1..69c37e1 100644 --- a/iso/empanadas/empanadas/configs/el9lh.yaml +++ b/iso/empanadas/empanadas/configs/el9lh.yaml @@ -51,6 +51,8 @@ packages: 'os/Packages' repodata: 'os/repodata' iso_map: + xorrisofs: False + iso_level: False hosts: x86_64: '' aarch64: '' @@ -58,6 +60,7 @@ s390x: '' images: dvd: + discnum: '1' repos: - 'BaseOS' - 'AppStream' diff --git a/iso/empanadas/empanadas/scripts/build_iso_extra.py b/iso/empanadas/empanadas/scripts/build_iso_extra.py index b33b202..074dba4 100755 --- a/iso/empanadas/empanadas/scripts/build_iso_extra.py +++ b/iso/empanadas/empanadas/scripts/build_iso_extra.py @@ -15,7 +15,7 @@ parser.add_argument('--isolation', type=str, help="Mock Isolation") parser.add_argument('--local-compose', action='store_true', help="Compose Directory is Here") parser.add_argument('--logger', type=str) parser.add_argument('--extra-iso', type=str, help="Granular choice in which iso is built") -parser.add_argument('--extra-iso-mode', type=str) +parser.add_argument('--extra-iso-mode', type=str, default='local') results = parser.parse_args() rlvars = rldict[results.release] major = rlvars['major'] diff --git a/iso/empanadas/empanadas/templates/buildExtraImage.tmpl.sh b/iso/empanadas/empanadas/templates/buildExtraImage.tmpl.sh index 623da54..8f5d54a 100644 --- a/iso/empanadas/empanadas/templates/buildExtraImage.tmpl.sh +++ b/iso/empanadas/empanadas/templates/buildExtraImage.tmpl.sh @@ -23,4 +23,5 @@ fi mkdir -p {{ compose_work_iso_dir }}/{{ arch }} cp /builddir/*.iso {{ compose_work_iso_dir }}/{{ arch }} cp /builddir/*.iso.manifest {{ compose_work_iso_dir }}/{{ arch }} +cp /builddir/*.log {{ compose_work_iso_dir }}/{{ arch }} {% endif %} diff --git a/iso/empanadas/empanadas/templates/extraisobuild.tmpl.sh b/iso/empanadas/empanadas/templates/extraisobuild.tmpl.sh index 29ddfa0..e8f555b 100644 --- a/iso/empanadas/empanadas/templates/extraisobuild.tmpl.sh +++ b/iso/empanadas/empanadas/templates/extraisobuild.tmpl.sh @@ -10,7 +10,7 @@ MOCK_RESL="${MOCK_ROOT}/result" MOCK_CHRO="${MOCK_ROOT}/root" MOCK_LOG="${MOCK_RESL}/mock-output.log" IMAGE_SCR="/var/tmp/buildExtraImage.sh" -IMAGE_ISO="{{ shortname }}-{{ major }}.{{ minor }}{{ rc }}-{{ arch }}-dvd{{ discnum|default('1') }}.iso" +IMAGE_ISO="{{ isoname }}" ISOLATION="{{ isolation }}" BUILDDIR="{{ builddir }}" diff --git a/iso/empanadas/empanadas/util/iso_utils.py b/iso/empanadas/empanadas/util/iso_utils.py index 200adfc..d3b1d1c 100644 --- a/iso/empanadas/empanadas/util/iso_utils.py +++ b/iso/empanadas/empanadas/util/iso_utils.py @@ -140,11 +140,10 @@ class IsoBuild: "work/logs" ) - #self.iso_work_dir = os.path.join( - # self.compose_latest_dir, - # "work/iso", - # config['arch'] - #) + self.iso_work_dir = os.path.join( + self.compose_latest_dir, + "work/iso" + ) self.lorax_work_dir = os.path.join( self.compose_latest_dir, @@ -708,7 +707,7 @@ class IsoBuild: if self.extra_iso_mode == 'local': self._extra_iso_local_config(a, y, grafts) - self._extra_iso_local_run() + #self._extra_iso_local_run() elif self.extra_iso_mode == 'podman': continue else: @@ -738,6 +737,27 @@ class IsoBuild: if self.release_candidate: rclevel = '-' + self.rclvl + discnum = '' + if self.iso_map['images'][image]['discnum']: + discnum = self.iso_map['images'][image]['discnum'] + + volid = '{}-{}-{}-{}-{}'.format( + self.shortname, + self.major_version, + self.minor_version, + arch, + image + ) + + isoname = '{}-{}.{}-{}-{}{}.iso'.format( + self.shortname, + self.major_version, + self.minor_version, + arch, + image, + discnum + ) + mock_iso_template_output = mock_iso_template.render( arch=self.current_arch, major=self.major_version, @@ -755,8 +775,48 @@ class IsoBuild: isolation=self.mock_isolation, builddir=self.mock_work_root, shortname=self.shortname, + isoname=isoname, ) + opts = { + 'arch': arch, + 'iso_name': isoname, + 'volid': volid, + 'graft_points': grafts, + 'use_xorrisofs': self.iso_map['xorrisofs'], + 'iso_level': self.iso_map['iso_level'], + } + + make_image = self._get_make_image_cmd(opts) + isohybrid = self._get_isohybrid_cmd(opts) + implantmd5 = self._get_implantisomd5_cmd(opts) + make_manifest = self._get_manifest_cmd(opts) + + iso_template_output = iso_template.render( + inside_podman=False, + arch=arch, + compose_work_iso_dir=self.iso_work_dir, + make_image=make_image, + isohybrid=isohybrid, + implantmd5=implantmd5, + make_manifest=make_manifest, + ) + + mock_iso_entry = open(mock_iso_path, "w+") + mock_iso_entry.write(mock_iso_template_output) + mock_iso_entry.close() + + mock_sh_entry = open(mock_sh_path, "w+") + mock_sh_entry.write(mock_sh_template_output) + mock_sh_entry.close() + + iso_template_entry = open(iso_template_path, "w+") + iso_template_entry.write(iso_template_output) + iso_template_entry.close() + + os.chmod(mock_sh_path, 0o755) + os.chmod(iso_template_path, 0o755) + def _extra_iso_local_run(self): """ @@ -1072,7 +1132,6 @@ class IsoBuild: def _get_mkisofs_cmd( self, iso, - paths, appid=None, volid=None, volset=None, @@ -1147,8 +1206,9 @@ class IsoBuild: """ Implants md5 into iso """ - cmd = ["/usr/bin/implantisomd5", "--supported-iso", opts['iso_path']] - return cmd + cmd = ["/usr/bin/implantisomd5", "--supported-iso", opts['iso_name']] + returned_cmd = ' '.join(cmd) + return returned_cmd def _get_manifest_cmd(self, opts): """ @@ -1164,8 +1224,9 @@ class IsoBuild: if opts['arch'] == "x86_64": cmd = ["/usr/bin/isohybrid"] cmd.append("--uefi") - cmd.append(opts['iso_path']) - return cmd + cmd.append(opts['iso_name']) + returned_cmd = ' '.join(cmd) + return returned_cmd def _get_make_image_cmd(self, opts): """ @@ -1190,14 +1251,10 @@ class IsoBuild: iso_level=opts['iso_level'], **isokwargs ) - return cmd + returned_cmd = ' '.join(cmd) + return returned_cmd - def _write_script(self, opts): - """ - Writes out the script to make the DVD - """ - class LiveBuild: """ This helps us build the live images for Rocky Linux.