Skip to content

Commit

Permalink
daemon: Add a sysroot argument to state → GVariant functions
Browse files Browse the repository at this point in the history
Prep for livefs; there we're storing live update state as xattrs on the
deployment root, and hence we need access to the sysroot to query it.
  • Loading branch information
cgwalters committed Mar 25, 2017
1 parent 3d9bb7c commit a829dfa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/daemon/rpmostreed-deployment-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,8 @@ variant_add_commit_details (GVariantDict *dict,
}

GVariant *
rpmostreed_deployment_generate_variant (OstreeDeployment *deployment,
rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot,
OstreeDeployment *deployment,
const char *booted_id,
OstreeRepo *repo,
GError **error)
Expand Down
15 changes: 8 additions & 7 deletions src/daemon/rpmostreed-deployment-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ OstreeDeployment *

GVariant * rpmostreed_deployment_generate_blank_variant (void);

GVariant * rpmostreed_deployment_generate_variant (OstreeDeployment *deployment,
const char *booted_id,
OstreeRepo *repo,
GError **error);
GVariant * rpmostreed_deployment_generate_variant (OstreeSysroot *sysroot,
OstreeDeployment *deployment,
const char *booted_id,
OstreeRepo *repo,
GError **error);

GVariant * rpmostreed_commit_generate_cached_details_variant (OstreeDeployment *deployment,
OstreeRepo *repo,
const gchar *refspec,
GError **error);
OstreeRepo *repo,
const gchar *refspec,
GError **error);

gint rpmostreed_rollback_deployment_index (const gchar *name,
OstreeSysroot *ot_sysroot,
Expand Down
15 changes: 9 additions & 6 deletions src/daemon/rpmostreed-os.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,7 +1198,8 @@ rpmostreed_os_load_internals (RpmostreedOS *self, GError **error)
booted = ostree_sysroot_get_booted_deployment (ot_sysroot);
if (booted && g_strcmp0 (ostree_deployment_get_osname (booted), name) == 0)
{
booted_variant = rpmostreed_deployment_generate_variant (booted, booted_id, ot_repo, error);
booted_variant = rpmostreed_deployment_generate_variant (ot_sysroot, booted, booted_id,
ot_repo, error);
if (!booted_variant)
return FALSE;
booted_id = rpmostreed_deployment_generate_id (booted);
Expand All @@ -1209,11 +1210,12 @@ rpmostreed_os_load_internals (RpmostreedOS *self, GError **error)
{
if (g_strcmp0 (ostree_deployment_get_osname (deployments->pdata[i]), name) == 0)
{
default_variant = rpmostreed_deployment_generate_variant (deployments->pdata[i],
default_variant = rpmostreed_deployment_generate_variant (ot_sysroot,
deployments->pdata[i],
booted_id,
ot_repo, error);
if (default_variant == NULL)
return FALSE;
if (default_variant == NULL)
return FALSE;
break;
}
}
Expand All @@ -1223,8 +1225,9 @@ rpmostreed_os_load_internals (RpmostreedOS *self, GError **error)
rollback_index = rpmostreed_rollback_deployment_index (name, ot_sysroot, NULL);
if (rollback_index >= 0)
{
rollback_variant = rpmostreed_deployment_generate_variant (deployments->pdata[rollback_index], booted_id,
ot_repo, error);
rollback_variant = rpmostreed_deployment_generate_variant (ot_sysroot,
deployments->pdata[rollback_index], booted_id,
ot_repo, error);
if (!rollback_variant)
return FALSE;
}
Expand Down
7 changes: 4 additions & 3 deletions src/daemon/rpmostreed-sysroot.c
Original file line number Diff line number Diff line change
Expand Up @@ -494,10 +494,11 @@ sysroot_populate_deployments_unlocked (RpmostreedSysroot *self,
GVariant *variant;
OstreeDeployment *deployment = deployments->pdata[i];
const char *deployment_os;

variant = rpmostreed_deployment_generate_variant (deployment, booted_id, self->repo, error);

variant = rpmostreed_deployment_generate_variant (self->ot_sysroot, deployment,
booted_id, self->repo, error);
if (!variant)
goto out;
goto out;
g_variant_builder_add_value (&builder, variant);

deployment_os = ostree_deployment_get_osname (deployment);
Expand Down

0 comments on commit a829dfa

Please sign in to comment.