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.ModuleIndex
object.- Return type:
New in version 2.0.
- add_defaults(defaults)¶
- Parameters:
defaults (
Modulemd.Defaults
) – TheModulemd.Defaults
object to add to the index.- Raises:
- Returns:
True
if theModulemd.Defaults
was added successfully. If the defaults already existed in the index, it will be replaced by the new one. On failure, returnsFalse
and sets error appropriately.- Return type:
New in version 2.0.
- add_module_stream(stream)¶
- Parameters:
stream (
Modulemd.ModuleStream
) – TheModulemd.ModuleStream
to 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:
True
if theModulemd.ModuleStream
was added successfully. If the stream already existed in the index, it will be replaced by the new one. On failure, returnsFalse
and sets error appropriately.- Return type:
Add a
Modulemd.ModuleStream
to theModulemd.ModuleIndex
. While being added, theModulemd.ModuleStream
will be upgraded toModulemd.ModuleStreamVersionEnum.LATEST
to ensure that merges done withModulemd.ModuleIndexMerger
will 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.Obsoletes
object to add to the index.- Raises:
- Returns:
True
if theModulemd.Obsoletes
was added successfully. If the obsoletes already existed in the index, it will be replaced by the new one. On failure, returnsFalse
and sets error appropriately.- Return type:
New in version 2.10.
- add_translation(translation)¶
- Parameters:
translation (
Modulemd.Translation
) – TheModulemd.Translation
object to add to the index.- Raises:
- Returns:
True
if theModulemd.Translation
was added successfully. If the translation already existed in the index, it will be replaced by the new one. On failure, returnsFalse
and sets error appropriately.- Return type:
New in version 2.0.
- clear_xmds()¶
Iterates through all
Modulemd.ModuleStream
entries in thisModulemd.ModuleIndex
and 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 (
str
orNone
) – The name of the system intent whose default stream will be retrieved. If leftNone
or the specified intent has no separate default, it will return the generic default stream for this module.- Returns:
A
GLib.HashTable
with 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.Defaults
in 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.Module
object matching the provided module name orNone
if 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.ModuleStream
in 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:
True
if the module name was present in the index.False
if 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.ModuleStream
objects 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 (
str
orNone
) – The name of the module to retrieve. IfNone
, will search all modules in the index.stream_name (
str
orNone
) – The name of the stream to retrieve. IfNone
, will search all streams in a module.version (
str
orNone
) – The version of the stream to retrieve. IfNone
, will search all versions.context (
str
orNone
) – The context of the stream to retrieve. IfNone
, will search all contexts.arch (
str
orNone
) – 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 (
str
orNone
) – A glob pattern to match against the NSVCA strings of theModulemd.ModuleStream
objects 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 (
str
orNone
) – If non-None
, the path to a directory containing defaults documents that should override those in path.
- Raises:
- Returns:
True
if all “.yaml” files in the directory were imported successfully (this includes if no “.yaml” files were present).False
if 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:
True
if the update was successful. ReturnsFalse
and 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-None
pointer. 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:
True
if the update was successful. ReturnsFalse
and 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-None
pointer. 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.Defaults
metadata version to upgrade to.- Raises:
- Return type:
Upgrades all
Modulemd.Defaults
objects 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.Defaults
object 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.ModuleStream
metadata version to upgrade to.- Raises:
- Return type:
Upgrades all
Modulemd.ModuleStream
objects in this index to mdversion if they are not already at that version.New in version 2.0.