Skip to content

FlatpakPermissionModel: Merge defaults from a list of overrides

ivan tkachenko requested to merge work/ratijas/6/multi-layer into master

FlatpakReference: Port metadata and overrides to a list of files

This is only porting API change. Functionally, permissions model works the same as before, meaning that it still only loads defaults from the base metadata file.

Let's go over the changes in this patch:

  • FlatpakHelper got new getters for various Flatpak directories. They are modular and efficient now (using static local caching).
  • Moved user-level overrides directory creation to PermissionModel's writeToFile() method, because it might have been removed between calls to the old permissionsDataDirectory() function and the actual config writing. And to make the new userOverridesDirectory() function pure. Pure functions are cool.
  • Metadata is no longer loaded in memory, it's just the first file path in the list of loaded configs now.
  • Refactor of FlatpakReferencesModel constructor: factored out some GLib code, split system and user installation processing to be able to locate their metadata correctly. It now also passes all the overrides levels to FlatpakReference constructor.
  • The rest is just porting to the new API.

FlatpakPermissionModel: Merge defaults from a list of overrides

The model now takes a list of all permissions files (metadata + every override except the very last one which we operate on), and merges them one by one into an in-memory KConfig object. The rest is unchanged.

While loading default values, we are not interested in keeping or processing unknown/unparsable entries in any way, which simplifies code a bit comparing to loadCurrentValues() method.

BUG: 466997


Note: It'd better be having some autotests. Meanwhile I tested manually, and it seems to work fine.

Merge request reports

Loading