cleanup: remove obsolete functions
Some checks failed
Build empanada images for imagefactory / buildx (push) Failing after 5s
Build empanada container images for lorax / buildx (push) Successful in 1s

8.10 was built using xorrisofs. As a result, there's no reason to keep
isohybrid or any of those other functions around in the event we use
empanadas to recreate ISO's specifically for Rocky Linux 8.

As a result, a lot of obsolete variables and functions have been removed
or pruned.
This commit is contained in:
Louis Abel 2024-08-14 23:39:58 -07:00
parent a15f74a421
commit fabbe8e46d
Signed by: label
GPG Key ID: 2A6975660E424560
12 changed files with 53 additions and 223 deletions

View File

@ -43,7 +43,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -43,7 +43,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -39,7 +39,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: False
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -39,7 +39,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: False
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -39,7 +39,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: False
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -49,7 +49,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -49,7 +49,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -49,7 +49,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -39,7 +39,6 @@
packages: 'os/Packages' packages: 'os/Packages'
repodata: 'os/repodata' repodata: 'os/repodata'
iso_map: iso_map:
xorrisofs: True
iso_level: False iso_level: False
images: images:
dvd: dvd:

View File

@ -43,8 +43,6 @@ local_setup_env
{{ make_image }} {{ make_image }}
{{ isohybrid }}
{{ implantmd5 }} {{ implantmd5 }}
{{ make_manifest }} {{ make_manifest }}

View File

