daemon: Generate more predictable "id" variables for deployments
We can't rely on the the GLib hash functions not changing (or being stable across host systems). Basically here we have a "stringified" deployment...it might be simpler to just declare this stable.
This commit is contained in:
parent
18b9da97ab
commit
6b4becaef3
@ -22,18 +22,18 @@
|
|||||||
|
|
||||||
#include <libglnx.h>
|
#include <libglnx.h>
|
||||||
|
|
||||||
|
/* Get a currently unique (for this host) identifier for the
|
||||||
|
* deployment; TODO - adding the deployment timestamp would make it
|
||||||
|
* persistently unique, needs API in libostree.
|
||||||
|
*/
|
||||||
char *
|
char *
|
||||||
rpmostreed_deployment_generate_id (OstreeDeployment *deployment)
|
rpmostreed_deployment_generate_id (OstreeDeployment *deployment)
|
||||||
{
|
{
|
||||||
const char *osname;
|
|
||||||
guint hash;
|
|
||||||
|
|
||||||
g_return_val_if_fail (OSTREE_IS_DEPLOYMENT (deployment), NULL);
|
g_return_val_if_fail (OSTREE_IS_DEPLOYMENT (deployment), NULL);
|
||||||
|
return g_strdup_printf ("%s-%s.%u",
|
||||||
osname = ostree_deployment_get_osname (deployment);
|
ostree_deployment_get_osname (deployment),
|
||||||
hash = ostree_deployment_hash (deployment);
|
ostree_deployment_get_csum (deployment),
|
||||||
|
ostree_deployment_get_deployserial (deployment));
|
||||||
return g_strdup_printf ("%s_%u", osname, hash);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OstreeDeployment *
|
OstreeDeployment *
|
||||||
|
Loading…
Reference in New Issue
Block a user