|
Packit Service |
21c75c |
..
|
|
Packit Service |
21c75c |
Copyright (C) 2019 Red Hat, Inc.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
This copyrighted material is made available to anyone wishing to use,
|
|
Packit Service |
21c75c |
modify, copy, or redistribute it subject to the terms and conditions of
|
|
Packit Service |
21c75c |
the GNU General Public License v.2, or (at your option) any later version.
|
|
Packit Service |
21c75c |
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
Packit Service |
21c75c |
ANY WARRANTY expressed or implied, including the implied warranties of
|
|
Packit Service |
21c75c |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
|
Packit Service |
21c75c |
Public License for more details. You should have received a copy of the
|
|
Packit Service |
21c75c |
GNU General Public License along with this program; if not, write to the
|
|
Packit Service |
21c75c |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
Packit Service |
21c75c |
02110-1301, USA. Any Red Hat trademarks that are incorporated in the
|
|
Packit Service |
21c75c |
source code or documentation are not subject to the GNU General Public
|
|
Packit Service |
21c75c |
License and may only be used or replicated with the express permission of
|
|
Packit Service |
21c75c |
Red Hat, Inc.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
=====================
|
|
Packit Service |
21c75c |
Modularity Interface
|
|
Packit Service |
21c75c |
=====================
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. module:: dnf.module.module_base
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: dnf.module.module_base.ModuleBase
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Basic class for handling modules.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: __init__(base)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Initialize :class:`dnf.module.module_base.ModuleBase` object. `base` is an instance of the :class:`dnf.Base` class.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: enable(module_specs)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark module streams matching the `module_specs` list and also all required modular dependencies for enabling.
|
|
Packit Service |
21c75c |
For specs that do not specify the stream, the default stream is used. In case that the module has only one stream available, this stream is used regardles of whether it is the default or not.
|
|
Packit Service |
21c75c |
Note that only one stream of any given module can be enabled on a system.
|
|
Packit Service |
21c75c |
The method raises :exc:`dnf.exceptions.MarkingErrors` in case of errors.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Example::
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
#!/usr/bin/python3
|
|
Packit Service |
21c75c |
import dnf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base = dnf.Base()
|
|
Packit Service |
21c75c |
base.read_all_repos()
|
|
Packit Service |
21c75c |
base.fill_sack()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
module_base = dnf.module.module_base.ModuleBase(base)
|
|
Packit Service |
21c75c |
module_base.enable(['nodejs:11'])
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base.do_transaction()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: disable(module_specs)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark modules matching the `module_specs` list for disabling. Only the name part of the module specification is relevant. Stream, version, context, arch and profile parts are ignored (if given). All streams of the module will be disabled and all installed profiles will be removed. Packages previously installed from these modules will remain installed on the system.
|
|
Packit Service |
21c75c |
The method raises :exc:`dnf.exceptions.MarkingErrors` in case of errors.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Example::
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
#!/usr/bin/python3
|
|
Packit Service |
21c75c |
import dnf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base = dnf.Base()
|
|
Packit Service |
21c75c |
base.read_all_repos()
|
|
Packit Service |
21c75c |
base.fill_sack()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
module_base = dnf.module.module_base.ModuleBase(base)
|
|
Packit Service |
21c75c |
module_base.disable(['nodejs'])
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base.do_transaction()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: reset(module_specs)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark module for resetting so that it will no longer be enabled or disabled. All installed profiles of streams that have been reset will be removed.
|
|
Packit Service |
21c75c |
The method raises :exc:`dnf.exceptions.MarkingErrors` in case of errors.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: install(module_specs, strict=True)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark module profiles matching `module_specs` for installation and enable all required streams. If the stream or profile part of specification is not specified, the defaults are chosen. All packages of installed profiles are also marked for installation.
|
|
Packit Service |
21c75c |
If `strict` is set to ``False``, the installation skips modules with dependency solving problems.
|
|
Packit Service |
21c75c |
The method raises :exc:`dnf.exceptions.MarkingErrors` in case of errors.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Example::
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
#!/usr/bin/python3
|
|
Packit Service |
21c75c |
import dnf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base = dnf.Base()
|
|
Packit Service |
21c75c |
base.read_all_repos()
|
|
Packit Service |
21c75c |
base.fill_sack()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
module_base = dnf.module.module_base.ModuleBase(base)
|
|
Packit Service |
21c75c |
module_base.install(['nodejs:11/minimal'])
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base.resolve()
|
|
Packit Service |
21c75c |
base.download_packages(base.transaction.install_set)
|
|
Packit Service |
21c75c |
base.do_transaction()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: remove(module_specs)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark module profiles matching `module_spec` for removal. All packages installed from removed profiles (unless they are required by other profiles or user-installed packages) are also marked for removal.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: upgrade(module_specs)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Mark packages of module streams (or profiles) matching `module_spec` for upgrade.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: get_modules(module_spec)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Get information about modules matching `module_spec`. Returns tuple (module_packages, nsvcap), where `nsvcap` is a hawkey.NSVCAP object parsed from `module_spec` and `module_packages` is a tuple of :class:`libdnf.module.ModulePackage` objects matching this `nsvcap`.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Example::
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
#!/usr/bin/python3
|
|
Packit Service |
21c75c |
import dnf
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
base = dnf.Base()
|
|
Packit Service |
21c75c |
base.read_all_repos()
|
|
Packit Service |
21c75c |
base.fill_sack()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
module_base = dnf.module.module_base.ModuleBase(base)
|
|
Packit Service |
21c75c |
module_packages, nsvcap = module_base.get_modules('nodejs:11/minimal')
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
print("Parsed NSVCAP:")
|
|
Packit Service |
21c75c |
print("name:", nsvcap.name)
|
|
Packit Service |
21c75c |
print("stream:", nsvcap.stream)
|
|
Packit Service |
21c75c |
print("version:", nsvcap.version)
|
|
Packit Service |
21c75c |
print("context:", nsvcap.context)
|
|
Packit Service |
21c75c |
print("arch:", nsvcap.arch)
|
|
Packit Service |
21c75c |
print("profile:", nsvcap.profile)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
print("Matching modules:")
|
|
Packit Service |
21c75c |
for mpkg in module_packages:
|
|
Packit Service |
21c75c |
print(mpkg.getFullIdentifier())
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: libdnf.module.ModulePackage
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
This class represents a record identified by NSVCA from the repository modular metadata. See also https://github.com/fedora-modularity/libmodulemd/blob/master/spec.v2.yaml.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getName()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the name of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getStream()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the stream of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getVersion()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the version of the module as a string.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getVersionNum()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the version of the module as a number.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getContext()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the context of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getArch()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the architecture of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getNameStream()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return string in the form of 'name:stream' for the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getNameStreamVersion()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return string in the form of 'name:stream:version' for the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getFullIdentifier()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return string in the form of 'name:stream:version:context:architecture' for the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getProfiles(name=None)
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return tuple of :class:`libdnf.module.ModuleProfile` instancies representing each of the individual profiles of the module. If the `name` is given, only profiles matching the `name` pattern are returned.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getSummary()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the summary of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getDescription()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the description of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getRepoID()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the identifier of source repository of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getArtifacts()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return tuple of the artifacts of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getModuleDependencies()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return tuple of :class:`libdnf.module.ModuleDependencies` objects representing modular dependencies of the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getYaml()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return repomd yaml representing the module.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: libdnf.module.ModuleProfile
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getName()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the name of the profile.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getDescription()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return the description of the profile.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getContent()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return tuple of package names to be installed with this profile.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: libdnf.module.ModuleDependencies
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. method:: getRequires()
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
Return tuple of MapStringVectorString objects. These objects behave like standard python dictionaries and represent individual dependencies of the given module. Keys are names of required modules, values are tuples of required streams specifications.
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
.. class:: libdnf.module.ModulePackageContainer
|
|
Packit Service |
21c75c |
|
|
Packit Service |
21c75c |
This class is under development and should be considered unstable at the moment.
|
|
Packit Service |
21c75c |
|