@ -51,7 +51,6 @@ class IsoBuild:
config, config,
major, major,
arch=None, arch=None,
hfs_compat: bool = False,
rc: bool = False, rc: bool = False,
s3: bool = False, s3: bool = False,
force_download: bool = False, force_download: bool = False,
@ -143,9 +142,6 @@ class IsoBuild:
#if s3: #if s3:
# self.s3 = boto3.client('s3') # self.s3 = boto3.client('s3')
# arch specific
self.hfs_compat = hfs_compat
# Templates # Templates
file_loader = FileSystemLoader(f"{_rootdir}/templates") file_loader = FileSystemLoader(f"{_rootdir}/templates")
self.tmplenv = Environment(loader=file_loader) self.tmplenv = Environment(loader=file_loader)
@ -262,17 +258,6 @@ class IsoBuild:
if self.release_candidate: if self.release_candidate:
rclevel = '-' + self.rclvl rclevel = '-' + self.rclvl
# This is kind of a hack. Installing xorrisofs sets the alternatives to
# it, so backwards compatibility is sort of guaranteed. But we want to
# emulate as close as possible to what pungi does, so unless we
# explicitly ask for xorr (in el8 and 9), we should NOT be using it.
# For RLN and el10, we'll use xorr all the way through. When 8 is no
# longer getting ISO's, we'll remove this section.
required_pkgs = self.required_pkgs.copy()
if self.iso_map['xorrisofs']:
if 'genisoimage' in required_pkgs and 'xorriso' not in required_pkgs:
required_pkgs.append('xorriso')
mock_iso_template_output = mock_iso_template.render( mock_iso_template_output = mock_iso_template.render(
arch=self.current_arch, arch=self.current_arch,
major=self.major_version, major=self.major_version,
@ -832,17 +817,6 @@ class IsoBuild:
log_path_command = f'| tee -a {log_root}/{arch}-{image}.log' log_path_command = f'| tee -a {log_root}/{arch}-{image}.log'
# This is kind of a hack. Installing xorrisofs sets the alternatives to
# it, so backwards compatibility is sort of guaranteed. But we want to
# emulate as close as possible to what pungi does, so unless we
# explicitly ask for xorr (in el8 and 9), we should NOT be using it.
# For RLN and el10, we'll use xorr all the way through. When 8 is no
# longer getting ISO's, we'll remove this section.
required_pkgs = self.required_pkgs.copy()
if self.iso_map['xorrisofs']:
if 'genisoimage' in required_pkgs and 'xorriso' not in required_pkgs:
required_pkgs.append('xorriso')
rclevel = '' rclevel = ''
if self.release_candidate: if self.release_candidate:
rclevel = '-' + self.rclvl rclevel = '-' + self.rclvl
@ -890,35 +864,29 @@ class IsoBuild:
'iso_name': isoname, 'iso_name': isoname,
'volid': volid, 'volid': volid,
'graft_points': grafts, 'graft_points': grafts,
'use_xorrisofs': self.iso_map['xorrisofs'],
'iso_level': self.iso_map['iso_level'], 'iso_level': self.iso_map['iso_level'],
} }
if opts['use_xorrisofs']: # Generate a xorriso compatible dialog
# Generate a xorriso compatible dialog with open(grafts) as xp:
with open(grafts) as xp: xorpoint = xp.read()
xorpoint = xp.read() xp.close()
xp.close() xorriso_template_output = xorriso_template.render(
xorriso_template_output = xorriso_template.render( boot_iso=boot_iso,
boot_iso=boot_iso, isoname=isoname,
isoname=isoname, volid=volid,
volid=volid, graft=xorpoint,
graft=xorpoint, arch=arch,
arch=arch, )
) with open(xorriso_template_path, "w+") as xorriso_template_entry:
with open(xorriso_template_path, "w+") as xorriso_template_entry: xorriso_template_entry.write(xorriso_template_output)
xorriso_template_entry.write(xorriso_template_output) xorriso_template_entry.close()
xorriso_template_entry.close() opts['graft_points'] = xorriso_template_path
opts['graft_points'] = xorriso_template_path
make_image = '{} {}'.format( make_image = '{} {}'.format(
Shared.get_make_image_cmd( Shared.get_make_image_cmd(opts),
opts,
self.hfs_compat
),
log_path_command log_path_command
) )
isohybrid = Shared.get_isohybrid_cmd(opts)
implantmd5 = Shared.get_implantisomd5_cmd(opts) implantmd5 = Shared.get_implantisomd5_cmd(opts)
make_manifest = Shared.get_manifest_cmd(opts) make_manifest = Shared.get_manifest_cmd(opts)
@ -927,7 +895,6 @@ class IsoBuild:
arch=arch, arch=arch,
compose_work_iso_dir=self.iso_work_dir, compose_work_iso_dir=self.iso_work_dir,
make_image=make_image, make_image=make_image,
isohybrid=isohybrid,
implantmd5=implantmd5, implantmd5=implantmd5,
make_manifest=make_manifest, make_manifest=make_manifest,
lorax_pkg_cmd=lorax_pkg_cmd, lorax_pkg_cmd=lorax_pkg_cmd,
@ -1210,11 +1177,7 @@ class IsoBuild:
update=updatables update=updatables
) )
if self.iso_map['xorrisofs']: grafters = xorrs
grafters = xorrs
else:
grafters = grafts
return grafters return grafters
def _get_grafts(self, paths, exclusive_paths=None, exclude=None): def _get_grafts(self, paths, exclusive_paths=None, exclude=None):
@ -1278,40 +1241,25 @@ class IsoBuild:
# We check first if a file needs to be updated first before relying on # We check first if a file needs to be updated first before relying on
# the boot.iso manifest to exclude a file # the boot.iso manifest to exclude a file
if self.iso_map['xorrisofs']: with open(xorrspath, "w") as fx:
with open(xorrspath, "w") as fx: for zm in sorted(result, key=Idents.sorting):
for zm in sorted(result, key=Idents.sorting): found = False
found = False replace = False
replace = False for upda in update:
for upda in update: if fnmatch(zm, upda):
if fnmatch(zm, upda): #print(f'updating: {zm} {upda}')
#print(f'updating: {zm} {upda}') replace = True
replace = True break
break for excl in exclude:
for excl in exclude: if fnmatch(zm, excl):
if fnmatch(zm, excl): #print(f'ignoring: {zm} {excl}')
#print(f'ignoring: {zm} {excl}') found = True
found = True break
break if found:
if found: continue
continue mcmd = "-update" if replace else "-map"
mcmd = "-update" if replace else "-map" fx.write("%s %s %s\n" % (mcmd, u[zm], zm))
fx.write("%s %s %s\n" % (mcmd, u[zm], zm)) fx.close()
fx.close()
else:
with open(filepath, "w") as fh:
self.log.info('%sNothing should be excluded in legacy ' \
'genisoimage. Ignoring exclude list.', Color.WARN)
for zl in sorted(result, key=Idents.sorting):
#found = False
#for excl in exclude:
# if fnmatch(zl, excl):
# found = True
# break
#if found:
# continue
fh.write(f"{zl}={u[zl]}\n")
fh.close()
def run_pull_iso_images(self): def run_pull_iso_images(self):
""" """
@ -1541,7 +1489,6 @@ class LiveBuild:
rlvars, rlvars,
config, config,
major, major,
hfs_compat: bool = False,
force_download: bool = False, force_download: bool = False,
isolation: str = 'simple', isolation: str = 'simple',
live_iso_mode: str = 'local', live_iso_mode: str = 'local',

View File

