From cb36bccf74524ed46479cae945ab4dd73da4c7c1 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 25 Feb 2025 16:22:57 -0500 Subject: [PATCH] imagectl: Default source-root to / While "cross builds" and using a separate repos container can feel very clean (instead of mutating the builder container) it's actually much closer to our default intention to support building a new version of the base image from the image itself. So make the source root optional (i.e. it defaults to `/`). This will improve the default UX, but also more specifically will fix the issue that cachi2 breaks the separate source root flow. Signed-off-by: Colin Walters --- bootc-base-imagectl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/bootc-base-imagectl b/bootc-base-imagectl index 05b880b..446f169 100755 --- a/bootc-base-imagectl +++ b/bootc-base-imagectl @@ -19,17 +19,17 @@ def run_build_rootfs(args): manifest_path = os.path.join(args.manifest, 'manifest.yaml') else: manifest_path = args.manifest + '.yaml' + rpmostree_argv = ['rpm-ostree', 'experimental', 'compose', 'rootfs'] try: + # Assume we can mutate alternative roots + if args.source_root != '/': + rpmostree_argv.append(f'--source-root-rw={args.source_root}') + else: + # But we shouldn't need to mutate the default root + rpmostree_argv.append('--source-root=/') + rpmostree_argv.extend([f'/{MANIFESTDIR}/{manifest_path}', target]) # Perform the build - subprocess.run([ - 'rpm-ostree', - 'experimental', - 'compose', - 'rootfs', - f'--source-root-rw={args.source_root}', - f'/{MANIFESTDIR}/{manifest_path}', - target, - ], check=True) + subprocess.run(rpmostree_argv, check=True) # And run the bootc linter for good measure subprocess.run([ 'bootc', @@ -76,7 +76,7 @@ if __name__ == "__main__": build_rootfs = subparsers.add_parser('build-rootfs', help='Generate a container root filesystem') build_rootfs.add_argument("--reinject", help="Also reinject the build configurations into the target", action='store_true') build_rootfs.add_argument("--manifest", help="Use the specified manifest", action='store', default='default') - build_rootfs.add_argument("source_root", help="Path to the source root directory used for dnf configuration.") + build_rootfs.add_argument("source_root", help="Path to the source root directory used for dnf configuration (default=/)", nargs='?', default='/') build_rootfs.add_argument("target", help="Path to the target root directory that will be generated.") build_rootfs.set_defaults(func=run_build_rootfs)