core: Check if cached pkg is in partial state

Otherwise, we won't redownload, and then won't be able to checkout the
package during assembly. This is important, so that we can survive an
`ostree fsck --delete`. See e.g.:

https://discussion.fedoraproject.org/t/i-cant-boot-into-either-my-latest-or-previous-ostree-after-running-restorecon

Closes: #1860
Approved by: cgwalters
This commit is contained in:
Jonathan Lebon 2019-06-20 09:00:41 -04:00 committed by Atomic Bot
parent 3ea364ee61
commit 8c6402d5c1

View File

@ -1333,9 +1333,16 @@ find_pkg_in_ostree (RpmOstreeContext *self,
GLNX_AUTO_PREFIX_ERROR (errprefix, error);
g_autoptr(GVariant) commit = NULL;
if (!ostree_repo_load_commit (repo, cached_rev, &commit, NULL, error))
OstreeRepoCommitState commitstate;
if (!ostree_repo_load_commit (repo, cached_rev, &commit, &commitstate, error))
return FALSE;
g_assert (commit);
/* If the commit is partial, then we need to redownload. This can happen if e.g. corrupted
* commit objects were deleted with `ostree fsck --delete`. */
if (commitstate & OSTREE_REPO_COMMIT_STATE_PARTIAL)
return TRUE; /* Note early return */
g_autoptr(GVariant) metadata = g_variant_get_child_value (commit, 0);
g_autoptr(GVariantDict) metadata_dict = g_variant_dict_new (metadata);