Skip to content

Commit

Permalink
compose: Reintroduce postprocess_final
Browse files Browse the repository at this point in the history
Subsubming the rpmdb function that was already there; prep for
doing more at that stage.
  • Loading branch information
cgwalters committed Sep 29, 2023
1 parent fcf6356 commit 313e008
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 deletions.
28 changes: 14 additions & 14 deletions rpmostree-cxxrs.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -2172,6 +2172,9 @@ extern "C"
::rust::repr::PtrLen
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 @@ -3969,44 +3969,44 @@ compose_postprocess_final_pre (::std::int32_t rootfs_dfd)
}

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
6 changes: 3 additions & 3 deletions rpmostree-cxxrs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1842,6 +1842,9 @@ void compose_postprocess (::std::int32_t rootfs_dfd, ::rpmostreecxx::Treefile &t

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
9 changes: 3 additions & 6 deletions rust/src/composepost.rs
Original file line number Diff line number Diff line change
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
5 changes: 1 addition & 4 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,16 +290,13 @@ pub mod ffi {
unified_core: bool,
) -> 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
4 changes: 2 additions & 2 deletions src/libpriv/rpmostree-postprocess.cxx
Original file line number Diff line number Diff line change
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

0 comments on commit 313e008

Please sign in to comment.