sysupdate: Factor context creation out of installdb_cleanup_component()

This makes it like all the other verbs and therefore easier to refactor.

At the same time, remove the separate `component` argument and instead
use the `component` set on the `Context`. This guards against bugs, as
various parts of the `Context` state depend on the component (for
example, `installdb_fd`) and overriding the component without also
overriding its dependent variables will lead to bugs.
This commit is contained in:
Philip Withnall
2026-06-26 10:43:51 +01:00
parent 23bfc4b9e8
commit 7f3c27128b
4 changed files with 34 additions and 23 deletions
-7
View File
@@ -28,13 +28,6 @@ typedef struct Context {
Context* context_free(Context *c);
DEFINE_TRIVIAL_CLEANUP_FUNC(Context*, context_free);
typedef enum ReadDefinitionsFlags {
READ_DEFINITIONS_REQUIRES_ENABLED_TRANSFERS = 1 << 0,
READ_DEFINITIONS_REQUIRES_ANY_TRANSFERS = 1 << 1,
} ReadDefinitionsFlags;
int context_make_offline(Context **ret, const char *node, const char *component, ReadDefinitionsFlags read_definitions_flags);
extern bool arg_sync;
extern uint64_t arg_instances_max;
extern char *arg_root;