Port to new ostree_repo_checkout_at()

Squashes some deprecation warnings, and now with the latest master we
can stop setting `disable_fsync`.

Closes: #418
Approved by: giuseppe
This commit is contained in:
Colin Walters 2016-08-04 07:07:57 -04:00 committed by Atomic Bot
parent 39913a2c25
commit e18d43bad3
4 changed files with 24 additions and 40 deletions

View File

@ -330,21 +330,16 @@ rpmostree_container_builtin_assemble (int argc,
g_print ("Checking out %s @ %s...\n", name, commit); g_print ("Checking out %s @ %s...\n", name, commit);
{ OstreeRepoCheckoutOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER, { OstreeRepoCheckoutAtOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER,
OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, }; OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, };
/* For now... to be crash safe we'd need to duplicate some of the
* boot-uuid/fsync gating at a higher level.
*/
opts.disable_fsync = TRUE;
/* Also, what we really want here is some sort of sane lifecycle /* Also, what we really want here is some sort of sane lifecycle
* management with whatever is running in the root. * management with whatever is running in the root.
*/ */
if (!glnx_shutil_rm_rf_at (rocctx->roots_dfd, target_rootdir, cancellable, error)) if (!glnx_shutil_rm_rf_at (rocctx->roots_dfd, target_rootdir, cancellable, error))
goto out; goto out;
if (!ostree_repo_checkout_tree_at (rocctx->repo, &opts, rocctx->roots_dfd, target_rootdir, if (!ostree_repo_checkout_at (rocctx->repo, &opts, rocctx->roots_dfd, target_rootdir,
commit, cancellable, error)) commit, cancellable, error))
goto out; goto out;
} }
@ -549,15 +544,10 @@ rpmostree_container_builtin_upgrade (int argc, char **argv, GCancellable *cancel
g_print ("Checking out %s @ %s...\n", name, new_commit_checksum); g_print ("Checking out %s @ %s...\n", name, new_commit_checksum);
{ OstreeRepoCheckoutOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER, { OstreeRepoCheckoutAtOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER,
OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, }; OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, };
/* For now... to be crash safe we'd need to duplicate some of the if (!ostree_repo_checkout_at (rocctx->repo, &opts, rocctx->roots_dfd, target_new_root,
* boot-uuid/fsync gating at a higher level.
*/
opts.disable_fsync = TRUE;
if (!ostree_repo_checkout_tree_at (rocctx->repo, &opts, rocctx->roots_dfd, target_new_root,
new_commit_checksum, cancellable, error)) new_commit_checksum, cancellable, error))
goto out; goto out;
} }

View File

@ -761,16 +761,15 @@ checkout_min_tree_in_tmp (OstreeRepo *repo,
/* also check out sepolicy so that prepare_install() will be able to sort the /* also check out sepolicy so that prepare_install() will be able to sort the
* packages correctly */ * packages correctly */
{ {
OstreeRepoCheckoutOptions opts = {0,}; OstreeRepoCheckoutAtOptions opts = {0,};
if (!glnx_shutil_mkdir_p_at (tmprootfs_dfd, "usr/etc", 0777, if (!glnx_shutil_mkdir_p_at (tmprootfs_dfd, "usr/etc", 0777,
cancellable, error)) cancellable, error))
goto out; goto out;
opts.subpath = "usr/etc/selinux"; opts.subpath = "usr/etc/selinux";
opts.disable_fsync = TRUE;
if (!ostree_repo_checkout_tree_at (repo, &opts, tmprootfs_dfd, if (!ostree_repo_checkout_at (repo, &opts, tmprootfs_dfd,
"usr/etc/selinux", revision, "usr/etc/selinux", revision,
cancellable, error)) cancellable, error))
goto out; goto out;
@ -799,7 +798,7 @@ checkout_tree_in_tmp (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeRepoCheckoutOptions checkout_options = { 0, }; OstreeRepoCheckoutAtOptions checkout_options = { 0, };
g_autofree char *tmprootfs = g_strdup ("tmp/rpmostree-commit-XXXXXX"); g_autofree char *tmprootfs = g_strdup ("tmp/rpmostree-commit-XXXXXX");
glnx_fd_close int tmprootfs_dfd = -1; glnx_fd_close int tmprootfs_dfd = -1;
@ -816,10 +815,9 @@ checkout_tree_in_tmp (OstreeRepo *repo,
rpmostree_output_task_begin ("Checking out tree %.7s", revision); rpmostree_output_task_begin ("Checking out tree %.7s", revision);
/* we actually only need this here because we use "." for path */ /* we actually only need this here because we use "." for path */
checkout_options.disable_fsync = TRUE;
checkout_options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES; checkout_options.overwrite_mode = OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES;
checkout_options.devino_to_csum_cache = devino_cache; checkout_options.devino_to_csum_cache = devino_cache;
if (!ostree_repo_checkout_tree_at (repo, &checkout_options, tmprootfs_dfd, if (!ostree_repo_checkout_at (repo, &checkout_options, tmprootfs_dfd,
".", revision, cancellable, error)) ".", revision, cancellable, error))
goto out; goto out;

View File

@ -1266,7 +1266,7 @@ ostree_checkout_package (OstreeRepo *repo,
GError **error) GError **error)
{ {
gboolean ret = FALSE; gboolean ret = FALSE;
OstreeRepoCheckoutOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER, OstreeRepoCheckoutAtOptions opts = { OSTREE_REPO_CHECKOUT_MODE_USER,
OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, }; OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_FILES, };
/* We want the checkout to match the repo type so that we get hardlinks. */ /* We want the checkout to match the repo type so that we get hardlinks. */
@ -1275,14 +1275,10 @@ ostree_checkout_package (OstreeRepo *repo,
opts.devino_to_csum_cache = devino_cache; opts.devino_to_csum_cache = devino_cache;
/* For now... to be crash safe we'd need to duplicate some of the
* boot-uuid/fsync gating at a higher level.
*/
opts.disable_fsync = TRUE;
/* Always want hardlinks */ /* Always want hardlinks */
opts.no_copy_fallback = TRUE; opts.no_copy_fallback = TRUE;
if (!ostree_repo_checkout_tree_at (repo, &opts, dfd, path, if (!ostree_repo_checkout_at (repo, &opts, dfd, path,
pkg_commit, cancellable, error)) pkg_commit, cancellable, error))
goto out; goto out;

View File

@ -712,7 +712,7 @@ rpmostree_checkout_only_rpmdb_tempdir (OstreeRepo *repo,
gboolean ret = FALSE; gboolean ret = FALSE;
g_autofree char *commit = NULL; g_autofree char *commit = NULL;
g_autofree char *tempdir = NULL; g_autofree char *tempdir = NULL;
OstreeRepoCheckoutOptions checkout_options = { 0, }; OstreeRepoCheckoutAtOptions checkout_options = { 0, };
glnx_fd_close int tempdir_dfd = -1; glnx_fd_close int tempdir_dfd = -1;
g_return_val_if_fail (out_tempdir != NULL, FALSE); g_return_val_if_fail (out_tempdir != NULL, FALSE);
@ -730,7 +730,7 @@ rpmostree_checkout_only_rpmdb_tempdir (OstreeRepo *repo,
checkout_options.mode = OSTREE_REPO_CHECKOUT_MODE_USER; checkout_options.mode = OSTREE_REPO_CHECKOUT_MODE_USER;
checkout_options.subpath = "usr/share/rpm"; checkout_options.subpath = "usr/share/rpm";
if (!ostree_repo_checkout_tree_at (repo, &checkout_options, if (!ostree_repo_checkout_at (repo, &checkout_options,
tempdir_dfd, "usr/share/rpm", tempdir_dfd, "usr/share/rpm",
commit, commit,
cancellable, error)) cancellable, error))