Commit graph

6 commits

Author SHA1 Message Date
George Kiagiadakis
89ab5616c0 tests: component-loader: fix GError memory leak 2024-08-31 20:47:45 +03:00
George Kiagiadakis
a245d5fa46 internal-comp-loader: implement before/after dependencies for components
In some cases, requires/wants dependencies are not enough. As we saw in
!617, the m-standard-event-source module needs to be loaded after all
the hooks, otherwise there may be missed events that the hook was
supposed to "catch", but they were delivered before the hook was actually
loaded. In a similar fashion, we have in purpose put all the "monitor"
components at the every end of the array because if we load them earlier,
they will create devices and nodes before all the hooks are in place to
react.

While in standard configuration we can work this around, in extended
user configurations with custom components, it is impossible to do this
without overriding the entire components array.

To fix this properly, introduce before/after dependencies. They work in
a similar fashion as they work with event hooks. They do not implicitly
"pull" any components to be loaded, but they affect the ordering if the
mentioned components are indeed present.

Note that for backwards compatibility reasons and unlike systemd units,
the "requires"/"wants" targets imply an "after" dependency on them.

Fixes: #600
2024-08-31 20:33:42 +03:00
George Kiagiadakis
84d3382292 config: make it possible to have feature profiles
A profile is a list of features set to required/optional/disabled
which governs which components are getting loaded, given a static
components list with well-defined dependencies
2023-06-23 20:15:26 +03:00
George Kiagiadakis
19cfd37da6 comp-loader: register the component & feature only if it activates successfully
Fixes #470
See also !503
2023-06-20 17:20:01 +03:00
George Kiagiadakis
e738076cb0 conf: refactor component loading to use a dependency system
Each component can now list required and optional dependencies,
using the component feature names to match other components.
In addition, each component feature can be declared as required, optional
or disabled, making optional components easier to deal with.
The component flags (ifexists, nofail) have been removed.

Using virtual components, this system also allows easier customization
of which components should be loaded for a specific configuration,
without requiring the user to copy the list of components and edit it.

Also bump the required glib version to 2.68 for g_assert_cmpstrv()
2023-06-20 12:39:29 +03:00
George Kiagiadakis
9c2d25b985 tests: add component loader unit test 2023-06-20 12:39:29 +03:00