Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jlebon committed Jul 20, 2021
1 parent f77af9f commit 7e93ead
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/app/rpmostree-clientlib.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1862,10 +1862,11 @@ rpmostree_mux_get_default_deployment (RpmOstreeMux *mux,
if (mux->selector == SELECTOR_DBUS)
return rpmostree_os_dup_default_deployment (mux->os_proxy);

g_autoptr(OstreeDeployment) deployment = NULL;
ostree_sysroot_query_deployments_for (mux->sysroot, mux->osname, &deployment, NULL);
if (!deployment)
return (GVariant*)glnx_null_throw (error, "No pending deployment found for OS '%s'", mux->osname);
g_autoptr(GPtrArray) deployments = ostree_sysroot_get_deployments (mux->sysroot);
if (deployments->len == 0)
return (GVariant*)glnx_null_throw (error, "No deployments found for OS '%s'", mux->osname);

OstreeDeployment *deployment = (OstreeDeployment*)deployments->pdata[0];
g_autoptr(GVariant) ret = rpmostreed_deployment_generate_variant (mux->sysroot, deployment,
ostree_sysroot_repo (mux->sysroot), TRUE,
error);
Expand All @@ -1881,18 +1882,18 @@ rpmostree_mux_get_deployments (RpmOstreeMux *mux,
if (mux->selector == SELECTOR_DBUS)
return rpmostree_sysroot_dup_deployments (mux->sysroot_proxy);

g_autoptr(GPtrArray) deployments = ostree_sysroot_get_deployments (mux->sysroot);
if (deployments->len == 0)
return (GVariant*)glnx_null_throw (error, "No deployments found for OS '%s'", mux->osname);

/* For the purposes of rpmostreed_deployment_generate_variant(), we don't want to directly
* use the sysroot's repo because it won't be able to find the remotes. Ideally, we'd be
* able to transiently set the remotes dir on the repo, but currently it requires setting
* at construction time, so we hack around this by using a separate repo object.
* */
g_autoptr(OstreeRepo) repo = NULL;
{
g_autoptr(OstreeDeployment) deployment = NULL;
ostree_sysroot_query_deployments_for (mux->sysroot, mux->osname, &deployment, NULL);
if (!deployment)
return (GVariant*)glnx_null_throw (error, "No pending deployment found for OS '%s'", mux->osname);

OstreeDeployment *deployment = (OstreeDeployment*)deployments->pdata[0];
g_autofree char *deployment_root = rpmostree_get_deployment_root (mux->sysroot, deployment);
g_autofree char *remotes_dir = g_build_filename (deployment_root, "etc/ostree/remotes.d", NULL);
repo = (OstreeRepo*)g_object_new (OSTREE_TYPE_REPO,
Expand All @@ -1905,7 +1906,6 @@ rpmostree_mux_get_deployments (RpmOstreeMux *mux,
GVariantBuilder builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));

g_autoptr(GPtrArray) deployments = ostree_sysroot_get_deployments (mux->sysroot);
for (guint i = 0; deployments != NULL && i < deployments->len; i++)
{
auto deployment = static_cast<OstreeDeployment *>(deployments->pdata[i]);
Expand Down
4 changes: 2 additions & 2 deletions src/libpriv/rpmostree-scripts.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -418,12 +418,12 @@ rpmostree_run_script_in_bwrap_container (int rootfs_fd,
{
stdout_fd = sd_journal_stream_fd (id, LOG_INFO, 0);
if (stdout_fd < 0)
return glnx_prefix_error (error, "While creating stdout stream fd");
return glnx_throw (error, "While creating stdout stream fd: %s", g_strerror (-stdout_fd));
bwrap->take_stdout_fd(stdout_fd);

stderr_fd = sd_journal_stream_fd (id, LOG_ERR, 0);
if (stderr_fd < 0)
return glnx_prefix_error (error, "While creating stderr stream fd");
return glnx_throw (error, "While creating stderr stream fd: %s", g_strerror (-stderr_fd));
bwrap->take_stderr_fd(stderr_fd);
}
else
Expand Down

0 comments on commit 7e93ead

Please sign in to comment.