@ -511,78 +511,14 @@ class Shared:
config_file.close() config_file.close()
return fname return fname
@staticmethod
def quick_sync(src, dest, logger, tmp_dir):
"""
Does a quick sync from one place to another. This determines the method
in which will be used. We will look for fpsync and fall back to
parallel | rsync if that is also available. It will fail if parallel is
not available.
Return true or false on completion?
"""
@staticmethod
def simple_sync(src, dest):
"""
This is for simple syncs only, using rsync or copytree.
"""
@staticmethod
def fpsync_method(src, dest, tmp_dir):
"""
Returns a list for the fpsync command
"""
cmd = '/usr/bin/fpsync'
#rsync_switches = '-av --numeric-ids --no-compress --chown=10004:10005'
rsync_switches = '-v --numeric-ids --no-compress --chown=10004:10005'
if not os.path.exists(cmd):
message = 'fpsync not found'
retval = 1
return message, retval
os.makedirs(tmp_dir, exist_ok=True)
fpsync_cmd = '{} -o "{}" -n 18 -t {} {} {}'.format(
cmd,
rsync_switches,
tmp_dir,
src,
dest
)
process = subprocess.call(
shlex.split(fpsync_cmd),
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL,
)
if process != 0:
message = 'Syncing (fpsync) failed'
retval = process
return message, retval
if os.path.exists(dest):
message = 'Syncing (fpsync) succeeded'
retval = process
else:
message = 'Path synced does not seem to exist for some reason.'
retval = 1
#shutil.rmtree(tmp_dir)
return message, retval
@staticmethod @staticmethod
def rsync_method(src, dest): def rsync_method(src, dest):
""" """
Returns a string for the rsync command plus parallel. Yes, this is a Returns a string for the rsync command plus parallel. Yes, this is a
hack. hack.
""" """
#find_cmd = '/usr/bin/find'
#parallel_cmd = '/usr/bin/parallel'
cmd = '/usr/bin/rsync' cmd = '/usr/bin/rsync'
switches = '-vrlptDSH --chown=10004:10005 --progress --human-readable' switches = '-vrlptDSHog --chown=10004:10005 --progress --human-readable --delete'
rsync_command = f'{cmd} {switches} {src}/ {dest}' rsync_command = f'{cmd} {switches} {src}/ {dest}'
#os.makedirs(dest, exist_ok=True) #os.makedirs(dest, exist_ok=True)
@ -921,57 +857,21 @@ class Shared:
return cmd return cmd
@staticmethod @staticmethod
def get_make_image_cmd(opts, hfs_compat): def get_make_image_cmd(opts):
""" """
Generates the command to actually make the image in the first place Generates the command to actually make the image in the first place
""" """
isokwargs = {} cmd = [
isokwargs["boot_args"] = Shared.get_boot_options( '/usr/bin/xorriso',
opts['arch'], '-dialog',
os.path.join("$TEMPLATE", "config_files/ppc"), 'on',
hfs_compat=hfs_compat, '<',
) opts['graft_points'],
'2>&1'
if opts['arch'] in ("ppc64", "ppc64le"): ]
isokwargs["input_charset"] = None
if opts['use_xorrisofs']:
cmd = [
'/usr/bin/xorriso',
'-dialog',
'on',
'<',
opts['graft_points'],
'2>&1'
]
else:
cmd = Shared.get_mkisofs_cmd(
opts['iso_name'],
volid=opts['volid'],
exclude=["./lost+found"],
grafts=opts['graft_points'],
use_xorrisofs=False,
iso_level=opts['iso_level'],
**isokwargs
)
returned_cmd = ' '.join(cmd) returned_cmd = ' '.join(cmd)
return returned_cmd return returned_cmd
@staticmethod
def get_isohybrid_cmd(opts):
cmd = []
if not opts['use_xorrisofs']:
if opts['arch'] == "x86_64":
cmd = ["/usr/bin/isohybrid"]
cmd.append("--uefi")
cmd.append(opts['iso_name'])
returned_cmd = ' '.join(cmd)
else:
returned_cmd = ''
return returned_cmd
@staticmethod @staticmethod
def get_implantisomd5_cmd(opts): def get_implantisomd5_cmd(opts):
""" """
@ -986,19 +886,13 @@ class Shared:
""" """
Gets an ISO manifest Gets an ISO manifest
""" """
if opts['use_xorrisofs']: return """/usr/bin/xorriso -dev %s --find |
return """/usr/bin/xorriso -dev %s --find | tail -n+2 |
tail -n+2 | tr -d "'" |
tr -d "'" | cut -c2- | sort >> %s.manifest""" % (
cut -c2- | sort >> %s.manifest""" % ( shlex.quote(opts['iso_name']),
shlex.quote(opts['iso_name']), shlex.quote(opts['iso_name']),
shlex.quote(opts['iso_name']), )
)
else:
return "/usr/bin/isoinfo -R -f -i %s | grep -v '/TRANS.TBL$' | sort >> %s.manifest" % (
shlex.quote(opts['iso_name']),
shlex.quote(opts['iso_name']),
)
@staticmethod @staticmethod
def build_repo_list( def build_repo_list(