Skip to content
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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmarrero
Copy link
Member

@jmarrero jmarrero commented Mar 12, 2024

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.

Copy link

openshift-ci bot commented Mar 12, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

}

ret = TRUE;
out:
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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().

Copy link
Member

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,
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants