Files
systemd/src/sysupdate/sysupdate-feature.h
T
dongshengyuan a6f7ded859 updatectl: fix feature JSON parsing
The feature JSON payload switched to `id`, `isEnabled`, and `appstream`,
and made `documentation` an array of URLs.
`updatectl` still parsed legacy table-derived names and a single URL.
This broke feature JSON parsing and made output inconsistent.
Features without documentation could also cause a null dereference.

Align `updatectl` with the current schema and preserve all
documentation URLs across sysupdate, D-Bus, and Varlink payloads.
Propagate condition evaluation errors through `condition_test_list()`
and `feature_is_suggested()`, with consistent JSON error handling and
tests.
The `suggested` field is now optional and always a boolean when
present; it is omitted rather than set to an error string when
SuggestOn*= conditions cannot be evaluated.
Add `suggested` metadata and document the field transition.

Follow-up for 3e34ccf6df.
Follow-up for 75a247d4de.
Follow-up for 40e727c93b.

Fixes #43603
2026-09-08 16:05:36 +02:00

31 lines
673 B
C

/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include "sysupdate-forward.h"
typedef struct Feature {
unsigned n_ref;
char *id;
char *description;
char **documentation;
char *appstream;
bool enabled;
int suggest;
Condition *suggest_on;
} Feature;
Feature *feature_new(void);
DECLARE_TRIVIAL_REF_UNREF_FUNC(Feature, feature);
DEFINE_TRIVIAL_CLEANUP_FUNC(Feature*, feature_unref);
extern const struct hash_ops feature_hash_ops;
int feature_read_definition(Feature *f, const char *root, const char *path, const char *const *conf_file_dirs);
int feature_is_suggested(const Feature *f);