core/commit: clean up rpmdb leftover files
While debugging the recent `BDB0087 DB_RUNRECOVERY` issues that cropped up recently, I came upon the fact that we're leaving leftover rpmdb files in the rootfs on client-side assemblies. Let's clean those up too. We do this in the `commit` phase, *after* the final time we access the rpmdb to generate the pkglist. Closes: #1247 Approved by: cgwalters
This commit is contained in:
parent
0a4f6bdab4
commit
75f4636320
@ -4127,6 +4127,10 @@ rpmostree_context_commit (RpmOstreeContext *self,
|
||||
"rpmostree.state-sha512",
|
||||
g_variant_new_string (state_checksum));
|
||||
|
||||
/* And finally, make sure we clean up rpmdb left over files */
|
||||
if (!rpmostree_cleanup_leftover_rpmdb_files (self->tmprootfs_dfd, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
OstreeRepoCommitModifierFlags modflags = OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE;
|
||||
/* For ex-container (bare-user-only), we always need canonical permissions */
|
||||
if (ostree_repo_get_mode (self->ostreerepo) == OSTREE_REPO_MODE_BARE_USER_ONLY)
|
||||
|
@ -1211,6 +1211,15 @@ cleanup_selinux_lockfiles (int rootfs_fd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
rpmostree_cleanup_leftover_rpmdb_files (int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
return cleanup_leftover_files (rootfs_fd, RPMOSTREE_RPMDB_LOCATION, rpmdb_leftover_files,
|
||||
rpmdb_leftover_prefixes, cancellable, error);
|
||||
}
|
||||
|
||||
/**
|
||||
* rpmostree_rootfs_postprocess_common:
|
||||
*
|
||||
@ -1253,8 +1262,7 @@ rpmostree_rootfs_postprocess_common (int rootfs_fd,
|
||||
}
|
||||
}
|
||||
|
||||
if (!cleanup_leftover_files (rootfs_fd, RPMOSTREE_RPMDB_LOCATION, rpmdb_leftover_files,
|
||||
rpmdb_leftover_prefixes, cancellable, error))
|
||||
if (!rpmostree_cleanup_leftover_rpmdb_files (rootfs_fd, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
/* If we do have an rpmdb, hardlink it into the base path */
|
||||
|
@ -48,6 +48,12 @@ gboolean
|
||||
rpmostree_rootfs_prepare_links (int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
rpmostree_cleanup_leftover_rpmdb_files (int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean
|
||||
rpmostree_rootfs_postprocess_common (int rootfs_fd,
|
||||
GCancellable *cancellable,
|
||||
|
@ -106,8 +106,14 @@ if [[ $output != foo-1.0-1.x86_64 ]]; then
|
||||
fi
|
||||
echo "ok correct output"
|
||||
|
||||
# check that there are no leftover rpmdb files
|
||||
booted_csum=$(vm_get_booted_csum)
|
||||
vm_cmd ostree ls $booted_csum /usr/share/rpm > out.txt
|
||||
assert_not_file_has_content out.txt __db
|
||||
echo "ok no leftover rpmdb files"
|
||||
|
||||
# upgrade to a layer with foo already builtin
|
||||
vm_cmd ostree commit -b vmcheck --tree=ref=$(vm_get_booted_csum)
|
||||
vm_cmd ostree commit -b vmcheck --tree=ref=$booted_csum
|
||||
vm_rpmostree upgrade
|
||||
vm_build_rpm bar conflicts foo
|
||||
if vm_rpmostree install bar &> err.txt; then
|
||||
|
Loading…
Reference in New Issue
Block a user