public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/
@ 2024-07-30 14:45 Andreas K. Hüttel
  2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
  0 siblings, 1 reply; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-07-30 14:45 UTC (permalink / raw
  To: gentoo-commits

commit:     228569f3f827e7e116fede8901dbc50118519eae
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 14:45:23 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 14:45:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=228569f3

stage1: we can't mount any squashfs twice, so we make sure we get a bind mount

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 593509e4..1c9a4d42 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -32,7 +32,7 @@ class stage1(StageBase):
             mount_id = f'root_repo_{name}'
             self.mount[mount_id] = {
                 'enable': True,
-                'source': path,
+                'source': self.get_repo_location(name),
                 'target': normpath("/tmp/stage1root") / self.get_repo_location(name)
             }
 


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 14:45 [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/ Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     228569f3f827e7e116fede8901dbc50118519eae
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 14:45:23 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 14:45:23 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=228569f3

stage1: we can't mount any squashfs twice, so we make sure we get a bind mount

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 593509e4..1c9a4d42 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -32,7 +32,7 @@ class stage1(StageBase):
             mount_id = f'root_repo_{name}'
             self.mount[mount_id] = {
                 'enable': True,
-                'source': path,
+                'source': self.get_repo_location(name),
                 'target': normpath("/tmp/stage1root") / self.get_repo_location(name)
             }
 


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 11:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     8339543d77edee063bdd1288cb0e24b77865b437
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 20:29:50 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 20:29:50 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=8339543d

targets: improve path concatenation

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 42931749..593509e4 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -33,7 +33,7 @@ class stage1(StageBase):
             self.mount[mount_id] = {
                 'enable': True,
                 'source': path,
-                'target': Path(normpath("/tmp/stage1root") + "/" + str(self.get_repo_location(name)))
+                'target': normpath("/tmp/stage1root") / self.get_repo_location(name)
             }
 
     def set_root_path(self):


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 11:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     655acfcf822fd83affaa32c2bc8a4a3188850d54
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Mon Jul 29 20:27:45 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Mon Jul 29 20:27:45 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=655acfcf

targets: Mount repos also under $ROOT for stage1 builds

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 0ea5f92b..42931749 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -4,10 +4,11 @@ stage1 target
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
 from catalyst import log
-from catalyst.support import normpath
+from catalyst.support import (normpath, get_repo_name)
 from catalyst.fileops import move_path
 from catalyst.base.stagebase import StageBase
 
+from pathlib import Path
 
 class stage1(StageBase):
     """
@@ -22,6 +23,18 @@ class stage1(StageBase):
 
     def __init__(self, spec, addlargs):
         StageBase.__init__(self, spec, addlargs)
+        # In the stage1 build we need to make sure that the ebuild repositories are
+        # accessible within $ROOT too... otherwise relative symlinks may point nowhere
+        # and, e.g., portageq may malfunction due to missing profile.
+        # Create a second bind mount entry for each repository
+        for path, name, _ in self.repos:
+            name = get_repo_name(path)
+            mount_id = f'root_repo_{name}'
+            self.mount[mount_id] = {
+                'enable': True,
+                'source': path,
+                'target': Path(normpath("/tmp/stage1root") + "/" + str(self.get_repo_location(name)))
+            }
 
     def set_root_path(self):
         # sets the root path, relative to 'chroot_path', of the stage1 root


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 15:29 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     bc26f26acfeed23934c10a341f45ff0e0c4703f9
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 15:29:43 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 15:29:43 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=bc26f26a

note to self: python is stupid

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 0cb399c3..ba42d9b8 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -31,7 +31,7 @@ class stage1(StageBase):
         #    otherwise we may end up trying to mount the same squashfs twice instead
         #    of a bind mount
         #  * take the directory inside the chroot as source, not the host directory
-	self.set_chroot_path()
+        self.set_chroot_path()
         for path, name, _ in self.repos:
             name = get_repo_name(path)
             mount_id = f'root_repo_{name}'


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 14:54 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     c836c804b8b7ef88273751411b7b1a7f5b021680
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 14:53:48 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 14:53:48 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c836c804

stage1: make sure we bind-mount within the chroot dir

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 1c9a4d42..cd10c86a 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -26,13 +26,17 @@ class stage1(StageBase):
         # In the stage1 build we need to make sure that the ebuild repositories are
         # accessible within $ROOT too... otherwise relative symlinks may point nowhere
         # and, e.g., portageq may malfunction due to missing profile.
-        # Create a second bind mount entry for each repository
+        # Create a second, bind mount entry for each repository. We need to
+        #  * take as source not the original source but the original target, since
+        #    otherwise we may end up trying to mount the same squashfs twice instead
+        #    of a bind mount
+        #  * take the directory inside the chroot as source, not the host directory
         for path, name, _ in self.repos:
             name = get_repo_name(path)
             mount_id = f'root_repo_{name}'
             self.mount[mount_id] = {
                 'enable': True,
-                'source': self.get_repo_location(name),
+                'source': self.settings['chroot_path'] / self.get_repo_location(name),
                 'target': normpath("/tmp/stage1root") / self.get_repo_location(name)
             }
 


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-07-30 15:28 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     5f8440d1b1429305a3636a5c82642089e2c754fb
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Tue Jul 30 15:28:21 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Tue Jul 30 15:28:21 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=5f8440d1

stage1: apparently we need to populate the chroot_path setting first

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index cd10c86a..0cb399c3 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -31,6 +31,7 @@ class stage1(StageBase):
         #    otherwise we may end up trying to mount the same squashfs twice instead
         #    of a bind mount
         #  * take the directory inside the chroot as source, not the host directory
+	self.set_chroot_path()
         for path, name, _ in self.repos:
             name = get_repo_name(path)
             mount_id = f'root_repo_{name}'


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-08-03  9:06 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     31d975c10785f4de73cd788285ccf2408aa54a30
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 09:06:29 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 09:06:29 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=31d975c1

stage1: make sure we bind-mount within the chroot dir, try 3, now with pathlib

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index ba42d9b8..ae27cd0a 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -31,14 +31,18 @@ class stage1(StageBase):
         #    otherwise we may end up trying to mount the same squashfs twice instead
         #    of a bind mount
         #  * take the directory inside the chroot as source, not the host directory
+        # In the meantime we fixed make.profile to point outside ROOT, so this may not
+        # be necessary at the moment anymore. Having it can prevent future surprises
+        # though.
         self.set_chroot_path()
         for path, name, _ in self.repos:
             name = get_repo_name(path)
             mount_id = f'root_repo_{name}'
+            repo_loc = self.get_repo_location(name)
             self.mount[mount_id] = {
                 'enable': True,
-                'source': self.settings['chroot_path'] / self.get_repo_location(name),
-                'target': normpath("/tmp/stage1root") / self.get_repo_location(name)
+                'source': self.settings['chroot_path'] / repo_loc.relative_to('/'),
+                'target': normpath("/tmp/stage1root") / repo_loc.relative_to('/')
             }
 
     def set_root_path(self):


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
  2024-08-03 11:01 [gentoo-commits] proj/catalyst:master " Andreas K. Hüttel
@ 2024-08-09 19:34 ` Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     a65ccb75656b8b5a01adf69bcbdcb19425abb0dd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Aug  3 11:00:48 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Aug  3 11:00:48 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=a65ccb75

stage1: Drop now unneeded imports again

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/stage1.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/catalyst/targets/stage1.py b/catalyst/targets/stage1.py
index 66f21a9c..18ff1840 100644
--- a/catalyst/targets/stage1.py
+++ b/catalyst/targets/stage1.py
@@ -4,12 +4,10 @@ stage1 target
 # NOTE: That^^ docstring has influence catalyst-spec(5) man page generation.
 
 from catalyst import log
-from catalyst.support import (normpath, get_repo_name)
+from catalyst.support import normpath
 from catalyst.fileops import move_path
 from catalyst.base.stagebase import StageBase
 
-from pathlib import Path
-
 class stage1(StageBase):
     """
     Builder class for a stage1 installation tarball build.


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-08-09 19:34 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-08-09 19:34 UTC (permalink / raw
  To: gentoo-commits

commit:     49524772af90ac8950788443d4c8d7247c89a2f2
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 Aug  9 19:33:47 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=49524772

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()


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-09-27 22:48 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-09-27 22:48 UTC (permalink / raw
  To: gentoo-commits

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()


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-10-05 21:24 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-10-05 21:24 UTC (permalink / raw
  To: gentoo-commits

commit:     22aac14f81203111cd567599ab959d384429a943
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  5 21:21:18 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  5 21:21:18 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=22aac14f

Slightly more sane action sequence

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index e665fb42..e0e8aeaf 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -87,12 +87,10 @@ class diskimage_stage2(StageBase):
         ])
         if "fetch" not in self.settings["options"]:
             self.build_sequence.extend([
-                self.create_diskimage,           # create image file
-                self.open_diskimage,             # loopback or nbd
-                self.make_filesystems,           # partition, make filesystems
-                self.move_into_image,            # move files in
-                self.bootloader,                 # install bootloader (efi grub?)
+                self.bootloader,
                 self.preclean,
+                self.diskimage_update,           # what does this do?
+                # we don't need root_overlay (or any sort of overlay)
                 self.fsscript,
                 self.rcupdate,
                 self.unmerge,
@@ -101,7 +99,7 @@ class diskimage_stage2(StageBase):
                 self.remove,
                 self.empty,
                 self.clean,
-                self.target_setup,
-                self.close_diskimage,           # unmount, unmap
+                self.target_setup,              # what does this do?
+                self.create_qcow2,              # import all files into qcow2
             ])
         self.set_completion_action_sequences()


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-10-05 21:41 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-10-05 21:41 UTC (permalink / raw
  To: gentoo-commits

commit:     e9acffc5a3b98f2db19b080eb14ef92bf0e11735
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  5 21:41:11 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct  5 21:41:11 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=e9acffc5

We don't need target_setup since a disk image has no internal squashfs etc bla

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index e0e8aeaf..2036811b 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -89,8 +89,7 @@ class diskimage_stage2(StageBase):
             self.build_sequence.extend([
                 self.bootloader,
                 self.preclean,
-                self.diskimage_update,           # what does this do?
-                # we don't need root_overlay (or any sort of overlay)
+                self.diskimage_update,
                 self.fsscript,
                 self.rcupdate,
                 self.unmerge,
@@ -99,7 +98,6 @@ class diskimage_stage2(StageBase):
                 self.remove,
                 self.empty,
                 self.clean,
-                self.target_setup,              # what does this do?
-                self.create_qcow2,              # import all files into qcow2
+                self.create_qcow2,
             ])
         self.set_completion_action_sequences()


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-10-06 16:51 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-10-06 16:51 UTC (permalink / raw
  To: gentoo-commits

commit:     c6e8d0fd2e3dde5633e55728fa2fc27b096c8cbf
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sun Oct  6 16:51:12 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sun Oct  6 16:51:12 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c6e8d0fd

Fix config names etc

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index 2036811b..7bd92bcb 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -17,22 +17,22 @@ class diskimage_stage2(StageBase):
     ])
     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/qcow2",
+        "diskimage/qcow2_size",
+        "diskimage/qcow2_efisize",
+        "diskimage/qcow2_roottype",
         "diskimage/rcadd",
         "diskimage/rcdel",
         "diskimage/readme",
         "diskimage/rm",
-        "diskimage/type",
+        "diskimage/type",		# generic, cloud-init, ssh, console
         "diskimage/unmerge",
         "diskimage/users",
         "diskimage/verify",
@@ -40,12 +40,22 @@ class diskimage_stage2(StageBase):
         "repos",
     ])
 
+# Types of bootable disk images planned for (diskimage/type):
+# cloud-init - an image that starts cloud-init for configuration and then can be
+#              used out of the box
+# console    - an image that has an empty root password and allows passwordless
+#              login on the console only
+# ssh        - an image that populates /root/.ssh/authorized_keys and starts dhcp
+#              as well as sshd; obviously not fit for public distribution
+# generic    - an image with no means of logging in... needs postprocessing
+#              no services are started
+
     def __init__(self, spec, addlargs):
         StageBase.__init__(self, spec, addlargs)
         if "diskimage/type" not in self.settings:
-            self.settings["diskimage/type"] = "generic-diskimage"
+            self.settings["diskimage/type"] = "generic"
 
-        file_locate(self.settings, ["fstar", "controller_file"])
+        file_locate(self.settings, ["controller_file"])
 
     def set_spec_prefix(self):
         self.settings["spec_prefix"] = "diskimage"


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-10-12 11:08 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 11:08 UTC (permalink / raw
  To: gentoo-commits

commit:     c2f80db1ea81e68fb5cdb24cfea0f064a51e22bd
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 11:08:13 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 11:08:13 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=c2f80db1

Do not create diskimage-stage2 archive (pointless)

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index 7bd92bcb..2ea267f7 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -111,3 +111,5 @@ class diskimage_stage2(StageBase):
                 self.create_qcow2,
             ])
         self.set_completion_action_sequences()
