Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compose: Two minor cleanups #4629

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions rpmostree-cxxrs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2170,7 +2170,10 @@ extern "C"
bool unified_core) noexcept;

::rust::repr::PtrLen
rpmostreecxx$cxxbridge1$compose_postprocess_final (::std::int32_t rootfs_dfd) noexcept;
rpmostreecxx$cxxbridge1$compose_postprocess_final_pre (::std::int32_t rootfs_dfd) noexcept;

::rust::repr::PtrLen rpmostreecxx$cxxbridge1$compose_postprocess_final (
::std::int32_t rootfs_dfd, ::rpmostreecxx::Treefile const &treefile) noexcept;

::rust::repr::PtrLen rpmostreecxx$cxxbridge1$convert_var_to_tmpfiles_d (
::std::int32_t rootfs_dfd, ::rpmostreecxx::GCancellable const &cancellable) noexcept;
Expand All @@ -2181,9 +2184,6 @@ extern "C"
::rust::repr::PtrLen rpmostreecxx$cxxbridge1$workaround_selinux_cross_labeling (
::std::int32_t rootfs_dfd, ::rpmostreecxx::GCancellable &cancellable) noexcept;

::rust::repr::PtrLen rpmostreecxx$cxxbridge1$prepare_rpmdb_base_location (
::std::int32_t rootfs_dfd, ::rpmostreecxx::GCancellable &cancellable) noexcept;

::rust::repr::PtrLen
rpmostreecxx$cxxbridge1$compose_postprocess_rpm_macro (::std::int32_t rootfs_dfd) noexcept;

Expand Down Expand Up @@ -3959,54 +3959,54 @@ compose_postprocess (::std::int32_t rootfs_dfd, ::rpmostreecxx::Treefile &treefi
}

void
compose_postprocess_final (::std::int32_t rootfs_dfd)
compose_postprocess_final_pre (::std::int32_t rootfs_dfd)
{
::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$compose_postprocess_final (rootfs_dfd);
::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$compose_postprocess_final_pre (rootfs_dfd);
if (error$.ptr)
{
throw ::rust::impl< ::rust::Error>::error (error$);
}
}

void
convert_var_to_tmpfiles_d (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable const &cancellable)
compose_postprocess_final (::std::int32_t rootfs_dfd, ::rpmostreecxx::Treefile const &treefile)
{
::rust::repr::PtrLen error$
= rpmostreecxx$cxxbridge1$convert_var_to_tmpfiles_d (rootfs_dfd, cancellable);
= rpmostreecxx$cxxbridge1$compose_postprocess_final (rootfs_dfd, treefile);
if (error$.ptr)
{
throw ::rust::impl< ::rust::Error>::error (error$);
}
}

void
rootfs_prepare_links (::std::int32_t rootfs_dfd)
convert_var_to_tmpfiles_d (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable const &cancellable)
{
::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$rootfs_prepare_links (rootfs_dfd);
::rust::repr::PtrLen error$
= rpmostreecxx$cxxbridge1$convert_var_to_tmpfiles_d (rootfs_dfd, cancellable);
if (error$.ptr)
{
throw ::rust::impl< ::rust::Error>::error (error$);
}
}

void
workaround_selinux_cross_labeling (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable &cancellable)
rootfs_prepare_links (::std::int32_t rootfs_dfd)
{
::rust::repr::PtrLen error$
= rpmostreecxx$cxxbridge1$workaround_selinux_cross_labeling (rootfs_dfd, cancellable);
::rust::repr::PtrLen error$ = rpmostreecxx$cxxbridge1$rootfs_prepare_links (rootfs_dfd);
if (error$.ptr)
{
throw ::rust::impl< ::rust::Error>::error (error$);
}
}

