Modulemd.ModuleIndex¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Modulemd.ModuleIndex(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
- classmethod new()¶
- Returns:
A newly-allocated
Modulemd.ModuleIndexobject.- Return type:
New in version 2.0.
- add_defaults(defaults)¶
- Parameters:
defaults (
Modulemd.Defaults) – TheModulemd.Defaultsobject to add to the index.- Raises:
- Returns:
Trueif theModulemd.Defaultswas added successfully. If the defaults already existed in the index, it will be replaced by the new one. On failure, returnsFalseand sets error appropriately.- Return type:
New in version 2.0.
- add_module_stream(stream)¶
- Parameters:
stream (
Modulemd.ModuleStream) – TheModulemd.ModuleStreamto add to the index. The stream added must have a module name and stream name set on it or it will be rejected.- Raises:
- Returns:
Trueif theModulemd.ModuleStreamwas added successfully. If the stream already existed in the index, it will be replaced by the new one. On failure, returnsFalseand sets error appropriately.- Return type:
Add a
Modulemd.ModuleStreamto theModulemd.ModuleIndex. While being added, theModulemd.ModuleStreamwill be upgraded toModulemd.ModuleStreamVersionEnum.LATESTto ensure that merges done withModulemd.ModuleIndexMergerwill always occur between streams of the same version. If this upgrade cannot be performed, the function will return error set appropriately.New in version 2.0.
- add_obsoletes(obsoletes)¶
- Parameters:
obsoletes (
Modulemd.Obsoletes) – TheModulemd.Obsoletesobject to add to the index.- Raises:
- Returns:
Trueif theModulemd.Obsoleteswas added successfully. If the obsoletes already existed in the index, it will be replaced by the new one. On failure, returnsFalseand sets error appropriately.- Return type:
New in version 2.10.
- add_translation(translation)¶
- Parameters:
translation (
Modulemd.Translation) – TheModulemd.Translationobject to add to the index.- Raises:
- Returns:
Trueif theModulemd.Translationwas added successfully. If the translation already existed in the index, it will be replaced by the new one. On failure, returnsFalseand sets error appropriately.- Return type:
New in version 2.0.
- clear_xmds()¶
Iterates through all
Modulemd.ModuleStreamentries in thisModulemd.ModuleIndexand removes any XMD sections that are present. This is generally done to trim down the metadata to only the portions that are useful to the package manager.New in version 2.14.
- dump_to_string()¶
- Raises:
- Returns:
A YAML representation of the index as a string. In the event of an error, sets error appropriately and returns
None.- Return type:
New in version 2.0.
- get_default_streams(intent)¶
- Parameters:
intent (
strorNone) – The name of the system intent whose default stream will be retrieved. If leftNoneor the specified intent has no separate default, it will return the generic default stream for this module. System intents are deprecated and this argument will be ignored in the future.- Returns:
A
GLib.HashTablewith the module name as the key and the default stream as the value for all modules with a default stream in the index. Modules without a default stream will not appear in this table.- Return type:
Get a dictionary of all modules in the index that have a default stream.
This function cannot fail, but may return an empty (non-
None)GLib.HashTable.New in version 2.5.
- get_defaults_mdversion()¶
- Returns:
The metadata version of
Modulemd.Defaultsin use for this index.- Return type:
New in version 2.0.
- get_module(module_name)¶
- Parameters:
module_name (
str) – The module name to look up in the index.- Returns:
The
Modulemd.Moduleobject matching the provided module name orNoneif the key was not present in the index.- Return type:
New in version 2.0.
- get_module_names()¶
- Returns:
An ordered list of string keys in this index.
- Return type:
[
str]
New in version 2.0.
- get_stream_mdversion()¶
- Returns:
The metadata version of
Modulemd.ModuleStreamin use for this index.- Return type:
New in version 2.0.
- remove_module(module_name)¶
- Parameters:
module_name (
str) – The name of the module to remove from the index.- Returns:
Trueif the module name was present in the index.Falseif it was not.- Return type:
Remove a module, including all of its streams, its defaults and its translations from a
Modulemd.ModuleIndex.New in version 2.2.
- search_rpms(nevra_pattern)¶
- Parameters:
nevra_pattern (
str) – A glob pattern to match against the NEVRA strings of the rpm artifacts in theModulemd.ModuleStreamobjects in this module.- Returns:
The list of stream objects containing an RPM that matches the nevra_pattern. This function cannot fail, but it may return a zero-length list if no matches were found. The returned streams will be in a predictable order, sorted first by module name, then stream name, then by version (highest first), then by context and finally by architecture.
- Return type:
All arguments to this method will be compared using fnmatch(3).
New in version 2.9.
- search_streams(module_name, stream_name, version, context, arch)¶
- Parameters:
module_name (
strorNone) – The name of the module to retrieve. IfNone, will search all modules in the index.stream_name (
strorNone) – The name of the stream to retrieve. IfNone, will search all streams in a module.version (
strorNone) – The version of the stream to retrieve. IfNone, will search all versions.context (
strorNone) – The context of the stream to retrieve. IfNone, will search all contexts.arch (
strorNone) – The processor architecture of the stream to retrieve. IfNone, the architecture is not included in the search.
- Returns:
The list of stream objects matching all of the requested parameters. This function cannot fail, but it may return a zero-length list if no matches were found. The returned streams will be in a predictable order, sorted first by module name, then stream name, then by version (highest first), then by context and finally by architecture.
- Return type:
All arguments to this method will be compared using fnmatch(3).
New in version 2.9.
- search_streams_by_nsvca_glob(nsvca_pattern)¶
- Parameters:
nsvca_pattern (
strorNone) – A glob pattern to match against the NSVCA strings of theModulemd.ModuleStreamobjects in this module. IfNone, this will match all NSVCAs.- Returns:
The list of stream objects matching all of the requested parameters. This function cannot fail, but it may return a zero-length list if no matches were found. The returned streams will be in a predictable order, sorted first by module name, then stream name, then by version (highest first), then by context and finally by architecture.
- Return type:
New in version 2.9.
- update_from_defaults_directory(path, strict, overrides_path)¶
- Parameters:
path (
str) – The path to a directory containing defaults documents.strict (
bool) – Whether the parser should return failure if it encounters an unknown mapping key or a conflict in module default streams.overrides_path (
strorNone) – If non-None, the path to a directory containing defaults documents that should override those in path.
- Raises:
- Returns:
Trueif all “.yaml” files in the directory were imported successfully (this includes if no “.yaml” files were present).Falseif one or more files could not be read successfully and sets error appropriately.- Return type:
This function will open the directory at path and iterate through it, adding any files with the suffix “.yaml” to self. If overrides_path is non-
None, it will also open any files with the suffix “.yaml” in that location and import them, overriding any conflicts with the existing defaults.Note: If you need detailed information about what failed and why, it is better to implement the directory traversal yourself and use the
Modulemd.ModuleIndex.update_from_file() function, as it will return the failures information.New in version 2.8.
- update_from_file(yaml_file, strict)¶
- Parameters:
- Raises:
- Returns:
Trueif the update was successful. ReturnsFalseand sets failures appropriately if any of the YAML subdocuments were invalid or sets error if there was a fatal parse error.- failures:
On output, an array containing any subdocuments (pointers to
Modulemd.SubdocumentInfo) from the YAML file that failed to parse. On input, it must be a non-Nonepointer. If that pointer points toNone, this call will allocate a new array (regardless of any failures) with an element destructor set toGObject.Object.unref(). Otherwise, the pointed array is reused without emptying before adding the failed subdocuments. The caller is responsible for freeing the array.
- Return type:
(
bool, failures: [Modulemd.SubdocumentInfo])
New in version 2.0.
- update_from_string(yaml_string, strict)¶
- Parameters:
- Raises:
- Returns:
Trueif the update was successful. ReturnsFalseand sets failures appropriately if any of the YAML subdocuments were invalid or sets error if there was a fatal parse error.- failures:
On output, an array containing any subdocuments (pointers to
Modulemd.SubdocumentInfo) from the YAML file that failed to parse. On input, it must be a non-Nonepointer. If that pointer points toNone, this call will allocate a new array (regardless of any failures) with an element destructor set toGObject.Object.unref(). Otherwise, the pointed array is reused without emptying before adding the failed subdocuments. The caller is responsible for freeing the array.
- Return type:
(
bool, failures: [Modulemd.SubdocumentInfo])
New in version 2.0.
- upgrade_defaults(mdversion)¶
- Parameters:
mdversion (
Modulemd.DefaultsVersionEnum) – TheModulemd.Defaultsmetadata version to upgrade to.- Raises:
- Return type:
Upgrades all
Modulemd.Defaultsobjects in this index to mdversion if they are not already at that version. An attempt to downgrade or an attempt to upgrade beyond the latest supported version will report an error. In the case of a failure to upgrade a particularModulemd.Defaultsobject of the index, an error will be reported and the index will be left in an undefined state.New in version 2.0.
- upgrade_streams(mdversion)¶
- Parameters:
mdversion (
Modulemd.ModuleStreamVersionEnum) – TheModulemd.ModuleStreammetadata version to upgrade to.- Raises:
- Return type:
Upgrades all
Modulemd.ModuleStreamobjects in this index to mdversion if they are not already at that version.New in version 2.0.