-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deployment: enable adding custom metadata #3212
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
} | ||
|
||
ret = TRUE; | ||
out: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In brand new code we can avoid use of goto
and just use return FALSE
above
|
||
if (opt_get) | ||
{ | ||
ostree_deployment_get_ext_metadata (first_deployment, *opt_get, error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to handle errors here
{ | ||
g_autofree char *backing_relpath = _ostree_sysroot_get_deployment_backing_relpath (self); | ||
g_autofree char *metadata_value = NULL; | ||
g_autofree int len = getxattr (backing_relpath, metadata_key, NULL, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the general case ostree wants to support using fd-relative paths, so we need to open a fd for the dir (relative to self->sysroot_fd
), then use fgetxattr()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also
g_autofree int len
Definitely don't want to call free()
on an integer. Also, getxattr
returns a ssize_t
, not an int
(they're different sizes).
@@ -107,4 +107,12 @@ const char *ostree_deployment_unlocked_state_to_string (OstreeDeploymentUnlocked | |||
_OSTREE_PUBLIC | |||
OstreeDeploymentUnlockedState ostree_deployment_get_unlocked (OstreeDeployment *self); | |||
|
|||
_OSTREE_PUBLIC | |||
gboolean ostree_deployment_set_ext_metadata (OstreeDeployment *self, const char *metadata_key, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New API needs to be added to libostree-devel.sym
; there's some ceremony to do that. See the comments around that and git log
.
This is a Work in progress and is very bad atm, still need to re-work it with GVariant and test it, but it builds locally... somehow.