+        # our output is the qcow2, not a stage archive
+        self.finish_sequence.remove(self.capture)


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [gentoo-commits] proj/catalyst:dilfridge/qcow2 commit in: catalyst/targets/
@ 2024-10-12 15:14 Andreas K. Hüttel
  0 siblings, 0 replies; 16+ messages in thread
From: Andreas K. Hüttel @ 2024-10-12 15:14 UTC (permalink / raw
  To: gentoo-commits

commit:     12c9f2e5ce7b9d918149f7564f8c7d72b07d93e2
Author:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
AuthorDate: Sat Oct 12 15:14:35 2024 +0000
Commit:     Andreas K. Hüttel <dilfridge <AT> gentoo <DOT> org>
CommitDate: Sat Oct 12 15:14:35 2024 +0000
URL:        https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=12c9f2e5

$(/%&/(&%(%$(/&= tab errors

Signed-off-by: Andreas K. Hüttel <dilfridge <AT> gentoo.org>

 catalyst/targets/diskimage_stage2.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/catalyst/targets/diskimage_stage2.py b/catalyst/targets/diskimage_stage2.py
index 154b36c5..f0e56f9e 100644
--- a/catalyst/targets/diskimage_stage2.py
+++ b/catalyst/targets/diskimage_stage2.py
@@ -71,8 +71,8 @@ class diskimage_stage2(StageBase):
         clear_dir(self.settings['target_path'])
 
     def run_local(self):
-	# let's first start with the controller file
-	StageBase.run_local(self)
+        # let's first start with the controller file
+        StageBase.run_local(self)
 
         # what modules do we want to blacklist?
         if "diskimage/modblacklist" in self.settings:


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-10-12 15:14 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-30 14:45 [gentoo-commits] proj/catalyst:master commit in: catalyst/targets/ Andreas K. Hüttel
2024-08-09 19:34 ` [gentoo-commits] proj/catalyst:dilfridge/qcow2 " Andreas K. Hüttel
  -- strict thread matches above, loose matches on Subject: below --
2024-10-12 15:14 Andreas K. Hüttel
2024-10-12 11:08 Andreas K. Hüttel
2024-10-06 16:51 Andreas K. Hüttel
2024-10-05 21:41 Andreas K. Hüttel
2024-10-05 21:24 Andreas K. Hüttel
2024-09-27 22:48 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 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox