diff --git a/rpmostree-cxxrs.cxx b/rpmostree-cxxrs.cxx index a461ed1abe..d6d1e783f4 100644 --- a/rpmostree-cxxrs.cxx +++ b/rpmostree-cxxrs.cxx @@ -2196,6 +2196,9 @@ extern "C" ::rust::repr::PtrLen rpmostreecxx$cxxbridge1$compose_image (::rust::Vec< ::rust::String> *args) noexcept; + ::rust::repr::PtrLen + rpmostreecxx$cxxbridge1$compose_rootfs_entrypoint (::rust::Vec< ::rust::String> *args) noexcept; + ::rust::repr::PtrLen rpmostreecxx$cxxbridge1$configure_build_repo_from_target ( ::rpmostreecxx::OstreeRepo const &build_repo, ::rpmostreecxx::OstreeRepo const &target_repo) noexcept; @@ -3980,6 +3983,17 @@ compose_image (::rust::Vec< ::rust::String> args) } } +void +compose_rootfs_entrypoint (::rust::Vec< ::rust::String> args) +{ + ::rust::ManuallyDrop< ::rust::Vec< ::rust::String> > args$ (::std::move (args)); + ::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$compose_rootfs_entrypoint (&args$.value); + if (error$.ptr) + { + throw ::rust::impl< ::rust::Error>::error (error$); + } +} + void configure_build_repo_from_target (::rpmostreecxx::OstreeRepo const &build_repo, ::rpmostreecxx::OstreeRepo const &target_repo) diff --git a/rpmostree-cxxrs.h b/rpmostree-cxxrs.h index cc38477891..267249c1d6 100644 --- a/rpmostree-cxxrs.h +++ b/rpmostree-cxxrs.h @@ -1862,6 +1862,8 @@ ::rpmostreecxx::GVariant *get_header_variant (::rpmostreecxx::OstreeRepo const & void compose_image (::rust::Vec< ::rust::String> args); +void compose_rootfs_entrypoint (::rust::Vec< ::rust::String> args); + void configure_build_repo_from_target (::rpmostreecxx::OstreeRepo const &build_repo, ::rpmostreecxx::OstreeRepo const &target_repo); diff --git a/rust/src/compose.rs b/rust/src/compose.rs index f65508e7bc..8bd124f73b 100644 --- a/rust/src/compose.rs +++ b/rust/src/compose.rs @@ -518,6 +518,12 @@ impl RootfsOpts { } } +pub(crate) fn compose_rootfs_entrypoint(args: Vec) -> CxxResult<()> { + let args = args.iter().map(|v| v.as_str()); + RootfsOpts::parse_from(["rootfs"].into_iter().chain(args)).run()?; + Ok(()) +} + impl CommitToContainerRootfsOpts { /// Execute `compose commit-to-container-rootfs`. This just: /// - Opens up the target ostree repo diff --git a/rust/src/lib.rs b/rust/src/lib.rs index b1649d45a2..1150917d64 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -282,6 +282,7 @@ pub mod ffi { // compose.rs extern "Rust" { fn compose_image(args: Vec) -> Result<()>; + fn compose_rootfs_entrypoint(args: Vec) -> Result<()>; fn configure_build_repo_from_target( build_repo: &OstreeRepo, diff --git a/src/app/rpmostree-builtin-compose.cxx b/src/app/rpmostree-builtin-compose.cxx index c5bfd9d271..49e963c0ac 100644 --- a/src/app/rpmostree-builtin-compose.cxx +++ b/src/app/rpmostree-builtin-compose.cxx @@ -53,6 +53,8 @@ static RpmOstreeCommand compose_subcommands[] = { { "image", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, "Generate a reproducible \"chunked\" container image (using RPM data) from a treefile", rpmostree_compose_builtin_image }, + { "rootfs", RPM_OSTREE_BUILTIN_FLAG_LOCAL_CMD, "Generate a root filesystem tree from a treefile", + rpmostree_compose_builtin_rootfs }, { NULL, (RpmOstreeBuiltinFlags)0, NULL, NULL } }; @@ -76,4 +78,16 @@ rpmostree_compose_builtin_image (int argc, char **argv, RpmOstreeCommandInvocati rustargv.push_back (std::string (argv[i])); CXX_TRY (rpmostreecxx::compose_image (rustargv), error); return TRUE; +} + +gboolean +rpmostree_compose_builtin_rootfs (int argc, char **argv, RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error) +{ + rust::Vec rustargv; + g_assert_cmpint (argc, >, 0); + for (int i = 0; i < argc; i++) + rustargv.push_back (std::string (argv[i])); + CXX_TRY (rpmostreecxx::compose_rootfs_entrypoint (rustargv), error); + return TRUE; } \ No newline at end of file diff --git a/src/app/rpmostree-compose-builtins.h b/src/app/rpmostree-compose-builtins.h index 8fd498abd5..841dbb0daf 100644 --- a/src/app/rpmostree-compose-builtins.h +++ b/src/app/rpmostree-compose-builtins.h @@ -48,5 +48,8 @@ gboolean rpmostree_compose_builtin_container_encapsulate (int argc, char **argv, gboolean rpmostree_compose_builtin_image (int argc, char **argv, RpmOstreeCommandInvocation *invocation, GCancellable *cancellable, GError **error); +gboolean rpmostree_compose_builtin_rootfs (int argc, char **argv, + RpmOstreeCommandInvocation *invocation, + GCancellable *cancellable, GError **error); G_END_DECLS diff --git a/tests/compose-rootfs/Containerfile b/tests/compose-rootfs/Containerfile index 356883d95a..56ecdca85b 100644 --- a/tests/compose-rootfs/Containerfile +++ b/tests/compose-rootfs/Containerfile @@ -17,7 +17,7 @@ COPY . /src WORKDIR /src RUN --mount=type=bind,from=repos,src=/,dst=/repos,rw <