bootc-base-imagectl: add --repo

This is analogous to the dnf option of the same name, available in both
dnf4 and dnf5. It has the same semantics as rpm-ostree's `repos` key, so
we can map it directly.

This will make it easier in CoreOS-land to inject our own repos and
control enablement declaratively rather than have to fiddle with repo
files directly. Note also that the `config-manager` dnf plugin is not
installed by default in the base bootc image, and I would rather not
have to install that for each compose.
This commit is contained in:
Jonathan Lebon 2025-07-21 15:45:36 -04:00
parent 8f7dcde264
commit a49b16e3ff
No known key found for this signature in database

View file

@ -52,6 +52,8 @@ def run_build_rootfs(args):
override_manifest['sysusers'] = 'compose-forced'
passwd_mode = 'nobody' if args.nobody_99 else 'none'
override_manifest['variables'] = {'passwd_mode': passwd_mode}
if args.repo:
override_manifest['repos'] = args.repo
tmp_manifest = None
if override_manifest:
@ -154,6 +156,7 @@ if __name__ == "__main__":
build_rootfs.add_argument("--no-docs", help="Don't install documentation", action='store_true')
build_rootfs.add_argument("--sysusers", help="Run systemd-sysusers instead of injecting hardcoded passwd/group entries", action='store_true')
build_rootfs.add_argument("--nobody-99", help=argparse.SUPPRESS, action='store_true')
build_rootfs.add_argument("--repo", help="Enable specific repositories only", action='append', default=[], metavar='REPO')
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)