* [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code
@ 2020-10-21 0:23 Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment Matt Turner
` (35 more replies)
0 siblings, 36 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 521 +++++++++++++++++++------------------
1 file changed, 269 insertions(+), 252 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 2e313bd8..48157837 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -330,9 +330,10 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("setup_target_path"):
log.notice(
'Resume point detected, skipping target path setup operation...')
- else:
- self.resume.enable("setup_target_path")
- ensure_dirs(self.settings["storedir"] + "/builds")
+ return
+
+ self.resume.enable("setup_target_path")
+ ensure_dirs(self.settings["storedir"] + "/builds")
def set_fsscript(self):
if self.settings["spec_prefix"] + "/fsscript" in self.settings:
@@ -808,18 +809,19 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("setup_confdir"):
log.notice(
'Resume point detected, skipping setup_confdir operation...')
- else:
- if "portage_confdir" in self.settings:
- log.info('Configuring %s...', self.settings['port_conf'])
- dest = normpath(
- self.settings['chroot_path'] + '/' + self.settings['port_conf'])
- ensure_dirs(dest)
- # The trailing slashes on both paths are important:
- # We want to make sure rsync copies the dirs into each
- # other and not as subdirs.
- cmd(['rsync', '-a', self.settings['portage_confdir'] + '/', dest + '/'],
- env=self.env)
- self.resume.enable("setup_confdir")
+ return
+
+ if "portage_confdir" in self.settings:
+ log.info('Configuring %s...', self.settings['port_conf'])
+ dest = normpath(
+ self.settings['chroot_path'] + '/' + self.settings['port_conf'])
+ ensure_dirs(dest)
+ # The trailing slashes on both paths are important:
+ # We want to make sure rsync copies the dirs into each
+ # other and not as subdirs.
+ cmd(['rsync', '-a', self.settings['portage_confdir'] + '/', dest + '/'],
+ env=self.env)
+ self.resume.enable("setup_confdir")
def portage_overlay(self):
""" We copy the contents of our overlays to /usr/local/portage """
@@ -934,61 +936,62 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("chroot_setup"):
log.notice(
'Resume point detected, skipping chroot_setup operation...')
- else:
- log.notice('Setting up chroot...')
+ return
- shutil.copy('/etc/resolv.conf',
- self.settings['chroot_path'] + '/etc/')
+ log.notice('Setting up chroot...')
- # Copy over the binary interpreter (qemu), if applicable; note that it's given
- # as full path and goes to the same place in the chroot
- if "interpreter" in self.settings:
- if not os.path.exists(self.settings["interpreter"]):
- raise CatalystError(
- "Can't find interpreter " +
- self.settings["interpreter"],
- print_traceback=True)
+ shutil.copy('/etc/resolv.conf',
+ self.settings['chroot_path'] + '/etc/')
- log.notice('Copying binary interpreter %s into chroot',
- self.settings['interpreter'])
+ # Copy over the binary interpreter (qemu), if applicable; note that it's given
+ # as full path and goes to the same place in the chroot
+ if "interpreter" in self.settings:
+ if not os.path.exists(self.settings["interpreter"]):
+ raise CatalystError(
+ "Can't find interpreter " +
+ self.settings["interpreter"],
+ print_traceback=True)
- if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter']):
- os.rename(
- self.settings['chroot_path'] +
- '/' + self.settings['interpreter'],
- self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst')
+ log.notice('Copying binary interpreter %s into chroot',
+ self.settings['interpreter'])
+
+ if os.path.exists(self.settings['chroot_path'] + '/' + self.settings['interpreter']):
+ os.rename(
+ self.settings['chroot_path'] +
+ '/' + self.settings['interpreter'],
+ self.settings['chroot_path'] + '/' + self.settings['interpreter'] + '.catalyst')
- shutil.copy(self.settings['interpreter'],
- self.settings['chroot_path'] + '/' + self.settings['interpreter'])
+ shutil.copy(self.settings['interpreter'],
+ self.settings['chroot_path'] + '/' + self.settings['interpreter'])
- # Copy over the envscript, if applicable
- if "envscript" in self.settings:
- if not os.path.exists(self.settings["envscript"]):
- raise CatalystError(
- "Can't find envscript " + self.settings["envscript"],
- print_traceback=True)
-
- log.warning(
- 'env variables in catalystrc may cause catastrophic failure.\n'
- 'If your build fails look here first as the possible problem.')
-
- shutil.copy(self.settings['envscript'],
- self.settings['chroot_path'] + '/tmp/envscript')
-
- # Copy over /etc/hosts from the host in case there are any
- # specialties in there
- hosts_file = self.settings['chroot_path'] + '/etc/hosts'
- if os.path.exists(hosts_file):
- os.rename(hosts_file, hosts_file + '.catalyst')
- shutil.copy('/etc/hosts', hosts_file)
- # write out the make.conf
- try:
- self.write_make_conf(setup=True)
- except OSError as e:
- raise CatalystError('Could not write %s: %s' % (
- normpath(self.settings["chroot_path"] +
- self.settings["make_conf"]), e))
- self.resume.enable("chroot_setup")
+ # Copy over the envscript, if applicable
+ if "envscript" in self.settings:
+ if not os.path.exists(self.settings["envscript"]):
+ raise CatalystError(
+ "Can't find envscript " + self.settings["envscript"],
+ print_traceback=True)
+
+ log.warning(
+ 'env variables in catalystrc may cause catastrophic failure.\n'
+ 'If your build fails look here first as the possible problem.')
+
+ shutil.copy(self.settings['envscript'],
+ self.settings['chroot_path'] + '/tmp/envscript')
+
+ # Copy over /etc/hosts from the host in case there are any
+ # specialties in there
+ hosts_file = self.settings['chroot_path'] + '/etc/hosts'
+ if os.path.exists(hosts_file):
+ os.rename(hosts_file, hosts_file + '.catalyst')
+ shutil.copy('/etc/hosts', hosts_file)
+ # write out the make.conf
+ try:
+ self.write_make_conf(setup=True)
+ except OSError as e:
+ raise CatalystError('Could not write %s: %s' % (
+ normpath(self.settings["chroot_path"] +
+ self.settings["make_conf"]), e))
+ self.resume.enable("chroot_setup")
def write_make_conf(self, setup=True):
# Modify and write out make.conf (for the chroot)
@@ -1097,22 +1100,24 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("fsscript"):
log.notice('Resume point detected, skipping fsscript operation...')
- else:
- if "fsscript" in self.settings:
- if os.path.exists(self.settings["controller_file"]):
- cmd([self.settings['controller_file'], 'fsscript'],
- env=self.env)
- self.resume.enable("fsscript")
+ return
+
+ if "fsscript" in self.settings:
+ if os.path.exists(self.settings["controller_file"]):
+ cmd([self.settings['controller_file'], 'fsscript'],
+ env=self.env)
+ self.resume.enable("fsscript")
def rcupdate(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("rcupdate"):
log.notice('Resume point detected, skipping rcupdate operation...')
- else:
- if os.path.exists(self.settings["controller_file"]):
- cmd([self.settings['controller_file'], 'rc-update'],
- env=self.env)
- self.resume.enable("rcupdate")
+ return
+
+ if os.path.exists(self.settings["controller_file"]):
+ cmd([self.settings['controller_file'], 'rc-update'],
+ env=self.env)
+ self.resume.enable("rcupdate")
def clean(self):
if "autoresume" in self.settings["options"] \
@@ -1181,58 +1186,61 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("empty"):
log.notice('Resume point detected, skipping empty operation...')
- else:
- if self.settings["spec_prefix"] + "/empty" in self.settings:
- if isinstance(
- self.settings[self.settings['spec_prefix'] + '/empty'],
- str):
- self.settings[self.settings["spec_prefix"] + "/empty"] = \
- self.settings[self.settings["spec_prefix"] +
- "/empty"].split()
- for x in self.settings[self.settings["spec_prefix"] + "/empty"]:
- myemp = self.settings["destpath"] + x
- if not os.path.isdir(myemp) or os.path.islink(myemp):
- log.warning('not a directory or does not exist, '
- 'skipping "empty" operation: %s', x)
- continue
- log.info('Emptying directory %s', x)
- clear_dir(myemp)
- self.resume.enable("empty")
+ return
+
+ if self.settings["spec_prefix"] + "/empty" in self.settings:
+ if isinstance(
+ self.settings[self.settings['spec_prefix'] + '/empty'],
+ str):
+ self.settings[self.settings["spec_prefix"] + "/empty"] = \
+ self.settings[self.settings["spec_prefix"] +
+ "/empty"].split()
+ for x in self.settings[self.settings["spec_prefix"] + "/empty"]:
+ myemp = self.settings["destpath"] + x
+ if not os.path.isdir(myemp) or os.path.islink(myemp):
+ log.warning('not a directory or does not exist, '
+ 'skipping "empty" operation: %s', x)
+ continue
+ log.info('Emptying directory %s', x)
+ clear_dir(myemp)
+ self.resume.enable("empty")
def remove(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("remove"):
log.notice('Resume point detected, skipping remove operation...')
- else:
- if self.settings["spec_prefix"] + "/rm" in self.settings:
- for x in self.settings[self.settings["spec_prefix"] + "/rm"]:
- # We're going to shell out for all these cleaning
- # operations, so we get easy glob handling.
- log.notice('%s: removing %s', self.settings["spec_prefix"], x)
- clear_path(self.settings["destpath"] + x)
- try:
- if os.path.exists(self.settings["controller_file"]):
- cmd([self.settings['controller_file'], 'clean'],
- env=self.env)
- self.resume.enable("remove")
- except:
- self.unbind()
- raise
+ return
- def preclean(self):
- if "autoresume" in self.settings["options"] \
- and self.resume.is_enabled("preclean"):
- log.notice('Resume point detected, skipping preclean operation...')
- else:
+ if self.settings["spec_prefix"] + "/rm" in self.settings:
+ for x in self.settings[self.settings["spec_prefix"] + "/rm"]:
+ # We're going to shell out for all these cleaning
+ # operations, so we get easy glob handling.
+ log.notice('%s: removing %s', self.settings["spec_prefix"], x)
+ clear_path(self.settings["destpath"] + x)
try:
if os.path.exists(self.settings["controller_file"]):
- cmd([self.settings['controller_file'], 'preclean'],
+ cmd([self.settings['controller_file'], 'clean'],
env=self.env)
- self.resume.enable("preclean")
-
+ self.resume.enable("remove")
except:
self.unbind()
- raise CatalystError("Build failed, could not execute preclean")
+ raise
+
+ def preclean(self):
+ if "autoresume" in self.settings["options"] \
+ and self.resume.is_enabled("preclean"):
+ log.notice('Resume point detected, skipping preclean operation...')
+ return
+
+ try:
+ if os.path.exists(self.settings["controller_file"]):
+ cmd([self.settings['controller_file'], 'preclean'],
+ env=self.env)
+ self.resume.enable("preclean")
+
+ except:
+ self.unbind()
+ raise CatalystError("Build failed, could not execute preclean")
def capture(self):
# initialize it here so it doesn't use
@@ -1245,56 +1253,58 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("capture"):
log.notice('Resume point detected, skipping capture operation...')
- else:
- log.notice('Capture target in a tarball')
- # Remove filename from path
- mypath = os.path.dirname(self.settings["target_path"].rstrip('/'))
-
- # Now make sure path exists
- ensure_dirs(mypath)
-
- pack_info = self.compressor.create_infodict(
- source=".",
- basedir=self.settings["stage_path"],
- filename=self.settings["target_path"].rstrip('/'),
- mode=self.settings["compression_mode"],
- auto_extension=True,
- arch=self.settings["compressor_arch"],
- other_options=self.settings["compressor_options"],
- )
- target_filename = ".".join([self.settings["target_path"].rstrip('/'),
- self.compressor.extension(pack_info['mode'])])
+ return
- log.notice('Creating stage tarball... mode: %s',
- self.settings['compression_mode'])
+ log.notice('Capture target in a tarball')
+ # Remove filename from path
+ mypath = os.path.dirname(self.settings["target_path"].rstrip('/'))
- if self.compressor.compress(pack_info):
- self.gen_contents_file(target_filename)
- self.gen_digest_file(target_filename)
- self.resume.enable("capture")
- else:
- log.warning("Couldn't create stage tarball: %s",
- target_filename)
+ # Now make sure path exists
+ ensure_dirs(mypath)
+
+ pack_info = self.compressor.create_infodict(
+ source=".",
+ basedir=self.settings["stage_path"],
+ filename=self.settings["target_path"].rstrip('/'),
+ mode=self.settings["compression_mode"],
+ auto_extension=True,
+ arch=self.settings["compressor_arch"],
+ other_options=self.settings["compressor_options"],
+ )
+ target_filename = ".".join([self.settings["target_path"].rstrip('/'),
+ self.compressor.extension(pack_info['mode'])])
+
+ log.notice('Creating stage tarball... mode: %s',
+ self.settings['compression_mode'])
+
+ if self.compressor.compress(pack_info):
+ self.gen_contents_file(target_filename)
+ self.gen_digest_file(target_filename)
+ self.resume.enable("capture")
+ else:
+ log.warning("Couldn't create stage tarball: %s",
+ target_filename)
def run_local(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("run_local"):
log.notice('Resume point detected, skipping run_local operation...')
- else:
- try:
- if os.path.exists(self.settings["controller_file"]):
- log.info('run_local() starting controller script...')
- cmd([self.settings['controller_file'], 'run'],
- env=self.env)
- self.resume.enable("run_local")
- else:
- log.info('run_local() no controller_file found... %s',
- self.settings['controller_file'])
+ return
- except CatalystError:
- self.unbind()
- raise CatalystError("Stage build aborting due to error.",
- print_traceback=False)
+ try:
+ if os.path.exists(self.settings["controller_file"]):
+ log.info('run_local() starting controller script...')
+ cmd([self.settings['controller_file'], 'run'],
+ env=self.env)
+ self.resume.enable("run_local")
+ else:
+ log.info('run_local() no controller_file found... %s',
+ self.settings['controller_file'])
+
+ except CatalystError:
+ self.unbind()
+ raise CatalystError("Stage build aborting due to error.",
+ print_traceback=False)
def setup_environment(self):
"""
@@ -1390,63 +1400,67 @@ class StageBase(TargetBase, ClearBase, GenBase):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("unmerge"):
log.notice('Resume point detected, skipping unmerge operation...')
- else:
- if self.settings["spec_prefix"] + "/unmerge" in self.settings:
- if isinstance(self.settings[self.settings['spec_prefix'] + '/unmerge'], str):
- self.settings[self.settings["spec_prefix"] + "/unmerge"] = \
- [self.settings[self.settings["spec_prefix"] + "/unmerge"]]
+ return
- # Before cleaning, unmerge stuff
- try:
- cmd([self.settings['controller_file'], 'unmerge'] +
- self.settings[self.settings['spec_prefix'] + '/unmerge'],
- env=self.env)
- log.info('unmerge shell script')
- except CatalystError:
- self.unbind()
- raise
- self.resume.enable("unmerge")
+ if self.settings["spec_prefix"] + "/unmerge" in self.settings:
+ if isinstance(self.settings[self.settings['spec_prefix'] + '/unmerge'], str):
+ self.settings[self.settings["spec_prefix"] + "/unmerge"] = \
+ [self.settings[self.settings["spec_prefix"] + "/unmerge"]]
+
+ # Before cleaning, unmerge stuff
+ try:
+ cmd([self.settings['controller_file'], 'unmerge'] +
+ self.settings[self.settings['spec_prefix'] + '/unmerge'],
+ env=self.env)
+ log.info('unmerge shell script')
+ except CatalystError:
+ self.unbind()
+ raise
+ self.resume.enable("unmerge")
def target_setup(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("target_setup"):
log.notice(
'Resume point detected, skipping target_setup operation...')
- else:
- log.notice('Setting up filesystems per filesystem type')
- cmd([self.settings['controller_file'], 'target_image_setup',
- self.settings['target_path']], env=self.env)
- self.resume.enable("target_setup")
+ return
+
+ log.notice('Setting up filesystems per filesystem type')
+ cmd([self.settings['controller_file'], 'target_image_setup',
+ self.settings['target_path']], env=self.env)
+ self.resume.enable("target_setup")
def setup_overlay(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("setup_overlay"):
log.notice(
'Resume point detected, skipping setup_overlay operation...')
- else:
- if self.settings["spec_prefix"] + "/overlay" in self.settings:
- for x in self.settings[self.settings["spec_prefix"] + "/overlay"]:
- if os.path.exists(x):
- cmd(['rsync', '-a', x + '/', self.settings['target_path']],
- env=self.env)
- self.resume.enable("setup_overlay")
+ return
+
+ if self.settings["spec_prefix"] + "/overlay" in self.settings:
+ for x in self.settings[self.settings["spec_prefix"] + "/overlay"]:
+ if os.path.exists(x):
+ cmd(['rsync', '-a', x + '/', self.settings['target_path']],
+ env=self.env)
+ self.resume.enable("setup_overlay")
def create_iso(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("create_iso"):
log.notice(
'Resume point detected, skipping create_iso operation...')
+ return
+
+ # Create the ISO
+ if "iso" in self.settings:
+ cmd([self.settings['controller_file'], 'iso', self.settings['iso']],
+ env=self.env)
+ self.gen_contents_file(self.settings["iso"])
+ self.gen_digest_file(self.settings["iso"])
+ self.resume.enable("create_iso")
else:
- # Create the ISO
- if "iso" in self.settings:
- cmd([self.settings['controller_file'], 'iso', self.settings['iso']],
- env=self.env)
- self.gen_contents_file(self.settings["iso"])
- self.gen_digest_file(self.settings["iso"])
- self.resume.enable("create_iso")
- else:
- log.warning('livecd/iso was not defined. '
- 'An ISO Image will not be created.')
+ log.warning('livecd/iso was not defined. '
+ 'An ISO Image will not be created.')
def build_packages(self):
build_packages_resume = pjoin(self.settings["autoresume_path"],
@@ -1455,29 +1469,30 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("build_packages"):
log.notice(
'Resume point detected, skipping build_packages operation...')
- else:
- if self.settings["spec_prefix"] + "/packages" in self.settings:
- target_pkgs = self.settings["spec_prefix"] + '/packages'
- if "autoresume" in self.settings["options"] \
- and self.resume.is_enabled("build_packages"):
- log.notice('Resume point detected, skipping build_packages '
- 'operation...')
+ return
+
+ if self.settings["spec_prefix"] + "/packages" in self.settings:
+ target_pkgs = self.settings["spec_prefix"] + '/packages'
+ if "autoresume" in self.settings["options"] \
+ and self.resume.is_enabled("build_packages"):
+ log.notice('Resume point detected, skipping build_packages '
+ 'operation...')
+ else:
+ command = [self.settings['controller_file'],
+ 'build_packages']
+ if isinstance(self.settings[target_pkgs], str):
+ command.append(self.settings[target_pkgs])
else:
- command = [self.settings['controller_file'],
- 'build_packages']
- if isinstance(self.settings[target_pkgs], str):
- command.append(self.settings[target_pkgs])
- else:
- command.extend(self.settings[target_pkgs])
- try:
- cmd(command, env=self.env)
- fileutils.touch(build_packages_resume)
- self.resume.enable("build_packages")
- except CatalystError:
- self.unbind()
- raise CatalystError(
- self.settings["spec_prefix"] +
- "build aborting due to error.")
+ command.extend(self.settings[target_pkgs])
+ try:
+ cmd(command, env=self.env)
+ fileutils.touch(build_packages_resume)
+ self.resume.enable("build_packages")
+ except CatalystError:
+ self.unbind()
+ raise CatalystError(
+ self.settings["spec_prefix"] +
+ "build aborting due to error.")
def build_kernel(self):
'''Build all configured kernels'''
@@ -1485,23 +1500,23 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("build_kernel"):
log.notice(
'Resume point detected, skipping build_kernel operation...')
- else:
- if "boot/kernel" in self.settings:
- try:
- mynames = self.settings["boot/kernel"]
- if isinstance(mynames, str):
- mynames = [mynames]
- # Execute the script that sets up the kernel build environment
- cmd([self.settings['controller_file'], 'pre-kmerge'],
- env=self.env)
- for kname in mynames:
- self._build_kernel(kname=kname)
- self.resume.enable("build_kernel")
- except CatalystError:
- self.unbind()
- raise CatalystError(
- "build aborting due to kernel build error.",
- print_traceback=True)
+ return
+
+ if "boot/kernel" in self.settings:
+ try:
+ mynames = self.settings["boot/kernel"]
+ if isinstance(mynames, str):
+ mynames = [mynames]
+ # Execute the script that sets up the kernel build environment
+ cmd([self.settings['controller_file'], 'pre-kmerge'], env=self.env)
+ for kname in mynames:
+ self._build_kernel(kname=kname)
+ self.resume.enable("build_kernel")
+ except CatalystError:
+ self.unbind()
+ raise CatalystError(
+ "build aborting due to kernel build error.",
+ print_traceback=True)
def _build_kernel(self, kname):
"Build a single configured kernel by name"
@@ -1579,31 +1594,33 @@ class StageBase(TargetBase, ClearBase, GenBase):
and self.resume.is_enabled("bootloader"):
log.notice(
'Resume point detected, skipping bootloader operation...')
- else:
- try:
- cmd([self.settings['controller_file'], 'bootloader',
- self.settings['target_path'].rstrip('/')],
- env=self.env)
- self.resume.enable("bootloader")
- except CatalystError:
- self.unbind()
- raise CatalystError("Script aborting due to error.")
+ return
+
+ try:
+ cmd([self.settings['controller_file'], 'bootloader',
+ self.settings['target_path'].rstrip('/')],
+ env=self.env)
+ self.resume.enable("bootloader")
+ except CatalystError:
+ self.unbind()
+ raise CatalystError("Script aborting due to error.")
def livecd_update(self):
if "autoresume" in self.settings["options"] \
and self.resume.is_enabled("livecd_update"):
log.notice(
'Resume point detected, skipping build_packages operation...')
- else:
- try:
- cmd([self.settings['controller_file'], 'livecd-update'],
- env=self.env)
- self.resume.enable("livecd_update")
+ return
- except CatalystError:
- self.unbind()
- raise CatalystError(
- "build aborting due to livecd_update error.")
+ try:
+ cmd([self.settings['controller_file'], 'livecd-update'],
+ env=self.env)
+ self.resume.enable("livecd_update")
+
+ except CatalystError:
+ self.unbind()
+ raise CatalystError(
+ "build aborting due to livecd_update error.")
@staticmethod
def _debug_pause_():
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 3:01 ` Brian Dolbec
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 03/37] catalyst: Fix obvious logic error Matt Turner
` (34 subsequent siblings)
35 siblings, 1 reply; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
We don't use os.system anymore. We pass self.env to Popen, so the
comment isn't accurate.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 5 -----
1 file changed, 5 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 48157837..532f7133 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1307,11 +1307,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
print_traceback=False)
def setup_environment(self):
- """
- Modify the current environment. This is an ugly hack that should be
- fixed. We need this to use the os.system() call since we can't
- specify our own environ
- """
log.debug('setup_environment(); settings = %r', self.settings)
for x in list(self.settings):
log.debug('setup_environment(); processing: %s', x)
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 03/37] catalyst: Fix obvious logic error
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 04/37] catalyst: Add and use sanitize_name() function Matt Turner
` (33 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Broken since 2005. I don't even know what the author could have been
thinking when they changed this.
Fixes: c06264e3 ("Initial import of Catalyst 2.0.0")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 532f7133..6f5aa23a 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1530,9 +1530,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
if not isinstance(myopts, str):
myopts = ' '.join(myopts)
- self.env[kname + "_kernelopts"] = myopts
- else:
- self.env[kname + "_kernelopts"] = ""
+ self.env[kname + "_kernelopts"] = myopts
key = 'boot/kernel/' + kname + '/extraversion'
self.settings.setdefault(key, '')
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 04/37] catalyst: Add and use sanitize_name() function
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 03/37] catalyst: Fix obvious logic error Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 05/37] catalyst: Sanitize variable kernel name before giving it to bash Matt Turner
` (32 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Will be used in an additional place in a follow-on commit.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 10 +++++-----
catalyst/support.py | 9 +++++++++
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 6f5aa23a..1ccc9f04 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -16,7 +16,8 @@ from DeComp.compress import CompressMap
from catalyst import log
from catalyst.defaults import (confdefaults, MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN)
from catalyst.support import (CatalystError, file_locate, normpath,
- cmd, read_makeconf, ismount, file_check)
+ cmd, read_makeconf, ismount, file_check,
+ sanitize_name)
from catalyst.base.targetbase import TargetBase
from catalyst.base.clearbase import ClearBase
from catalyst.base.genbase import GenBase
@@ -1314,10 +1315,9 @@ class StageBase(TargetBase, ClearBase, GenBase):
for opt in self.settings[x]:
self.env['clst_' + opt.upper()] = "true"
continue
- # Sanitize var names by doing "s|/-.|_|g"
- varname = "clst_" + x.replace("/", "_")
- varname = varname.replace("-", "_")
- varname = varname.replace(".", "_")
+
+ varname = 'clst_' + sanitize_name(x)
+
if isinstance(self.settings[x], str):
# Prefix to prevent namespace clashes
if "path" in x:
diff --git a/catalyst/support.py b/catalyst/support.py
index a6a6854a..f49315a5 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -256,3 +256,12 @@ def normpath(mypath):
if TrailingSlash:
newpath = newpath+'/'
return newpath
+
+
+def sanitize_name(name: str) -> str:
+ """
+ Normalize name by replacing [.-/] with _, so it may be used as a
+ variable name in bash
+ """
+ table = str.maketrans(".-/", "___")
+ return name.translate(table)
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 05/37] catalyst: Sanitize variable kernel name before giving it to bash
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (2 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 04/37] catalyst: Add and use sanitize_name() function Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 06/37] targets: Fix filtered_kname Matt Turner
` (31 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 1ccc9f04..ffcc211c 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1504,7 +1504,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
mynames = [mynames]
# Execute the script that sets up the kernel build environment
cmd([self.settings['controller_file'], 'pre-kmerge'], env=self.env)
- for kname in mynames:
+ for kname in [sanitize_name(name) for name in mynames]:
self._build_kernel(kname=kname)
self.resume.enable("build_kernel")
except CatalystError:
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 06/37] targets: Fix filtered_kname
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (3 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 05/37] catalyst: Sanitize variable kernel name before giving it to bash Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 07/37] targets: Consolidate evals using filtered_kname Matt Turner
` (30 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
A follow-on commit is going to remove this code, but I thought it was
still valuable to fix the immediate problem for documentation purporses.
Broken since it was first added in 2006.
Fixes: 6aa64bf7 ("filter kname so - and . work")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 702c5454..d150a530 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -126,7 +126,7 @@ rm /etc/localtime
cp -f /usr/share/zoneinfo/UTC /etc/localtime
filtered_kname=${clst_kname/-/_}
-filtered_kname=${clst_kname/\//_}
+filtered_kname=${filtered_kname/\//_}
filtered_kname=${filtered_kname/\./_}
eval "clst_kernel_use=\$clst_boot_kernel_${filtered_kname}_use"
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 07/37] targets: Consolidate evals using filtered_kname
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (4 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 06/37] targets: Fix filtered_kname Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 08/37] targets: Remove filtered_kname Matt Turner
` (29 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index d150a530..b0583785 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -65,9 +65,6 @@ setup_gk_args() {
}
genkernel_compile(){
- eval "clst_initramfs_overlay=\$clst_boot_kernel_${filtered_kname}_initramfs_overlay"
- eval "clst_kernel_merge=\$clst_boot_kernel_${filtered_kname}_packages"
-
setup_gk_args
#echo "The GK_ARGS are"
#echo ${GK_ARGS[@]}
@@ -129,6 +126,8 @@ filtered_kname=${clst_kname/-/_}
filtered_kname=${filtered_kname/\//_}
filtered_kname=${filtered_kname/\./_}
+eval "clst_initramfs_overlay=\$clst_boot_kernel_${filtered_kname}_initramfs_overlay"
+eval "clst_kernel_merge=\$clst_boot_kernel_${filtered_kname}_packages"
eval "clst_kernel_use=\$clst_boot_kernel_${filtered_kname}_use"
eval eval clst_kernel_gk_kernargs=( \$clst_boot_kernel_${filtered_kname}_gk_kernargs )
eval "clst_ksource=\$clst_boot_kernel_${filtered_kname}_sources"
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 08/37] targets: Remove filtered_kname
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (5 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 07/37] targets: Consolidate evals using filtered_kname Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 09/37] targets: Remove useless sleep 0 Matt Turner
` (28 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Now that the Python code passes the sanitize name, we don't need this.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index b0583785..b4c3963a 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -122,15 +122,11 @@ export CONFIG_PROTECT="-*"
rm /etc/localtime
cp -f /usr/share/zoneinfo/UTC /etc/localtime
-filtered_kname=${clst_kname/-/_}
-filtered_kname=${filtered_kname/\//_}
-filtered_kname=${filtered_kname/\./_}
-
-eval "clst_initramfs_overlay=\$clst_boot_kernel_${filtered_kname}_initramfs_overlay"
-eval "clst_kernel_merge=\$clst_boot_kernel_${filtered_kname}_packages"
-eval "clst_kernel_use=\$clst_boot_kernel_${filtered_kname}_use"
-eval eval clst_kernel_gk_kernargs=( \$clst_boot_kernel_${filtered_kname}_gk_kernargs )
-eval "clst_ksource=\$clst_boot_kernel_${filtered_kname}_sources"
+eval "clst_initramfs_overlay=\$clst_boot_kernel_${kname}_initramfs_overlay"
+eval "clst_kernel_merge=\$clst_boot_kernel_${kname}_packages"
+eval "clst_kernel_use=\$clst_boot_kernel_${kname}_use"
+eval eval clst_kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
+eval "clst_ksource=\$clst_boot_kernel_${kname}_sources"
if [ -z "${clst_ksource}" ]
then
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 09/37] targets: Remove useless sleep 0
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (6 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 08/37] targets: Remove filtered_kname Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 10/37] targets: Remove trivial build_kernel() function Matt Turner
` (27 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/netboot-final.sh | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/targets/support/netboot-final.sh b/targets/support/netboot-final.sh
index f71e4099..7a26e0f4 100755
--- a/targets/support/netboot-final.sh
+++ b/targets/support/netboot-final.sh
@@ -20,12 +20,6 @@ rmdir ${clst_target_path}/boot
# Any post-processing necessary for each architecture can be done here. This
# may include things like sparc's elftoaout, x86's PXE boot, etc.
case ${clst_hostarch} in
- alpha)
- sleep 0
- ;;
- arm)
- sleep 0
- ;;
hppa)
# Only one kernel should be there
kname=${clst_boot_kernel[0]}
@@ -52,11 +46,5 @@ case ${clst_hostarch} in
${piggyback} ${clst_target_path}/${x}-a.out ${clst_target_path}/kernels/misc/System-${x}.map ${clst_target_path}/kernels/misc/${x}.igz
done
;;
- ia64)
- sleep 0
- ;;
- x86|amd64)
- sleep 0
- ;;
esac
exit $?
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 10/37] targets: Remove trivial build_kernel() function
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (7 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 09/37] targets: Remove useless sleep 0 Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 11/37] targets: Remove some disabled debugging messages Matt Turner
` (26 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index b4c3963a..bcc83cd6 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -111,10 +111,6 @@ genkernel_compile(){
fi
}
-build_kernel() {
- genkernel_compile
-}
-
[ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
export CONFIG_PROTECT="-*"
@@ -268,7 +264,8 @@ fi
make_destpath
-build_kernel
+genkernel_compile
+
sed -i "/USE=\"\${USE} ${clst_kernel_use} \"/d" ${clst_make_conf}
# grep out the kernel version so that we can do our modules magic
VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 11/37] targets: Remove some disabled debugging messages
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (8 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 10/37] targets: Remove trivial build_kernel() function Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 12/37] targets: Remove some unnecessary exports Matt Turner
` (25 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index bcc83cd6..3d7f697a 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -66,8 +66,7 @@ setup_gk_args() {
genkernel_compile(){
setup_gk_args
- #echo "The GK_ARGS are"
- #echo ${GK_ARGS[@]}
+
export clst_kernel_merge
export clst_initramfs_overlay
# Build our list of kernel packages
@@ -146,7 +145,6 @@ then
STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
if [ "${STR1}" = "${STR2}" ]
then
- #echo "USE Flags match"
USE_MATCH=1
else
[ -d /tmp/kerncache/${clst_kname}/ebuilds ] && \
@@ -163,7 +161,6 @@ then
STR2=${clst_kextraversion}
if [ "${STR1}" = "${STR2}" ]
then
- #echo "EXTRAVERSION match"
EXTRAVERSION_MATCH=1
fi
fi
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 12/37] targets: Remove some unnecessary exports
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (9 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 11/37] targets: Remove some disabled debugging messages Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 13/37] targets: Remove more clst_ prefixes Matt Turner
` (24 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 2 --
1 file changed, 2 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 3d7f697a..0e72e98b 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -67,8 +67,6 @@ setup_gk_args() {
genkernel_compile(){
setup_gk_args
- export clst_kernel_merge
- export clst_initramfs_overlay
# Build our list of kernel packages
case ${clst_livecd_type} in
gentoo-release-live*)
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 13/37] targets: Remove more clst_ prefixes
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (10 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 12/37] targets: Remove some unnecessary exports Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 14/37] targets: Remove some comments whose meanings have been lost Matt Turner
` (23 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
clst_* prefixed variables are created by setup_environment(), which
these variables are not.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/embedded/controller.sh | 2 +-
targets/livecd-stage2/controller.sh | 4 +-
targets/netboot/controller.sh | 4 +-
targets/stage4/controller.sh | 4 +-
targets/support/bootloader-setup.sh | 6 +-
targets/support/kmerge.sh | 112 ++++++++++++++--------------
6 files changed, 66 insertions(+), 66 deletions(-)
diff --git a/targets/embedded/controller.sh b/targets/embedded/controller.sh
index e40a913f..d0bf331d 100755
--- a/targets/embedded/controller.sh
+++ b/targets/embedded/controller.sh
@@ -40,7 +40,7 @@ case ${1} in
kernel)
shift
- export clst_kname="${1}"
+ export kname="${1}"
[ -n "${clst_linuxrc}" ] && \
copy_to_chroot ${clst_linuxrc} /tmp/linuxrc
diff --git a/targets/livecd-stage2/controller.sh b/targets/livecd-stage2/controller.sh
index 0701a26b..566571e6 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -15,14 +15,14 @@ case $1 in
kernel)
shift
- export clst_kname="$1"
+ export kname="$1"
[ -n "${clst_linuxrc}" ] && \
copy_to_chroot ${clst_linuxrc} /tmp/linuxrc
exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot /tmp/linuxrc
- extract_modules ${clst_chroot_path} ${clst_kname}
+ extract_modules ${clst_chroot_path} ${kname}
#16:12 <@solar> kernel_name=foo
#16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar
#16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh
index f84a32bd..e6fc9d2b 100755
--- a/targets/netboot/controller.sh
+++ b/targets/netboot/controller.sh
@@ -24,7 +24,7 @@ case ${1} in
kernel)
shift
- export clst_kname="$1"
+ export kname="$1"
[ -n "${clst_linuxrc}" ] && \
copy_to_chroot ${clst_linuxrc} /tmp/linuxrc
@@ -36,7 +36,7 @@ case ${1} in
delete_from_chroot /tmp/linuxrc
delete_from_chroot /tmp/busy-config
- extract_modules ${clst_chroot_path} ${clst_kname}
+ extract_modules ${clst_chroot_path} ${kname}
#16:12 <@solar> kernel_name=foo
#16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar
#16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config
diff --git a/targets/stage4/controller.sh b/targets/stage4/controller.sh
index 7ca3e9bc..7825f800 100755
--- a/targets/stage4/controller.sh
+++ b/targets/stage4/controller.sh
@@ -21,7 +21,7 @@ case $1 in
kernel)
shift
- export clst_kname="$1"
+ export kname="$1"
# If we have our own linuxrc, copy it in
[ -n "${clst_linuxrc}" ] && \
@@ -29,7 +29,7 @@ case $1 in
exec_in_chroot ${clst_shdir}/support/kmerge.sh
delete_from_chroot /tmp/linuxrc
- extract_modules ${clst_chroot_path} ${clst_kname}
+ extract_modules ${clst_chroot_path} ${kname}
;;
build_packages)
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index 0643a04c..a82b69dc 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -102,7 +102,7 @@ case ${clst_hostarch} in
echo '' >> ${iacfg}
for x in ${clst_boot_kernel}
do
- eval "clst_kernel_console=\$clst_boot_kernel_${x}_console"
+ eval "kernel_console=\$clst_boot_kernel_${x}_console"
eval custom_kopts=\$${x}_kernelopts
echo "menuentry 'Boot LiveCD (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg}
@@ -114,10 +114,10 @@ case ${clst_hostarch} in
echo " linux ${kern_subdir}/${x} ${default_append_line[@]} docache" >> ${iacfg}
echo " initrd ${kern_subdir}/${x}.igz" >> ${iacfg}
echo "}" >> ${iacfg}
- if [ -n "${clst_kernel_console}" ]
+ if [ -n "${kernel_console}" ]
then
echo "submenu 'Special console options (kernel: ${x})' --class gnu-linux --class os {" >> ${iacfg}
- for y in ${clst_kernel_console}
+ for y in ${kernel_console}
do
echo "menuentry 'Boot LiveCD (kernel: ${x} console=${y})' --class gnu-linux --class os {" >> ${iacfg}
echo " linux ${kern_subdir}/${x} ${default_append_line[@]} console=${y}" >> ${iacfg}
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 0e72e98b..15a21b90 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -3,17 +3,17 @@
source /tmp/chroot-functions.sh
install -d /tmp/kerncache
-PKGDIR=/tmp/kerncache/${clst_kname}/ebuilds
+PKGDIR=/tmp/kerncache/${kname}/ebuilds
setup_gk_args() {
# default genkernel args
GK_ARGS=(
- "${clst_kernel_gk_kernargs[@]}"
- --cachedir=/tmp/kerncache/${clst_kname}-genkernel_cache-${clst_version_stamp}
+ "${kernel_gk_kernargs[@]}"
+ --cachedir=/tmp/kerncache/${kname}-genkernel_cache-${clst_version_stamp}
--no-mountboot
--kerneldir=/usr/src/linux
- --modulespackage=/tmp/kerncache/${clst_kname}-modules-${clst_version_stamp}.tar.bz2
- --minkernpackage=/tmp/kerncache/${clst_kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 all
+ --modulespackage=/tmp/kerncache/${kname}-modules-${clst_version_stamp}.tar.bz2
+ --minkernpackage=/tmp/kerncache/${kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 all
)
# extra genkernel options that we have to test for
if [ -n "${clst_gk_mainargs}" ]
@@ -22,16 +22,16 @@ setup_gk_args() {
fi
if [ -n "${clst_KERNCACHE}" ]
then
- GK_ARGS+=(--kerncache=/tmp/kerncache/${clst_kname}-kerncache-${clst_version_stamp}.tar.bz2)
+ GK_ARGS+=(--kerncache=/tmp/kerncache/${kname}-kerncache-${clst_version_stamp}.tar.bz2)
fi
- if [ -e /var/tmp/${clst_kname}.config ]
+ if [ -e /var/tmp/${kname}.config ]
then
- GK_ARGS+=(--kernel-config=/var/tmp/${clst_kname}.config)
+ GK_ARGS+=(--kernel-config=/var/tmp/${kname}.config)
fi
- if [ -d "/tmp/initramfs_overlay/${clst_initramfs_overlay}" ]
+ if [ -d "/tmp/initramfs_overlay/${initramfs_overlay}" ]
then
- GK_ARGS+=(--initramfs-overlay=/tmp/initramfs_overlay/${clst_initramfs_overlay})
+ GK_ARGS+=(--initramfs-overlay=/tmp/initramfs_overlay/${initramfs_overlay})
fi
if [ -n "${clst_CCACHE}" ]
then
@@ -70,10 +70,10 @@ genkernel_compile(){
# Build our list of kernel packages
case ${clst_livecd_type} in
gentoo-release-live*)
- if [ -n "${clst_kernel_merge}" ]
+ if [ -n "${kernel_merge}" ]
then
mkdir -p /usr/livecd
- echo "${clst_kernel_merge}" > /usr/livecd/kernelpkgs.txt
+ echo "${kernel_merge}" > /usr/livecd/kernelpkgs.txt
fi
;;
esac
@@ -94,17 +94,17 @@ genkernel_compile(){
then
gk_callback_opts+=(-f)
fi
- if [ "${clst_kernel_merge}" != "" ]
+ if [ "${kernel_merge}" != "" ]
then
- genkernel --callback="emerge ${gk_callback_opts[@]} ${clst_kernel_merge}" \
+ genkernel --callback="emerge ${gk_callback_opts[@]} ${kernel_merge}" \
"${GK_ARGS[@]}" || exit 1
else
genkernel "${GK_ARGS[@]}" || exit 1
fi
- if [ -n "${clst_KERNCACHE}" -a -e /var/tmp/${clst_kname}.config ]
+ if [ -n "${clst_KERNCACHE}" -a -e /var/tmp/${kname}.config ]
then
- md5sum /var/tmp/${clst_kname}.config | awk '{print $1}' > \
- /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG
+ md5sum /var/tmp/${kname}.config | awk '{print $1}' > \
+ /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG
fi
}
@@ -115,15 +115,15 @@ export CONFIG_PROTECT="-*"
rm /etc/localtime
cp -f /usr/share/zoneinfo/UTC /etc/localtime
-eval "clst_initramfs_overlay=\$clst_boot_kernel_${kname}_initramfs_overlay"
-eval "clst_kernel_merge=\$clst_boot_kernel_${kname}_packages"
-eval "clst_kernel_use=\$clst_boot_kernel_${kname}_use"
-eval eval clst_kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
-eval "clst_ksource=\$clst_boot_kernel_${kname}_sources"
+eval "initramfs_overlay=\$clst_boot_kernel_${kname}_initramfs_overlay"
+eval "kernel_merge=\$clst_boot_kernel_${kname}_packages"
+eval "kernel_use=\$clst_boot_kernel_${kname}_use"
+eval eval kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
+eval "ksource=\$clst_boot_kernel_${kname}_sources"
-if [ -z "${clst_ksource}" ]
+if [ -z "${ksource}" ]
then
- clst_ksource="virtual/linux-sources"
+ ksource="virtual/linux-sources"
fi
# Don't use pkgcache here, as the kernel source may get emerged with different
@@ -137,25 +137,25 @@ if [ -n "${clst_KERNCACHE}" ]
then
USE_MATCH=0
- if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE ]
+ if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE ]
then
- STR1=$(for i in `cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
- STR2=$(for i in ${clst_kernel_use}; do echo $i; done|sort)
+ STR1=$(for i in `cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
+ STR2=$(for i in ${kernel_use}; do echo $i; done|sort)
if [ "${STR1}" = "${STR2}" ]
then
USE_MATCH=1
else
- [ -d /tmp/kerncache/${clst_kname}/ebuilds ] && \
- rm -r /tmp/kerncache/${clst_kname}/ebuilds
- [ -e /tmp/kerncache/${clst_kname}/usr/src/linux/.config ] && \
- rm /tmp/kerncache/${clst_kname}/usr/src/linux/.config
+ [ -d /tmp/kerncache/${kname}/ebuilds ] && \
+ rm -r /tmp/kerncache/${kname}/ebuilds
+ [ -e /tmp/kerncache/${kname}/usr/src/linux/.config ] && \
+ rm /tmp/kerncache/${kname}/usr/src/linux/.config
fi
fi
EXTRAVERSION_MATCH=0
- if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION ]
+ if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION ]
then
- STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION`
+ STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION`
STR2=${clst_kextraversion}
if [ "${STR1}" = "${STR2}" ]
then
@@ -164,14 +164,14 @@ then
fi
CONFIG_MATCH=0
- if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG ]
+ if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG ]
then
- if [ ! -e /var/tmp/${clst_kname}.config ]
+ if [ ! -e /var/tmp/${kname}.config ]
then
CONFIG_MATCH=1
else
- STR1=`cat /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.CONFIG`
- STR2=`md5sum /var/tmp/${clst_kname}.config|awk '{print $1}'`
+ STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG`
+ STR2=`md5sum /var/tmp/${kname}.config|awk '{print $1}'`
if [ "${STR1}" = "${STR2}" ]
then
CONFIG_MATCH=1
@@ -181,14 +181,14 @@ then
# install dependencies of kernel sources ahead of time in case
# package.provided generated below causes them not to be (re)installed
- PKGDIR=${PKGDIR} run_merge --onlydeps "${clst_ksource}"
+ PKGDIR=${PKGDIR} run_merge --onlydeps "${ksource}"
# Create the kerncache directory if it doesn't exists
- mkdir -p /tmp/kerncache/${clst_kname}
+ mkdir -p /tmp/kerncache/${kname}
- if [ -e /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION ]
+ if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION ]
then
- KERNELVERSION=$(</tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION)
+ KERNELVERSION=$(</tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION)
mkdir -p ${clst_port_conf}/profile
echo "${KERNELVERSION}" > ${clst_port_conf}/profile/package.provided
else
@@ -196,26 +196,26 @@ then
fi
# Don't use package.provided if there's a pending up/downgrade
- if [[ "$(portageq best_visible / ${clst_ksource})" == "${KERNELVERSION}" ]]; then
- echo "No pending updates for ${clst_ksource}"
+ if [[ "$(portageq best_visible / ${ksource})" == "${KERNELVERSION}" ]]; then
+ echo "No pending updates for ${ksource}"
else
- echo "Pending updates for ${clst_ksource}, removing package.provided"
+ echo "Pending updates for ${ksource}, removing package.provided"
rm -f ${clst_port_conf}/profile/package.provided
fi
[ -L /usr/src/linux ] && rm -f /usr/src/linux
- PKGDIR=${PKGDIR} run_merge "${clst_ksource}"
+ PKGDIR=${PKGDIR} run_merge "${ksource}"
- SOURCESDIR="/tmp/kerncache/${clst_kname}/sources"
+ SOURCESDIR="/tmp/kerncache/${kname}/sources"
if [ -L /usr/src/linux ]
then
# A kernel was merged, move it to $SOURCESDIR
[ -e ${SOURCESDIR} ] && rm -Rf ${SOURCESDIR}
- KERNELVERSION=`portageq best_visible / "${clst_ksource}"`
- echo "${KERNELVERSION}" > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.KERNELVERSION
+ KERNELVERSION=`portageq best_visible / "${ksource}"`
+ echo "${KERNELVERSION}" > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION
echo "Moving kernel sources to ${SOURCESDIR} ..."
mv `readlink -f /usr/src/linux` ${SOURCESDIR}
@@ -231,18 +231,18 @@ then
then
echo "Setting extraversion to ${clst_kextraversion}"
sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
- echo ${clst_kextraversion} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
+ echo ${clst_kextraversion} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
else
- touch /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.EXTRAVERSION
+ touch /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
fi
fi
else
- run_merge "${clst_ksource}"
+ run_merge "${ksource}"
#ensure that there is a /usr/src/linux symlink and it points to the sources we just installed
echo "Adjusting /usr/src/linux to point to \
-$(portageq contents / $(portageq best_visible / "${clst_ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null)"
- ln -snf $(portageq contents / $(portageq best_visible / "${clst_ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null) \
+$(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null)"
+ ln -snf $(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null) \
/usr/src/linux
if [ ! "${clst_kextraversion}" = "" ]
then
@@ -254,14 +254,14 @@ fi
# Update USE flag in make.conf
[ -e ${clst_make_conf} ] && \
- echo "USE=\"\${USE} ${clst_kernel_use} build\"" >> ${clst_make_conf}
+ echo "USE=\"\${USE} ${kernel_use} build\"" >> ${clst_make_conf}
make_destpath
genkernel_compile
-sed -i "/USE=\"\${USE} ${clst_kernel_use} \"/d" ${clst_make_conf}
+sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
# grep out the kernel version so that we can do our modules magic
VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
@@ -274,5 +274,5 @@ unset USE
if [ -n "${clst_KERNCACHE}" ]
then
- echo ${clst_kernel_use} > /tmp/kerncache/${clst_kname}/${clst_kname}-${clst_version_stamp}.USE
+ echo ${kernel_use} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE
fi
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 14/37] targets: Remove some comments whose meanings have been lost
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (11 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 13/37] targets: Remove more clst_ prefixes Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 15/37] targets: Use pkgcache for kernel sources Matt Turner
` (22 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/livecd-stage2/controller.sh | 3 ---
targets/netboot/controller.sh | 3 ---
2 files changed, 6 deletions(-)
diff --git a/targets/livecd-stage2/controller.sh b/targets/livecd-stage2/controller.sh
index 566571e6..fe078eed 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -23,9 +23,6 @@ case $1 in
delete_from_chroot /tmp/linuxrc
extract_modules ${clst_chroot_path} ${kname}
- #16:12 <@solar> kernel_name=foo
- #16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar
- #16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config
;;
preclean)
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh
index e6fc9d2b..b8d8ec23 100755
--- a/targets/netboot/controller.sh
+++ b/targets/netboot/controller.sh
@@ -37,9 +37,6 @@ case ${1} in
delete_from_chroot /tmp/busy-config
extract_modules ${clst_chroot_path} ${kname}
- #16:12 <@solar> kernel_name=foo
- #16:13 <@solar> eval clst_boot_kernel_${kernel_name}_config=bar
- #16:13 <@solar> eval echo \$clst_boot_kernel_${kernel_name}_config
;;
image)
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 15/37] targets: Use pkgcache for kernel sources
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (12 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 14/37] targets: Remove some comments whose meanings have been lost Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 16/37] targets: Remove a bunch of stray newlines Matt Turner
` (21 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
The rationale for not using it before made sense, given that multiple
binpkgs could not exist for the same version of a package. But we now
use FEATURES=binpkg-multi-instance so this is no longer the case.
The dumbest part of this is that the code wasn't even disabling the
package cache. It was instead just overriding PKGDIR to dump the binary
package into a location (named "ebuilds" no less!) that emerge would
never otherwise use.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 15a21b90..aec4d71e 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -3,7 +3,6 @@
source /tmp/chroot-functions.sh
install -d /tmp/kerncache
-PKGDIR=/tmp/kerncache/${kname}/ebuilds
setup_gk_args() {
# default genkernel args
@@ -85,7 +84,6 @@ genkernel_compile(){
else
gk_callback_opts=(-qN)
fi
- PKGDIR=${PKGDIR}
if [ -n "${clst_KERNCACHE}" ]
then
gk_callback_opts+=(-kb)
@@ -126,11 +124,6 @@ then
ksource="virtual/linux-sources"
fi
-# Don't use pkgcache here, as the kernel source may get emerged with different
-# USE variables (and thus different patches enabled/disabled.) Also, there's no
-# real benefit in using the pkgcache for kernel source ebuilds.
-
-
# Check if we have a match in kerncach
if [ -n "${clst_KERNCACHE}" ]
@@ -145,8 +138,6 @@ then
then
USE_MATCH=1
else
- [ -d /tmp/kerncache/${kname}/ebuilds ] && \
- rm -r /tmp/kerncache/${kname}/ebuilds
[ -e /tmp/kerncache/${kname}/usr/src/linux/.config ] && \
rm /tmp/kerncache/${kname}/usr/src/linux/.config
fi
@@ -181,7 +172,7 @@ then
# install dependencies of kernel sources ahead of time in case
# package.provided generated below causes them not to be (re)installed
- PKGDIR=${PKGDIR} run_merge --onlydeps "${ksource}"
+ run_merge --onlydeps "${ksource}"
# Create the kerncache directory if it doesn't exists
mkdir -p /tmp/kerncache/${kname}
@@ -205,7 +196,7 @@ then
[ -L /usr/src/linux ] && rm -f /usr/src/linux
- PKGDIR=${PKGDIR} run_merge "${ksource}"
+ run_merge "${ksource}"
SOURCESDIR="/tmp/kerncache/${kname}/sources"
if [ -L /usr/src/linux ]
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 16/37] targets: Remove a bunch of stray newlines
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (13 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 15/37] targets: Use pkgcache for kernel sources Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 17/37] targets: Delete some more dead code Matt Turner
` (20 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 7 -------
1 file changed, 7 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index aec4d71e..d512954b 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -128,7 +128,6 @@ fi
if [ -n "${clst_KERNCACHE}" ]
then
-
USE_MATCH=0
if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE ]
then
@@ -201,7 +200,6 @@ then
SOURCESDIR="/tmp/kerncache/${kname}/sources"
if [ -L /usr/src/linux ]
then
-
# A kernel was merged, move it to $SOURCESDIR
[ -e ${SOURCESDIR} ] && rm -Rf ${SOURCESDIR}
@@ -210,7 +208,6 @@ then
echo "Moving kernel sources to ${SOURCESDIR} ..."
mv `readlink -f /usr/src/linux` ${SOURCESDIR}
-
fi
ln -sf ${SOURCESDIR} /usr/src/linux
@@ -227,7 +224,6 @@ then
touch /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
fi
fi
-
else
run_merge "${ksource}"
#ensure that there is a /usr/src/linux symlink and it points to the sources we just installed
@@ -242,14 +238,12 @@ $(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev
fi
fi
-
# Update USE flag in make.conf
[ -e ${clst_make_conf} ] && \
echo "USE=\"\${USE} ${kernel_use} build\"" >> ${clst_make_conf}
make_destpath
-
genkernel_compile
sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
@@ -262,7 +256,6 @@ clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV}
unset USE
-
if [ -n "${clst_KERNCACHE}" ]
then
echo ${kernel_use} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 17/37] targets: Delete some more dead code
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (14 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 16/37] targets: Remove a bunch of stray newlines Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 18/37] targets: Remove bizarre make_destpath() call Matt Turner
` (19 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Dead since 2015.
Fixes: 1c7687f6 ("update-modules doesn't exists anymore.")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 7 -------
1 file changed, 7 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index d512954b..911d7cb3 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -247,13 +247,6 @@ make_destpath
genkernel_compile
sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
-# grep out the kernel version so that we can do our modules magic
-VER=`grep ^VERSION\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-PAT=`grep ^PATCHLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-SUB=`grep ^SUBLEVEL\ \= /usr/src/linux/Makefile | awk '{ print $3 };'`
-EXV=`grep ^EXTRAVERSION\ \= /usr/src/linux/Makefile | sed -e "s/EXTRAVERSION =//" -e "s/ //g"`
-clst_fudgeuname=${VER}.${PAT}.${SUB}${EXV}
-
unset USE
if [ -n "${clst_KERNCACHE}" ]
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 18/37] targets: Remove bizarre make_destpath() call
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (15 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 17/37] targets: Delete some more dead code Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 19/37] targets: Remove unnecessary unset USE Matt Turner
` (18 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
The commit that added it says it did so in order to "export ROOT=/ prior
to running genkernel". Why that was necessary is unclear. I can find no
evidence that genkernel needs (or needed) ROOT to be set, and why it
would need ROOT=/ seems even more doubtful.
Fixes: 8fb885ff ("Added an additional make_destpath call to kmerge.sh ...")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 2 --
1 file changed, 2 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 911d7cb3..d65b8142 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -242,8 +242,6 @@ fi
[ -e ${clst_make_conf} ] && \
echo "USE=\"\${USE} ${kernel_use} build\"" >> ${clst_make_conf}
-make_destpath
-
genkernel_compile
sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 19/37] targets: Remove unnecessary unset USE
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (16 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 18/37] targets: Remove bizarre make_destpath() call Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 20/37] targets: Remove wrong make.conf munging Matt Turner
` (17 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Dead code since 2008.
Fixes: 454c1682 ("Rather than using the environment, we write out our USE to make.conf ...")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index d65b8142..4f82a01f 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -245,7 +245,6 @@ fi
genkernel_compile
sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
-unset USE
if [ -n "${clst_KERNCACHE}" ]
then
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 20/37] targets: Remove wrong make.conf munging
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (17 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 19/37] targets: Remove unnecessary unset USE Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 21/37] targets: Use USE=symlink when emerging kernel sources Matt Turner
` (16 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
With pkgcache fixed for kernel sources in a prior commit, I noticed that
if a livecd-stage2 built three kernels, the first would emerge normally
and build a binpkg, the second would emerge and fail to use the binpkg
produced earlier, and the third would use a previously produced binpkg.
I discovered the reason is that the second and third emerges are run
after USE="... build" has been added to make.conf. We intentionally
removed this in commit c0fcbf02 ("kmerge.sh: Don't set USE=build for
emerging kernels.") years ago, so I was surprised to find this code.
The commit mentioned below inexplicably (and wrongly) readded USE=build
to make.conf, failed to update the sed command to remove it, and readded
the addition in entirely the wrong spot so it didn't even affect the
kernel merge.
genkernel doesn't source the system's make.conf, so this code would be
entirely useless if it wasn't harmful.
Fixes: 0343a18e ("Fix merging kernel without kerncache enabled.")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 6 ------
1 file changed, 6 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 4f82a01f..1209e330 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -238,14 +238,8 @@ $(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev
fi
fi
-# Update USE flag in make.conf
-[ -e ${clst_make_conf} ] && \
- echo "USE=\"\${USE} ${kernel_use} build\"" >> ${clst_make_conf}
-
genkernel_compile
-sed -i "/USE=\"\${USE} ${kernel_use} \"/d" ${clst_make_conf}
-
if [ -n "${clst_KERNCACHE}" ]
then
echo ${kernel_use} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 21/37] targets: Use USE=symlink when emerging kernel sources
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (18 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 20/37] targets: Remove wrong make.conf munging Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 22/37] targets: Emerge kernel sources with --update Matt Turner
` (15 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Just use the thing that exists instead of rolling our own...
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 1209e330..7eb18313 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -193,9 +193,7 @@ then
rm -f ${clst_port_conf}/profile/package.provided
fi
- [ -L /usr/src/linux ] && rm -f /usr/src/linux
-
- run_merge "${ksource}"
+ USE=symlink run_merge "${ksource}"
SOURCESDIR="/tmp/kerncache/${kname}/sources"
if [ -L /usr/src/linux ]
@@ -225,12 +223,8 @@ then
fi
fi
else
- run_merge "${ksource}"
- #ensure that there is a /usr/src/linux symlink and it points to the sources we just installed
- echo "Adjusting /usr/src/linux to point to \
-$(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null)"
- ln -snf $(portageq contents / $(portageq best_visible / "${ksource}" 2>/dev/null) 2>/dev/null | grep --color=never '/usr/src/' | head -n1 2>/dev/null) \
- /usr/src/linux
+ USE=symlink run_merge "${ksource}"
+
if [ ! "${clst_kextraversion}" = "" ]
then
echo "Setting extraversion to ${clst_kextraversion}"
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 22/37] targets: Emerge kernel sources with --update
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (19 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 21/37] targets: Use USE=symlink when emerging kernel sources Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 23/37] targets: Default to sys-kernel/gentoo-sources directly Matt Turner
` (14 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Ensure that we have the appropriate version.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 7eb18313..40e208e4 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -193,7 +193,7 @@ then
rm -f ${clst_port_conf}/profile/package.provided
fi
- USE=symlink run_merge "${ksource}"
+ USE=symlink run_merge --update "${ksource}"
SOURCESDIR="/tmp/kerncache/${kname}/sources"
if [ -L /usr/src/linux ]
@@ -223,7 +223,7 @@ then
fi
fi
else
- USE=symlink run_merge "${ksource}"
+ USE=symlink run_merge --update "${ksource}"
if [ ! "${clst_kextraversion}" = "" ]
then
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 23/37] targets: Default to sys-kernel/gentoo-sources directly
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (20 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 22/37] targets: Emerge kernel sources with --update Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 24/37] targets: Rewrite hppa pre-kmerge check Matt Turner
` (13 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Using virtual/linux-sources was a nice idea, but leads to multiple
failures in practice. For example, we use 'portageq contents' later, and
the virtual provides no files. We could handle the indirection with
'portageq expand_virtual' in some cases but that requires the virtual to
be installed on the system.
Fixes: 388def77 ("kmerge.sh blows away the /usr/src/linux symlink ...")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 40e208e4..c4136dec 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -118,11 +118,7 @@ eval "kernel_merge=\$clst_boot_kernel_${kname}_packages"
eval "kernel_use=\$clst_boot_kernel_${kname}_use"
eval eval kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
eval "ksource=\$clst_boot_kernel_${kname}_sources"
-
-if [ -z "${ksource}" ]
-then
- ksource="virtual/linux-sources"
-fi
+[[ -z ${ksource} ]] && ksource="sys-kernel/gentoo-sources"
# Check if we have a match in kerncach
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 24/37] targets: Rewrite hppa pre-kmerge check
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (21 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 23/37] targets: Default to sys-kernel/gentoo-sources directly Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 25/37] targets: Use full 'sys-kernel/genkernel' package name Matt Turner
` (12 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/pre-kmerge.sh | 43 ++++++++++++++---------------------
1 file changed, 17 insertions(+), 26 deletions(-)
diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh
index dd51ae9a..165dfd51 100755
--- a/targets/support/pre-kmerge.sh
+++ b/targets/support/pre-kmerge.sh
@@ -2,32 +2,23 @@
source /tmp/chroot-functions.sh
-case ${clst_hostarch} in
- hppa)
- got_32=0
- got_64=0
- for i in ${clst_boot_kernel}
- do
- if [ "${i: -2}" == "32" ]
- then
- if [ $got_32 -eq 1 ]
- then
- die "Only one 32 bit kernel can be configured"
- fi
- got_32=1
- elif [ "${i: -2}" == "64" ]
- then
- if [ $got_64 -eq 1 ]
- then
- die "Only one 64 bit kernel can be configured"
- fi
- got_64=1
- else
- die "Kernel names must end by either 32 or 64"
- fi
- done
- ;;
-esac
+if [[ ${clst_hostarch} == hppa ]]; then
+ for i in ${clst_boot_kernel}; do
+ case ${i} in
+ *32)
+ let num32++
+ ;;
+ *64)
+ let num64++
+ ;;
+ *)
+ die "Kernel names must end with either \"32\" or \"64\""
+ ;;
+ esac
+ done
+ [[ $num32 > 1 ]] && die "Only one 32-bit kernel can be configured"
+ [[ $num64 > 1 ]] && die "Only one 64-bit kernel can be configured"
+fi
run_merge --oneshot genkernel
install -d /tmp/kerncache
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 25/37] targets: Use full 'sys-kernel/genkernel' package name
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (22 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 24/37] targets: Rewrite hppa pre-kmerge check Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 26/37] targets: Explicitly set RUN_DEFAULT_FUNCS="yes" Matt Turner
` (11 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/pre-kmerge.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh
index 165dfd51..a92c436c 100755
--- a/targets/support/pre-kmerge.sh
+++ b/targets/support/pre-kmerge.sh
@@ -20,5 +20,5 @@ if [[ ${clst_hostarch} == hppa ]]; then
[[ $num64 > 1 ]] && die "Only one 64-bit kernel can be configured"
fi
-run_merge --oneshot genkernel
+run_merge --oneshot sys-kernel/genkernel
install -d /tmp/kerncache
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 26/37] targets: Explicitly set RUN_DEFAULT_FUNCS="yes"
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (23 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 25/37] targets: Use full 'sys-kernel/genkernel' package name Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 27/37] targets: Inline run_default_funcs() function Matt Turner
` (10 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
For documentation purposes.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/pre-kmerge.sh | 2 ++
1 file changed, 2 insertions(+)
diff --git a/targets/support/pre-kmerge.sh b/targets/support/pre-kmerge.sh
index a92c436c..0dfc835e 100755
--- a/targets/support/pre-kmerge.sh
+++ b/targets/support/pre-kmerge.sh
@@ -1,5 +1,7 @@
#!/bin/bash
+RUN_DEFAULT_FUNCS="yes"
+
source /tmp/chroot-functions.sh
if [[ ${clst_hostarch} == hppa ]]; then
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 27/37] targets: Inline run_default_funcs() function
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (24 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 26/37] targets: Explicitly set RUN_DEFAULT_FUNCS="yes" Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 28/37] targets: Move create_handbook_icon() to its use Matt Turner
` (9 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/chroot-functions.sh | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh
index b531eb6a..307a9042 100755
--- a/targets/support/chroot-functions.sh
+++ b/targets/support/chroot-functions.sh
@@ -303,15 +303,6 @@ show_debug() {
fi
}
-run_default_funcs() {
- if [ "${RUN_DEFAULT_FUNCS}" != "no" ]
- then
- update_env_settings
- setup_features
- show_debug
- fi
-}
-
create_handbook_icon() {
# This function creates a local icon to the Gentoo Handbook
echo "[Desktop Entry]
@@ -330,5 +321,9 @@ readonly locales="
C.UTF8 UTF-8
"
-# We do this everywhere, so why not put it in this script
-run_default_funcs
+if [[ ${RUN_DEFAULT_FUNCS} != no ]]
+then
+ update_env_settings
+ setup_features
+ show_debug
+fi
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 28/37] targets: Move create_handbook_icon() to its use
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (25 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 27/37] targets: Inline run_default_funcs() function Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 29/37] targets: Drop warning about no cdtar Matt Turner
` (8 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
And use <<- so we can indent the heredoc properly.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/chroot-functions.sh | 14 --------------
targets/support/livecdfs-update.sh | 15 +++++++++++++++
2 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh
index 307a9042..22340023 100755
--- a/targets/support/chroot-functions.sh
+++ b/targets/support/chroot-functions.sh
@@ -303,20 +303,6 @@ show_debug() {
fi
}
-create_handbook_icon() {
- # This function creates a local icon to the Gentoo Handbook
- echo "[Desktop Entry]
-Encoding=UTF-8
-Version=1.0
-Type=Link
-URL=file:///mnt/cdrom/docs/handbook/html/index.html
-Terminal=false
-Name=Gentoo Linux Handbook
-GenericName=Gentoo Linux Handbook
-Comment=This is a link to the local copy of the Gentoo Linux Handbook.
-Icon=text-editor" > /usr/share/applications/gentoo-handbook.desktop
-}
-
readonly locales="
C.UTF8 UTF-8
"
diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
index 557d990b..47dbb5b3 100755
--- a/targets/support/livecdfs-update.sh
+++ b/targets/support/livecdfs-update.sh
@@ -243,6 +243,21 @@ case ${clst_livecd_type} in
# Clear out lastlog
rm -f /var/log/lastlog && touch /var/log/lastlog
+ create_handbook_icon() {
+ cat <<-EOF > /usr/share/applications/gentoo-handbook.desktop
+ [Desktop Entry]
+ Encoding=UTF-8
+ Version=1.0
+ Type=Link
+ URL=file:///mnt/cdrom/docs/handbook/html/index.html
+ Terminal=false
+ Name=Gentoo Linux Handbook
+ GenericName=Gentoo Linux Handbook
+ Comment=This is a link to the local copy of the Gentoo Linux Handbook.
+ Icon=text-editor
+ EOF
+ }
+
# Create our Handbook icon
[ -e /docs/handbook/index.html ] && create_handbook_icon
[ -n "${clst_livecd_overlay}" ] && [ -e ${clst_livecd_overlay}/docs/handbook/index.html ] && create_handbook_icon
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 29/37] targets: Drop warning about no cdtar
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (26 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 28/37] targets: Move create_handbook_icon() to its use Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 30/37] targets: Remove post-kmerge Matt Turner
` (7 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Most platforms use grub now and don't need a cdtar. Also use double
brackets while we're here.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/bootloader-setup.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/targets/support/bootloader-setup.sh b/targets/support/bootloader-setup.sh
index a82b69dc..ea18f736 100755
--- a/targets/support/bootloader-setup.sh
+++ b/targets/support/bootloader-setup.sh
@@ -4,12 +4,8 @@ source ${clst_shdir}/support/functions.sh
# $1 is the destination root
-if [ -n "${clst_cdtar}" ]
-then
+if [[ -n ${clst_cdtar} ]]; then
extract_cdtar $1
-else
- #While this seems a little crazy, it's entirely possible the bootloader is just shoved in isoroot overlay
- echo "No cdtar and unable to auto generate boot loader files... good luck"
fi
extract_kernels $1/boot
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 30/37] targets: Remove post-kmerge
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (27 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 29/37] targets: Drop warning about no cdtar Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 31/37] targets: Remove unnecessary unset PACKAGES Matt Turner
` (6 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
The find ... touch modules.dep command doesn't seem necessary anymore,
and this is all the script still does. Additionally confusing,
pre-kmerge runs only once while post-kmerge runs once for each kernel.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
catalyst/base/stagebase.py | 4 ----
targets/embedded/controller.sh | 5 -----
targets/livecd-stage2/controller.sh | 5 -----
targets/netboot/controller.sh | 5 -----
targets/stage4/controller.sh | 5 -----
targets/support/post-kmerge.sh | 11 -----------
6 files changed, 35 deletions(-)
delete mode 100755 targets/support/post-kmerge.sh
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index ffcc211c..99d638d8 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -1548,10 +1548,6 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.resume.is_enabled("build_kernel_" + kname)
- # Execute the script that cleans up the kernel build environment
- cmd([self.settings['controller_file'], 'post-kmerge'],
- env=self.env)
-
def _copy_kernel_config(self, kname):
key = 'boot/kernel/' + kname + '/config'
if key in self.settings:
diff --git a/targets/embedded/controller.sh b/targets/embedded/controller.sh
index d0bf331d..48867897 100755
--- a/targets/embedded/controller.sh
+++ b/targets/embedded/controller.sh
@@ -33,11 +33,6 @@ case ${1} in
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
- post-kmerge)
- # Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
- ;;
-
kernel)
shift
export kname="${1}"
diff --git a/targets/livecd-stage2/controller.sh b/targets/livecd-stage2/controller.sh
index fe078eed..30b522e3 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -8,11 +8,6 @@ case $1 in
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
- post-kmerge)
- # Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
- ;;
-
kernel)
shift
export kname="$1"
diff --git a/targets/netboot/controller.sh b/targets/netboot/controller.sh
index b8d8ec23..9a6e14d2 100755
--- a/targets/netboot/controller.sh
+++ b/targets/netboot/controller.sh
@@ -17,11 +17,6 @@ case ${1} in
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
- post-kmerge)
- # Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
- ;;
-
kernel)
shift
export kname="$1"
diff --git a/targets/stage4/controller.sh b/targets/stage4/controller.sh
index 7825f800..ba0774d1 100755
--- a/targets/stage4/controller.sh
+++ b/targets/stage4/controller.sh
@@ -14,11 +14,6 @@ case $1 in
exec_in_chroot ${clst_shdir}/support/pre-kmerge.sh
;;
- post-kmerge)
- # Cleans up the build environment after the kernels are compiled
- exec_in_chroot ${clst_shdir}/support/post-kmerge.sh
- ;;
-
kernel)
shift
export kname="$1"
diff --git a/targets/support/post-kmerge.sh b/targets/support/post-kmerge.sh
deleted file mode 100755
index 58b2e08d..00000000
--- a/targets/support/post-kmerge.sh
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/bash
-
-RUN_DEFAULT_FUNCS="no"
-
-source /tmp/chroot-functions.sh
-
-# Only run depscan.sh if modules exist
-if [ -n "$(ls /lib/modules)" ]
-then
- find /lib/modules -name modules.dep -exec touch {} \;
-fi
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 31/37] targets: Remove unnecessary unset PACKAGES
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (28 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 30/37] targets: Remove post-kmerge Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 32/37] targets: Delete never-used packages.txt code Matt Turner
` (5 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Dead code since 2008.
Fixes: b79d06a3 ("Remove temporary package listing code, ...")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/chroot-functions.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/targets/support/chroot-functions.sh b/targets/support/chroot-functions.sh
index 22340023..7222892e 100755
--- a/targets/support/chroot-functions.sh
+++ b/targets/support/chroot-functions.sh
@@ -270,7 +270,6 @@ run_merge() {
show_debug() {
if [ -n "${clst_DEBUG}" ]
then
- unset PACKAGES
echo "DEBUG:"
echo "Profile/target info:"
echo "Profile inheritance:"
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 32/37] targets: Delete never-used packages.txt code
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (29 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 31/37] targets: Remove unnecessary unset PACKAGES Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 33/37] targets: Remove kernelpkgs.txt generation Matt Turner
` (4 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Added in 2008 with a commit message saying
Added code to livecd-stage1 to generate a package list, which
will be used in livecd-stage2 with the upcoming livedvd
livecd/type to fetch the distfiles automatically.
which sounds like a nice plan, but until it's implemented we don't need
this code.
Fixes: a97c7ee4 ("Updated TODO. ...")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/livecd-stage1/controller.sh | 1 -
targets/livecd-stage2/controller.sh | 1 -
2 files changed, 2 deletions(-)
diff --git a/targets/livecd-stage1/controller.sh b/targets/livecd-stage1/controller.sh
index c4572ff9..ae897da9 100755
--- a/targets/livecd-stage1/controller.sh
+++ b/targets/livecd-stage1/controller.sh
@@ -11,7 +11,6 @@ case $1 in
mkdir -p ${clst_chroot_path}/usr/livecd ${clst_chroot_path}/tmp
exec_in_chroot \
${clst_shdir}/${clst_target}/chroot.sh
- echo "${clst_packages}" > ${clst_chroot_path}/tmp/packages.txt
;;
esac
exit $?
diff --git a/targets/livecd-stage2/controller.sh b/targets/livecd-stage2/controller.sh
index 30b522e3..826dc9dc 100755
--- a/targets/livecd-stage2/controller.sh
+++ b/targets/livecd-stage2/controller.sh
@@ -78,7 +78,6 @@ case $1 in
# Clean out man, info and doc files
rm -rf ${clst_chroot_path}/usr/share/{man,doc,info}/*
fi
- rm -f ${clst_chroot_path}/tmp/packages.txt
;;
bootloader)
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 33/37] targets: Remove kernelpkgs.txt generation
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (30 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 32/37] targets: Delete never-used packages.txt code Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 34/37] targets: Merge setup_gk_args() and genkernel_compile() Matt Turner
` (3 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Evidently this was to be consumed by the Gentoo Linux Installer, which
saw its last commit in 2008.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 10 ----------
targets/support/livecdfs-update.sh | 11 -----------
2 files changed, 21 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index c4136dec..27584d51 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -66,16 +66,6 @@ setup_gk_args() {
genkernel_compile(){
setup_gk_args
- # Build our list of kernel packages
- case ${clst_livecd_type} in
- gentoo-release-live*)
- if [ -n "${kernel_merge}" ]
- then
- mkdir -p /usr/livecd
- echo "${kernel_merge}" > /usr/livecd/kernelpkgs.txt
- fi
- ;;
- esac
# Build with genkernel using the set options
# callback is put here to avoid escaping issues
if [ -n "${clst_VERBOSE}" ]
diff --git a/targets/support/livecdfs-update.sh b/targets/support/livecdfs-update.sh
index 47dbb5b3..b7ead552 100755
--- a/targets/support/livecdfs-update.sh
+++ b/targets/support/livecdfs-update.sh
@@ -296,19 +296,8 @@ case ${clst_livecd_type} in
ln -sf /usr/livecd/gconf /etc/gconf
fi
- if [ -e /usr/livecd/kernelpkgs.txt ]
- then
- rm -f /usr/livecd/kernelpkgs.txt
- fi
-
touch /etc/startx
;;
- * )
- if [ -e /usr/livecd/kernelpkgs.txt ]
- then
- rm -f /usr/livecd/kernelpkgs.txt
- fi
- ;;
esac
# We want the first user to be used when auto-starting X
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 34/37] targets: Merge setup_gk_args() and genkernel_compile()
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (31 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 33/37] targets: Remove kernelpkgs.txt generation Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 35/37] targets: Reimplement kerncache support Matt Turner
` (2 subsequent siblings)
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
These both just do a bunch of argument concatenation and are not
separate functions in any meaningful way.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 27584d51..6a0137d7 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -4,7 +4,7 @@ source /tmp/chroot-functions.sh
install -d /tmp/kerncache
-setup_gk_args() {
+genkernel_compile() {
# default genkernel args
GK_ARGS=(
"${kernel_gk_kernargs[@]}"
@@ -61,10 +61,6 @@ setup_gk_args() {
then
GK_ARGS+=(--loglevel=2)
fi
-}
-
-genkernel_compile(){
- setup_gk_args
# Build with genkernel using the set options
# callback is put here to avoid escaping issues
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 35/37] targets: Reimplement kerncache support
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (32 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 34/37] targets: Merge setup_gk_args() and genkernel_compile() Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 36/37] targets: Remove unnecessary CONFIG_PROTECT assignment Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 37/37] targets: Use double-brackets in kmerge.sh Matt Turner
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
I cannot see how the code added in commit fed3b45b could have possibly
worked, and in practice it did not.
An earlier commit (beb92087) deleted most or all of the uses of the
*_MATCH variables but left the code that set them in place.
Fixes: beb92087 ("Added patches from Joshua Kinard <kumba@gentoo.org>")
Fixes: fed3b45b ("Fix and improve kernel build when kerncache is enabled.")
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 147 ++++++++++++--------------------------
1 file changed, 47 insertions(+), 100 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 6a0137d7..972feb99 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -85,11 +85,6 @@ genkernel_compile() {
else
genkernel "${GK_ARGS[@]}" || exit 1
fi
- if [ -n "${clst_KERNCACHE}" -a -e /var/tmp/${kname}.config ]
- then
- md5sum /var/tmp/${kname}.config | awk '{print $1}' > \
- /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG
- fi
}
[ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
@@ -106,117 +101,69 @@ eval eval kernel_gk_kernargs=( \$clst_boot_kernel_${kname}_gk_kernargs )
eval "ksource=\$clst_boot_kernel_${kname}_sources"
[[ -z ${ksource} ]] && ksource="sys-kernel/gentoo-sources"
-# Check if we have a match in kerncach
-
-if [ -n "${clst_KERNCACHE}" ]
-then
- USE_MATCH=0
- if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE ]
- then
- STR1=$(for i in `cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE`; do echo $i; done|sort)
- STR2=$(for i in ${kernel_use}; do echo $i; done|sort)
- if [ "${STR1}" = "${STR2}" ]
- then
- USE_MATCH=1
- else
- [ -e /tmp/kerncache/${kname}/usr/src/linux/.config ] && \
- rm /tmp/kerncache/${kname}/usr/src/linux/.config
- fi
- fi
-
- EXTRAVERSION_MATCH=0
- if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION ]
- then
- STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION`
- STR2=${clst_kextraversion}
- if [ "${STR1}" = "${STR2}" ]
- then
- EXTRAVERSION_MATCH=1
- fi
- fi
-
- CONFIG_MATCH=0
- if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG ]
- then
- if [ ! -e /var/tmp/${kname}.config ]
- then
- CONFIG_MATCH=1
- else
- STR1=`cat /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.CONFIG`
- STR2=`md5sum /var/tmp/${kname}.config|awk '{print $1}'`
- if [ "${STR1}" = "${STR2}" ]
- then
- CONFIG_MATCH=1
- fi
- fi
- fi
+kernel_version=$(portageq best_visible / "${ksource}")
- # install dependencies of kernel sources ahead of time in case
- # package.provided generated below causes them not to be (re)installed
- run_merge --onlydeps "${ksource}"
+if [[ -n ${clst_KERNCACHE} ]]; then
+ mkdir -p "/tmp/kerncache/${kname}"
+ pushd "/tmp/kerncache/${kname}" >/dev/null
- # Create the kerncache directory if it doesn't exists
- mkdir -p /tmp/kerncache/${kname}
+ echo "${kernel_use}" > /tmp/USE
+ echo "${kernel_version}" > /tmp/VERSION
+ echo "${clst_kextraversion}" > /tmp/EXTRAVERSION
- if [ -e /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION ]
- then
- KERNELVERSION=$(</tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION)
- mkdir -p ${clst_port_conf}/profile
- echo "${KERNELVERSION}" > ${clst_port_conf}/profile/package.provided
- else
- rm -f ${clst_port_conf}/profile/package.provided
+ if cmp -s {/tmp/,}USE && \
+ cmp -s {/tmp/,}VERSION && \
+ cmp -s {/tmp/,}EXTRAVERSION && \
+ cmp -s /var/tmp/${kname}.config CONFIG; then
+ cached_kernel_found="true"
fi
- # Don't use package.provided if there's a pending up/downgrade
- if [[ "$(portageq best_visible / ${ksource})" == "${KERNELVERSION}" ]]; then
- echo "No pending updates for ${ksource}"
- else
- echo "Pending updates for ${ksource}, removing package.provided"
- rm -f ${clst_port_conf}/profile/package.provided
- fi
+ rm -f /tmp/{USE,VERSION,EXTRAVERSION}
+ popd >/dev/null
+fi
+if [[ ! ${cached_kernel_found} ]]; then
USE=symlink run_merge --update "${ksource}"
+fi
+if [[ -n ${clst_KERNCACHE} ]]; then
SOURCESDIR="/tmp/kerncache/${kname}/sources"
- if [ -L /usr/src/linux ]
- then
- # A kernel was merged, move it to $SOURCESDIR
- [ -e ${SOURCESDIR} ] && rm -Rf ${SOURCESDIR}
-
- KERNELVERSION=`portageq best_visible / "${ksource}"`
- echo "${KERNELVERSION}" > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.KERNELVERSION
-
+ if [[ ! ${cached_kernel_found} ]]; then
echo "Moving kernel sources to ${SOURCESDIR} ..."
- mv `readlink -f /usr/src/linux` ${SOURCESDIR}
- fi
- ln -sf ${SOURCESDIR} /usr/src/linux
- # If catalyst has set to a empty string, extraversion wasn't specified so we
- # skip this part
- if [ "${EXTRAVERSION_MATCH}" = "0" ]
- then
- if [ ! "${clst_kextraversion}" = "" ]
- then
- echo "Setting extraversion to ${clst_kextraversion}"
- sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
- echo ${clst_kextraversion} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
- else
- touch /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.EXTRAVERSION
- fi
+ rm -rf "${SOURCESDIR}"
+ mv $(readlink -f /usr/src/linux) "${SOURCESDIR}"
fi
-else
- USE=symlink run_merge --update "${ksource}"
+ ln -snf "${SOURCESDIR}" /usr/src/linux
+fi
- if [ ! "${clst_kextraversion}" = "" ]
- then
- echo "Setting extraversion to ${clst_kextraversion}"
- sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" /usr/src/linux/Makefile
+if [[ -n ${clst_kextraversion} ]]; then
+ echo "Setting EXTRAVERSION to ${clst_kextraversion}"
+
+ if [[ -e /usr/src/linux/Makefile.bak ]]; then
+ cp /usr/src/linux/Makefile{.bak,}
+ else
+ cp /usr/src/linux/Makefile{,.bak}
fi
+ sed -i -e "s:EXTRAVERSION \(=.*\):EXTRAVERSION \1-${clst_kextraversion}:" \
+ /usr/src/linux/Makefile
fi
genkernel_compile
-if [ -n "${clst_KERNCACHE}" ]
-then
- echo ${kernel_use} > /tmp/kerncache/${kname}/${kname}-${clst_version_stamp}.USE
+# Write out CONFIG, USE, VERSION, and EXTRAVERSION files
+if [[ -n ${clst_KERNCACHE} && ! ${cached_kernel_found} ]]; then
+ pushd "/tmp/kerncache/${kname}" >/dev/null
+
+ cp /var/tmp/${kname}.config CONFIG
+ echo "${kernel_use}" > USE
+ echo "${kernel_version}" > VERSION
+ echo "${clst_kextraversion}" > EXTRAVERSION
+
+ popd >/dev/null
+fi
+
+if [[ ! ${cached_kernel_found} ]]; then
+ run_merge -C "${ksource}"
+ rm /usr/src/linux
fi
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 36/37] targets: Remove unnecessary CONFIG_PROTECT assignment
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (33 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 35/37] targets: Reimplement kerncache support Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 37/37] targets: Use double-brackets in kmerge.sh Matt Turner
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
CONFIG_PROTECT is set in run_merge, making this assignment and export
unnecessary.
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 1 -
1 file changed, 1 deletion(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 972feb99..5e284183 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -88,7 +88,6 @@ genkernel_compile() {
}
[ -n "${clst_ENVSCRIPT}" ] && source /tmp/envscript
-export CONFIG_PROTECT="-*"
# Set the timezone for the kernel build
rm /etc/localtime
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* [gentoo-catalyst] [PATCH 37/37] targets: Use double-brackets in kmerge.sh
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
` (34 preceding siblings ...)
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 36/37] targets: Remove unnecessary CONFIG_PROTECT assignment Matt Turner
@ 2020-10-21 0:23 ` Matt Turner
35 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 0:23 UTC (permalink / raw
To: gentoo-catalyst; +Cc: Matt Turner
Signed-off-by: Matt Turner <mattst88@gentoo.org>
---
targets/support/kmerge.sh | 50 ++++++++++++---------------------------
1 file changed, 15 insertions(+), 35 deletions(-)
diff --git a/targets/support/kmerge.sh b/targets/support/kmerge.sh
index 5e284183..fb67aba6 100755
--- a/targets/support/kmerge.sh
+++ b/targets/support/kmerge.sh
@@ -15,71 +15,51 @@ genkernel_compile() {
--minkernpackage=/tmp/kerncache/${kname}-kernel-initrd-${clst_version_stamp}.tar.bz2 all
)
# extra genkernel options that we have to test for
- if [ -n "${clst_gk_mainargs}" ]
- then
+ if [[ -n ${clst_gk_mainargs} ]]; then
GK_ARGS+=(${clst_gk_mainargs})
fi
- if [ -n "${clst_KERNCACHE}" ]
- then
+ if [[ -n ${clst_KERNCACHE} ]]; then
GK_ARGS+=(--kerncache=/tmp/kerncache/${kname}-kerncache-${clst_version_stamp}.tar.bz2)
fi
- if [ -e /var/tmp/${kname}.config ]
- then
+ if [[ -e /var/tmp/${kname}.config ]]; then
GK_ARGS+=(--kernel-config=/var/tmp/${kname}.config)
fi
-
- if [ -d "/tmp/initramfs_overlay/${initramfs_overlay}" ]
- then
+ if [[ -d /tmp/initramfs_overlay/${initramfs_overlay} ]]; then
GK_ARGS+=(--initramfs-overlay=/tmp/initramfs_overlay/${initramfs_overlay})
fi
- if [ -n "${clst_CCACHE}" ]
- then
+ if [[ -n ${clst_CCACHE} ]]; then
GK_ARGS+=(--kernel-cc=/usr/lib/ccache/bin/gcc --utils-cc=/usr/lib/ccache/bin/gcc)
fi
-
- if [ -n "${clst_linuxrc}" ]
- then
+ if [[ -n ${clst_linuxrc} ]]; then
GK_ARGS+=(--linuxrc=/tmp/linuxrc)
fi
-
- if [ -n "${clst_busybox_config}" ]
- then
+ if [[ -n ${clst_busybox_config} ]]; then
GK_ARGS+=(--busybox-config=/tmp/busy-config)
fi
-
- if [ "${clst_target}" == "netboot" ]
- then
+ if [[ ${clst_target} == netboot ]]; then
GK_ARGS+=(--netboot)
- if [ -n "${clst_merge_path}" ]
- then
+ if [[ -n ${clst_merge_path} ]]; then
GK_ARGS+=(--initramfs-overlay="${clst_merge_path}")
fi
fi
-
- if [ -n "${clst_VERBOSE}" ]
- then
+ if [[ -n ${clst_VERBOSE} ]]; then
GK_ARGS+=(--loglevel=2)
fi
- # Build with genkernel using the set options
- # callback is put here to avoid escaping issues
- if [ -n "${clst_VERBOSE}" ]
- then
+ if [[ -n ${clst_VERBOSE} ]]; then
gk_callback_opts=(-vN)
else
gk_callback_opts=(-qN)
fi
- if [ -n "${clst_KERNCACHE}" ]
- then
+ if [[ -n ${clst_KERNCACHE} ]]; then
gk_callback_opts+=(-kb)
fi
- if [ -n "${clst_FETCH}" ]
- then
+ if [[ -n ${clst_FETCH} ]]; then
gk_callback_opts+=(-f)
fi
- if [ "${kernel_merge}" != "" ]
- then
+
+ if [[ -n ${kernel_merge} ]]; then
genkernel --callback="emerge ${gk_callback_opts[@]} ${kernel_merge}" \
"${GK_ARGS[@]}" || exit 1
else
--
2.26.2
^ permalink raw reply related [flat|nested] 39+ messages in thread
* Re: [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment Matt Turner
@ 2020-10-21 3:01 ` Brian Dolbec
2020-10-21 3:31 ` Matt Turner
0 siblings, 1 reply; 39+ messages in thread
From: Brian Dolbec @ 2020-10-21 3:01 UTC (permalink / raw
To: gentoo-catalyst
On Tue, 20 Oct 2020 17:23:09 -0700
Matt Turner <mattst88@gentoo.org> wrote:
> We don't use os.system anymore. We pass self.env to Popen, so the
> comment isn't accurate.
>
> Signed-off-by: Matt Turner <mattst88@gentoo.org>
> ---
> catalyst/base/stagebase.py | 5 -----
> 1 file changed, 5 deletions(-)
>
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index 48157837..532f7133 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -1307,11 +1307,6 @@ class StageBase(TargetBase, ClearBase,
> GenBase): print_traceback=False)
>
> def setup_environment(self):
> - """
> - Modify the current environment. This is an ugly hack that
> should be
> - fixed. We need this to use the os.system() call since we
> can't
> - specify our own environ
> - """
> log.debug('setup_environment(); settings = %r',
> self.settings) for x in list(self.settings):
> log.debug('setup_environment(); processing: %s', x)
Instead of deleting the entire docstring, change it to reflect the
correct info. pylint will bitch about the lack of a docstring.
^ permalink raw reply [flat|nested] 39+ messages in thread
* Re: [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment
2020-10-21 3:01 ` Brian Dolbec
@ 2020-10-21 3:31 ` Matt Turner
0 siblings, 0 replies; 39+ messages in thread
From: Matt Turner @ 2020-10-21 3:31 UTC (permalink / raw
To: gentoo-catalyst
On Tue, Oct 20, 2020 at 8:02 PM Brian Dolbec <dolsen@gentoo.org> wrote:
>
> On Tue, 20 Oct 2020 17:23:09 -0700
> Matt Turner <mattst88@gentoo.org> wrote:
>
> > We don't use os.system anymore. We pass self.env to Popen, so the
> > comment isn't accurate.
> >
> > Signed-off-by: Matt Turner <mattst88@gentoo.org>
> > ---
> > catalyst/base/stagebase.py | 5 -----
> > 1 file changed, 5 deletions(-)
> >
> > diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> > index 48157837..532f7133 100644
> > --- a/catalyst/base/stagebase.py
> > +++ b/catalyst/base/stagebase.py
> > @@ -1307,11 +1307,6 @@ class StageBase(TargetBase, ClearBase,
> > GenBase): print_traceback=False)
> >
> > def setup_environment(self):
> > - """
> > - Modify the current environment. This is an ugly hack that
> > should be
> > - fixed. We need this to use the os.system() call since we
> > can't
> > - specify our own environ
> > - """
> > log.debug('setup_environment(); settings = %r',
> > self.settings) for x in list(self.settings):
> > log.debug('setup_environment(); processing: %s', x)
>
>
> Instead of deleting the entire docstring, change it to reflect the
> correct info. pylint will bitch about the lack of a docstring.
We're missing docstrings almost everywhere and have the pylint warning
disabled. From .pylintrc:
# We should clean up things so we can enable:
# missing-docstring -- add lots of docstrings everywhere!
[...]
disable=
missing-docstring,
[...]
I'm going to leave this as is for now.
^ permalink raw reply [flat|nested] 39+ messages in thread
end of thread, other threads:[~2020-10-21 3:31 UTC | newest]
Thread overview: 39+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-21 0:23 [gentoo-catalyst] [PATCH 01/37] catalyst: Use early return to unindent code Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 02/37] catalyst: Drop outdated comment Matt Turner
2020-10-21 3:01 ` Brian Dolbec
2020-10-21 3:31 ` Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 03/37] catalyst: Fix obvious logic error Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 04/37] catalyst: Add and use sanitize_name() function Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 05/37] catalyst: Sanitize variable kernel name before giving it to bash Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 06/37] targets: Fix filtered_kname Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 07/37] targets: Consolidate evals using filtered_kname Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 08/37] targets: Remove filtered_kname Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 09/37] targets: Remove useless sleep 0 Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 10/37] targets: Remove trivial build_kernel() function Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 11/37] targets: Remove some disabled debugging messages Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 12/37] targets: Remove some unnecessary exports Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 13/37] targets: Remove more clst_ prefixes Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 14/37] targets: Remove some comments whose meanings have been lost Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 15/37] targets: Use pkgcache for kernel sources Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 16/37] targets: Remove a bunch of stray newlines Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 17/37] targets: Delete some more dead code Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 18/37] targets: Remove bizarre make_destpath() call Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 19/37] targets: Remove unnecessary unset USE Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 20/37] targets: Remove wrong make.conf munging Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 21/37] targets: Use USE=symlink when emerging kernel sources Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 22/37] targets: Emerge kernel sources with --update Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 23/37] targets: Default to sys-kernel/gentoo-sources directly Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 24/37] targets: Rewrite hppa pre-kmerge check Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 25/37] targets: Use full 'sys-kernel/genkernel' package name Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 26/37] targets: Explicitly set RUN_DEFAULT_FUNCS="yes" Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 27/37] targets: Inline run_default_funcs() function Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 28/37] targets: Move create_handbook_icon() to its use Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 29/37] targets: Drop warning about no cdtar Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 30/37] targets: Remove post-kmerge Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 31/37] targets: Remove unnecessary unset PACKAGES Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 32/37] targets: Delete never-used packages.txt code Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 33/37] targets: Remove kernelpkgs.txt generation Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 34/37] targets: Merge setup_gk_args() and genkernel_compile() Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 35/37] targets: Reimplement kerncache support Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 36/37] targets: Remove unnecessary CONFIG_PROTECT assignment Matt Turner
2020-10-21 0:23 ` [gentoo-catalyst] [PATCH 37/37] targets: Use double-brackets in kmerge.sh Matt Turner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox