From: Michael A Cassaniti Date: Thu, 21 Jul 2022 08:11:28 +0000 (+1000) Subject: Force initializing the partition table every time create_image is called X-Git-Tag: v14~116 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9ebc563877583d9d49d8d566ea0a65c33f01b7d;p=thirdparty%2Fmkosi.git Force initializing the partition table every time create_image is called When creating the build and final images `args.partition_table` is not re-initialized which results in a mismatch between the on disk partition layout and the records in memory. Also added is some testing for UsrOnly. --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dd8417787..3863afa77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,6 +184,15 @@ jobs: sudo MKOSI_TEST_DEFAULT_VERB=boot python3 -m pytest -m integration -sv tests + - name: Build ${{ matrix.distro }}/${{ matrix.format }} UsrOnly + run: | + tee mkosi.default <<- EOF + [Output] + UsrOnly=True + EOF + + sudo mkosi --force build + - name: Build/Boot ${{ matrix.distro }}/${{ matrix.format }} UEFI UKI run: | tee mkosi.default <<- EOF diff --git a/mkosi/__init__.py b/mkosi/__init__.py index fcece22e1..04991b17d 100644 --- a/mkosi/__init__.py +++ b/mkosi/__init__.py @@ -769,8 +769,8 @@ def root_partition_description( return prefix + ' ' + (suffix if suffix is not None else 'Partition') -def initialize_partition_table(args: MkosiArgs) -> None: - if args.partition_table is not None: +def initialize_partition_table(args: MkosiArgs, force: bool = False) -> None: + if args.partition_table is not None and not force: return if not args.output_format.is_disk(): @@ -809,7 +809,7 @@ def initialize_partition_table(args: MkosiArgs) -> None: def create_image(args: MkosiArgs, for_cache: bool) -> Optional[BinaryIO]: - initialize_partition_table(args) + initialize_partition_table(args, force=True) if args.partition_table is None: return None diff --git a/mkosi/gentoo.py b/mkosi/gentoo.py index 6e48e0712..435fb5d0b 100644 --- a/mkosi/gentoo.py +++ b/mkosi/gentoo.py @@ -20,6 +20,7 @@ from .backend import ( OutputFormat, PartitionIdentifier, die, + root_home, run_workspace_command, ) @@ -501,6 +502,8 @@ class Gentoo: f"actions={actions} outside stage3") emerge_main([*pkgs, *opts, *actions] + PREFIX_OPTS + self.emerge_default_opts) else: + if args.usr_only: + root_home(args, root).mkdir(mode=0o750, exist_ok=True) cmd = ["/usr/bin/emerge", *pkgs, *self.emerge_default_opts, *opts, *actions]