From: "Andreas K. Hüttel" <dilfridge@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
Date: Fri, 27 Sep 2024 22:48:09 +0000 (UTC) [thread overview]
Message-ID: <1727477275.66e3479b69e4922817e0620a82255a5ec401d06f.dilfridge@gentoo> (raw)
commit: 66e3479b69e4922817e0620a82255a5ec401d06f
Author: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 8 13:52:32 2024 +0000
Commit: Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Fri Sep 27 22:47:55 2024 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=66e3479b
Start with diskimage target descriptions
Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>
catalyst/targets/diskimage_stage1.py | 58 +++++++++++++++++++
catalyst/targets/diskimage_stage2.py | 107 +++++++++++++++++++++++++++++++++++
2 files changed, 165 insertions(+)
diff --git a/catalyst/targets/diskimage_stage1.py b/catalyst/targets/diskimage_stage1.py
new file mode 100644
index 00000000..9cbf81df
--- /dev/null
+++ b/catalyst/targets/diskimage_stage1.py
@@ -0,0 +1,58 @@
+"""
+Disk image stage1 target
+"""
+# NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
+
+from catalyst.support import normpath
+
+from catalyst.base.stagebase import StageBase
+
+
+class diskimage_stage1(StageBase):
+ """
+ Builder class for disk image stage1.
+ """
+ required_values = frozenset([
+ "diskimage/packages",
+ ])
+ valid_values = required_values | frozenset([
+ "diskimage/use",
+ ])
+
+ def __init__(self, spec, addlargs):
+ StageBase.__init__(self, spec, addlargs)
+
+ def set_action_sequence(self):
+ self.build_sequence.extend([
+ self.build_packages,
+ ])
+ self.finish_sequence.extend([
+ self.clean,
+ ])
+ self.set_completion_action_sequences()
+
+ def set_spec_prefix(self):
+ self.settings["spec_prefix"] = "diskimage"
+
+ def set_catalyst_use(self):
+ StageBase.set_catalyst_use(self)
+ if "catalyst_use" in self.settings:
+ self.settings["catalyst_use"].append("diskimage")
+ else:
+ self.settings["catalyst_use"] = ["diskiage"]
+
+ def set_packages(self):
+ StageBase.set_packages(self)
+ if self.settings["spec_prefix"]+"/packages" in self.settings:
+ if isinstance(self.settings[self.settings['spec_prefix']+'/packages'], str):
+ self.settings[self.settings["spec_prefix"]+"/packages"] = \
+ self.settings[self.settings["spec_prefix"] +
+ "/packages"].split()
+
+ def set_pkgcache_path(self):
+ if "pkgcache_path" in self.settings:
+ if not isinstance(self.settings['pkgcache_path'], str):
+ self.settings["pkgcache_path"] = normpath(
+ ' '.join(self.settings["pkgcache_path"]))
+ else:
+ StageBase.set_pkgcache_path(self)
diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
new file mode 100644
index 00000000..83a52a46
--- /dev/null
+++ b/catalyst/targets/diskimage_stage2.py
@@ -0,0 +1,107 @@
+"""
+Disk image stage2 target, builds upon previous disk image stage1 tarball
+"""
+# NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
+
+from catalyst.support import (normpath, file_locate, CatalystError)
+from catalyst.fileops import clear_dir
+from catalyst.base.stagebase import StageBase
+
+
+class diskimage_stage2(StageBase):
+ """
+ Builder class for a disk image stage2 build.
+ """
+ required_values = frozenset([
+ "boot/kernel",
+ ])
+ valid_values = required_values | frozenset([
+ "diskimage/bootargs",
+ "diskimage/fstar",
+ "diskimage/depclean",
+ "diskimage/empty",
+ "diskimage/fsops",
+ "diskimage/fsscript",
+ "diskimage/fstype",
+ "diskimage/gk_mainargs",
+ "diskimage/image",
+ "diskimage/imageformat",
+ "diskimage/modblacklist",
+ "diskimage/motd",
+ "diskimage/rcadd",
+ "diskimage/rcdel",
+ "diskimage/readme",
+ "diskimage/rm",
+ "diskimage/type",
+ "diskimage/unmerge",
+ "diskimage/users",
+ "diskimage/verify",
+ "diskimage/volid",
+ "repos",
+ ])
+
+ def __init__(self, spec, addlargs):
+ StageBase.__init__(self, spec, addlargs)
+ if "diskimage/type" not in self.settings:
+ self.settings["diskimage/type"] = "generic-diskimage"
+
+ file_locate(self.settings, ["fstar", "controller_file"])
+
+ def set_spec_prefix(self):
+ self.settings["spec_prefix"] = "diskimage"
+
+ def set_target_path(self):
+ '''Set the target path for the finished stage.
+
+ This method runs the StageBase.set_target_path mehtod,
+ and additionally creates a staging directory for assembling
+ the final components needed to produce the iso image.
+ '''
+ super(diskimage_stage2, self).set_target_path()
+ clear_dir(self.settings['target_path'])
+
+ def run_local(self):
+ # what modules do we want to blacklist?
+ if "diskimage/modblacklist" in self.settings:
+ path = normpath(self.settings["chroot_path"] +
+ "/etc/modprobe.d/blacklist.conf")
+ try:
+ with open(path, "a") as myf:
+ myf.write("\n#Added by Catalyst:")
+ # workaround until config.py is using configparser
+ if isinstance(self.settings["diskimage/modblacklist"], str):
+ self.settings["diskimage/modblacklist"] = self.settings[
+ "diskimage/modblacklist"].split()
+ for x in self.settings["diskimage/modblacklist"]:
+ myf.write("\nblacklist "+x)
+ except Exception as e:
+ raise CatalystError("Couldn't open " +
+ self.settings["chroot_path"] +
+ "/etc/modprobe.d/blacklist.conf.",
+ print_traceback=True) from e
+
+ def set_action_sequence(self):
+ self.build_sequence.extend([
+ self.run_local,
+ self.build_kernel
+ ])
+ if "fetch" not in self.settings["options"]:
+ self.build_sequence.extend([
+ self.create_diskimage, # create image file
+ self.open_diskimage,
+ self.make_filesystems, # partition, make filesystems
+ self.move_into_image,
+ self.bootloader,
+ self.preclean,
+ self.fsscript,
+ self.rcupdate,
+ self.unmerge,
+ ])
+ self.finish_sequence.extend([
+ self.remove,
+ self.empty,
+ self.clean,
+ self.target_setup,
+ self.close_diskimage, # unmount, unmap
+ ])
+ self.set_completion_action_sequences()
next reply other threads:[~2024-09-27 22:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-27 22:48 Andreas K. Hüttel [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-10-06 16:51 [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/ Andreas K. Hüttel
2024-10-05 21:41 Andreas K. Hüttel
2024-10-05 21:24 Andreas K. Hüttel
2024-08-09 19:34 Andreas K. Hüttel
2024-08-03 11:01 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-08-03 9:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 15:29 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 15:28 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 14:54 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 14:45 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 11:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
2024-07-30 11:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1727477275.66e3479b69e4922817e0620a82255a5ec401d06f.dilfridge@gentoo \
--to=dilfridge@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox