cleanup: remove obsolete functions

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 untrusted user: label
GPG Key ID: 2A6975660E424560
12 changed files with 53 additions and 223 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,6 @@ class IsoBuild:
config,
major,
arch=None,
hfs_compat: bool = False,
rc: bool = False,
s3: bool = False,
force_download: bool = False,
@ -143,9 +142,6 @@ class IsoBuild:
#if s3:
# self.s3 = boto3.client('s3')
# arch specific
self.hfs_compat = hfs_compat
# Templates
file_loader = FileSystemLoader(f"{_rootdir}/templates")
self.tmplenv = Environment(loader=file_loader)
@ -262,17 +258,6 @@ class IsoBuild:
if self.release_candidate:
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(
arch=self.current_arch,
major=self.major_version,
@ -832,17 +817,6 @@ class IsoBuild:
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 = ''
if self.release_candidate:
rclevel = '-' + self.rclvl
@ -890,35 +864,29 @@ class IsoBuild:
'iso_name': isoname,
'volid': volid,
'graft_points': grafts,
'use_xorrisofs': self.iso_map['xorrisofs'],
'iso_level': self.iso_map['iso_level'],
}
if opts['use_xorrisofs']:
# Generate a xorriso compatible dialog
with open(grafts) as xp:
xorpoint = xp.read()
xp.close()
xorriso_template_output = xorriso_template.render(
boot_iso=boot_iso,
isoname=isoname,
volid=volid,
graft=xorpoint,
arch=arch,
)
with open(xorriso_template_path, "w+") as xorriso_template_entry:
xorriso_template_entry.write(xorriso_template_output)
xorriso_template_entry.close()
opts['graft_points'] = xorriso_template_path
# Generate a xorriso compatible dialog
with open(grafts) as xp:
xorpoint = xp.read()
xp.close()
xorriso_template_output = xorriso_template.render(
boot_iso=boot_iso,
isoname=isoname,
volid=volid,
graft=xorpoint,
arch=arch,
)
with open(xorriso_template_path, "w+") as xorriso_template_entry:
xorriso_template_entry.write(xorriso_template_output)
xorriso_template_entry.close()
opts['graft_points'] = xorriso_template_path
make_image = '{} {}'.format(
Shared.get_make_image_cmd(
opts,
self.hfs_compat
),
Shared.get_make_image_cmd(opts),
log_path_command
)
isohybrid = Shared.get_isohybrid_cmd(opts)
implantmd5 = Shared.get_implantisomd5_cmd(opts)
make_manifest = Shared.get_manifest_cmd(opts)
@ -927,7 +895,6 @@ class IsoBuild:
arch=arch,
compose_work_iso_dir=self.iso_work_dir,
make_image=make_image,
isohybrid=isohybrid,
implantmd5=implantmd5,
make_manifest=make_manifest,
lorax_pkg_cmd=lorax_pkg_cmd,
@ -1210,11 +1177,7 @@ class IsoBuild:
update=updatables
)
if self.iso_map['xorrisofs']:
grafters = xorrs
else:
grafters = grafts
grafters = xorrs
return grafters
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
# the boot.iso manifest to exclude a file
if self.iso_map['xorrisofs']:
with open(xorrspath, "w") as fx:
for zm in sorted(result, key=Idents.sorting):
found = False
replace = False
for upda in update:
if fnmatch(zm, upda):
#print(f'updating: {zm} {upda}')
replace = True
break
for excl in exclude:
if fnmatch(zm, excl):
#print(f'ignoring: {zm} {excl}')
found = True
break
if found:
continue
mcmd = "-update" if replace else "-map"
fx.write("%s %s %s\n" % (mcmd, u[zm], zm))
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()
with open(xorrspath, "w") as fx:
for zm in sorted(result, key=Idents.sorting):
found = False
replace = False
for upda in update:
if fnmatch(zm, upda):
#print(f'updating: {zm} {upda}')
replace = True
break
for excl in exclude:
if fnmatch(zm, excl):
#print(f'ignoring: {zm} {excl}')
found = True
break
if found:
continue
mcmd = "-update" if replace else "-map"
fx.write("%s %s %s\n" % (mcmd, u[zm], zm))
fx.close()
def run_pull_iso_images(self):
"""
@ -1541,7 +1489,6 @@ class LiveBuild:
rlvars,
config,
major,
hfs_compat: bool = False,
force_download: bool = False,
isolation: str = 'simple',
live_iso_mode: str = 'local',

View File

@ -511,78 +511,14 @@ class Shared:
config_file.close()
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
def rsync_method(src, dest):
"""
Returns a string for the rsync command plus parallel. Yes, this is a
hack.
"""
#find_cmd = '/usr/bin/find'
#parallel_cmd = '/usr/bin/parallel'
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}'
#os.makedirs(dest, exist_ok=True)
@ -921,57 +857,21 @@ class Shared:
return cmd
@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
"""
isokwargs = {}
isokwargs["boot_args"] = Shared.get_boot_options(
opts['arch'],
os.path.join("$TEMPLATE", "config_files/ppc"),
hfs_compat=hfs_compat,
)
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
)
cmd = [
'/usr/bin/xorriso',
'-dialog',
'on',
'<',
opts['graft_points'],
'2>&1'
]
returned_cmd = ' '.join(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
def get_implantisomd5_cmd(opts):
"""
@ -986,19 +886,13 @@ class Shared:
"""
Gets an ISO manifest
"""
if opts['use_xorrisofs']:
return """/usr/bin/xorriso -dev %s --find |
tail -n+2 |
tr -d "'" |
cut -c2- | sort >> %s.manifest""" % (
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']),
)
return """/usr/bin/xorriso -dev %s --find |
tail -n+2 |
tr -d "'" |
cut -c2- | sort >> %s.manifest""" % (
shlex.quote(opts['iso_name']),
shlex.quote(opts['iso_name']),
)
@staticmethod
def build_repo_list(