void
prepare_rpmdb_base_location (::std::int32_t rootfs_dfd, ::rpmostreecxx::GCancellable &cancellable)
workaround_selinux_cross_labeling (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable &cancellable)
{
::rust::repr::PtrLen error$
= rpmostreecxx$cxxbridge1$prepare_rpmdb_base_location (rootfs_dfd, cancellable);
= rpmostreecxx$cxxbridge1$workaround_selinux_cross_labeling (rootfs_dfd, cancellable);
if (error$.ptr)
{
throw ::rust::impl< ::rust::Error>::error (error$);
Expand Down
8 changes: 4 additions & 4 deletions rpmostree-cxxrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1840,7 +1840,10 @@ void composepost_nsswitch_altfiles (::std::int32_t rootfs_dfd);
void compose_postprocess (::std::int32_t rootfs_dfd, ::rpmostreecxx::Treefile &treefile,
::rust::Str next_version, bool unified_core);

void compose_postprocess_final (::std::int32_t rootfs_dfd);
void compose_postprocess_final_pre (::std::int32_t rootfs_dfd);

void compose_postprocess_final (::std::int32_t rootfs_dfd,
::rpmostreecxx::Treefile const &treefile);

void convert_var_to_tmpfiles_d (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable const &cancellable);
Expand All @@ -1850,9 +1853,6 @@ void rootfs_prepare_links (::std::int32_t rootfs_dfd);
void workaround_selinux_cross_labeling (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable &cancellable);

void prepare_rpmdb_base_location (::std::int32_t rootfs_dfd,
::rpmostreecxx::GCancellable &cancellable);

void compose_postprocess_rpm_macro (::std::int32_t rootfs_dfd);

void postprocess_cleanup_rpmdb (::std::int32_t rootfs_dfd);
Expand Down
11 changes: 4 additions & 7 deletions rust/src/composepost.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ pub(crate) fn postprocess_cleanup_rpmdb(rootfs_dfd: i32) -> CxxResult<()> {
/// it as the bits of that function that we've chosen to implement in Rust.
/// It takes care of all things that are really required to use rpm-ostree
/// on the target host.
pub fn compose_postprocess_final(rootfs_dfd: i32) -> CxxResult<()> {
pub fn compose_postprocess_final_pre(rootfs_dfd: i32) -> CxxResult<()> {
let rootfs_dfd = unsafe { &crate::ffiutil::ffi_dirfd(rootfs_dfd)? };
// These tasks can safely run in parallel, so just for fun we do so via rayon.
let tasks = [
Expand Down Expand Up @@ -1028,14 +1028,11 @@ fn workaround_selinux_cross_labeling_recurse(
Ok(())
}

pub fn prepare_rpmdb_base_location(
rootfs_dfd: i32,
cancellable: Pin<&mut crate::FFIGCancellable>,
) -> CxxResult<()> {
/// This is the nearly the last code executed before we run `ostree commit`.
pub fn compose_postprocess_final(rootfs_dfd: i32, _treefile: &Treefile) -> CxxResult<()> {
let rootfs = unsafe { &crate::ffiutil::ffi_dirfd(rootfs_dfd)? };
let cancellable = &cancellable.gobj_wrap();

hardlink_rpmdb_base_location(rootfs, Some(cancellable))?;
hardlink_rpmdb_base_location(rootfs, None)?;
Ok(())
}

Expand Down
7 changes: 2 additions & 5 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,14 @@ pub mod ffi {
next_version: &str,
unified_core: bool,
) -> Result<()>;
fn compose_postprocess_final(rootfs_dfd: i32) -> Result<()>;
fn compose_postprocess_final_pre(rootfs_dfd: i32) -> Result<()>;
fn compose_postprocess_final(rootfs_dfd: i32, treefile: &Treefile) -> Result<()>;
fn convert_var_to_tmpfiles_d(rootfs_dfd: i32, cancellable: &GCancellable) -> Result<()>;
fn rootfs_prepare_links(rootfs_dfd: i32) -> Result<()>;
fn workaround_selinux_cross_labeling(
rootfs_dfd: i32,
cancellable: Pin<&mut GCancellable>,
) -> Result<()>;
fn prepare_rpmdb_base_location(
rootfs_dfd: i32,
cancellable: Pin<&mut GCancellable>,
) -> Result<()>;
fn compose_postprocess_rpm_macro(rootfs_dfd: i32) -> Result<()>;
fn postprocess_cleanup_rpmdb(rootfs_dfd: i32) -> Result<()>;
fn rewrite_rpmdb_for_target(rootfs_dfd: i32, normalize: bool) -> Result<()>;
Expand Down
6 changes: 3 additions & 3 deletions src/libpriv/rpmostree-postprocess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ postprocess_final (int rootfs_dfd, rpmostreecxx::Treefile &treefile, gboolean un

auto selinux = treefile.get_selinux ();

ROSCXX_TRY (compose_postprocess_final (rootfs_dfd), error);
ROSCXX_TRY (compose_postprocess_final_pre (rootfs_dfd), error);

if (selinux)
{
Expand Down Expand Up @@ -462,8 +462,8 @@ postprocess_final (int rootfs_dfd, rpmostreecxx::Treefile &treefile, gboolean un
return glnx_prefix_error (error, "During kernel processing");
}

/* we're composing a new tree; copy the rpmdb to the base location */
ROSCXX_TRY (prepare_rpmdb_base_location (rootfs_dfd, *cancellable), error);
/* And now the penultimate postprocessing */
ROSCXX_TRY (compose_postprocess_final (rootfs_dfd, treefile), error);

return TRUE;
}
Expand Down