Modulemd.Prioritizer — Class to aid in merging metadata from multiple repositories.
Prioritizer is used to resolve merges between multiple repository metadata sources, possibly with varying priorities.
It is expected to be used as follows (python example) by tools such as
1 2 3 4 5 6 7
prioritizer = Modulemd.Prioritizer.new() prioritizer.take_index(fedora_repo_index, 0) prioritizer.take_index(updates_repo_index, 0) prioritizer.take_index(updates_testing_repo_index, 0) merged_index = prioritizer.resolve()
In the above code, merged_index will be a complete, merged view of the metadata from all of the added ModulemdModuleIndex instances.
When merging module streams, entries will be deduplicated based on whether they share the same module name, stream name, version number, and context. At present, libmodulemd does not interrogate more closely to determine if they have the same content, so if the repository configuration is broken and there exists two ModulemdModuleStream entries that have different content for the same NSVC, the behavior is undefined.
Merging ModulemdDefaults entries behaves as follows:
Any module default that is provided by a single repository is authoritative.
If the repos have different priorities (not common), then the default for this module and stream name coming from the repo of higher priority will be used and the default from the lower-priority repo will not be included.
If the repos have the same priority (such as "fedora" and "updates" in the Fedora Project), the entries will be merged as follows:
If both repositories specify a default stream for the module, use it.
If either repository specifies a default stream for the module and the other does not, use the one specified.
If both repositories specify different streams, this is an unresolvable merge conflict and the merge resolution will fail and report an error.
If both repositories specify a set of default profiles for a stream and the sets are equivalent, use that set.
If one repository specifies a set of default profiles for a stream and the other does not, use the one specified.
If both repositories specify a set of default profiles for a stream and each are providing a different set, this is an unresolvable merge conflict and the merge resolution will fail and report an error.
Merging ModulemdTranslations entries behaves as follows:
For each translated summary, description and profile description, compare
modified value of the Translation document matching this module name
and stream. Whichever has the higher value will be used. Any translation
containing the empty string will be interpreted as removing the
translation. Subsequent processing of a higher modified value may restore
ModulemdPrioritizer * modulemd_prioritizer_new (
A newly-allocated Modulemd.Prioritizer object.
void modulemd_prioritizer_take_index (
Once all repositories have been added, call
to perform the merge.
This ModulemdPrioritizer object.
A ModuleIndex, usually constructed by reading
the module metadata from a repository with
The priority of the repository that the entries in
ModulemdModuleIndex * modulemd_prioritizer_resolve (
A newly-allocated ModulemdModuleIndex containing
the merged results. If this function encounters an unresolvable merge
conflict, it will return NULL and set