fedrq.backends.dnf.backend¶
This module contains a fedrq backend (i.e. an implementation of the
fedrq.backends.base.BackendMod
interface)
that uses the dnf Python bindings.
Modules:
-
experimental
–This module (and the other experimental modules in fedrq) are not meant for public use.
Classes:
-
BaseMaker
–Create a Base object and load repos
-
NEVRAForms
–Enum of NEVRAForms to pass to
Repoquery.resolve_pkg_specs
-
Repoquery
–Helpers to query a repository.
Functions:
-
get_changelogs
–Given a Package object, return an iterator of ChangelogEntry objects.
-
get_releasever
–Return the system releasever
Attributes:
-
BACKEND
–Name of the backend
-
Package
(type[PackageCompat]
) –Annotated alias to dnf.package.Package
-
PackageQuery
(type[PackageQueryCompat]
) –Annotated alias to dnf.query.Query
-
PackageQueryAlias
(TypeAlias
) – -
RepoError
–Error when loading repositories
Package
module-attribute
¶
Annotated alias to dnf.package.Package
PackageQuery
module-attribute
¶
Annotated alias to dnf.query.Query
PackageQueryAlias
module-attribute
¶
BaseMaker
¶
Bases: BaseMakerBase
Create a Base object and load repos
Initialize and configure the base object.
Methods:
-
create_repo
–Add a Repo object to the repo sack and configure it.
-
disable_repo
–Disable a repo by its id.
-
enable_repo
–Enable a repo by its id.
-
enable_repos
–Enable a list of repositories by their repoid.
-
enable_source_repos
–Enable the corresponding -source repos of the currently enabled
-
fill_sack
–Fill the sack and returns the dnf.Base object.
-
load_changelogs
–Load changelog metadata
-
load_filelists
–Load the filelists if they’re not already enabled by default
-
load_release_repos
–Load the repositories from a fedrq.config.Release object
-
read_repofile
–Load repositories from a repo file
-
read_system_repos
–Load system repositories into the base object.
-
repolist
–List available repoids.
-
set
–Set configuration options. Must be called before reading repos.
-
set_var
–Set substitutions (e.g. arch, basearch, releasever).
-
sets
–Set options on the base object
Attributes:
-
backend
(BackendMod
) –Return the backend’s module
-
base
(Base
) – -
conf
(MainConf
) –Return the backend’s Config object
Source code in src/fedrq/backends/dnf/backend/__init__.py
create_repo
¶
Add a Repo object to the repo sack and configure it.
Parameters:
-
kwargs
(Any
, default:{}
) –key-values options that should be set on the Repo object values (like
$basearch
) will be substituted automatically.
Source code in src/fedrq/backends/dnf/backend/__init__.py
disable_repo
¶
Disable a repo by its id.
Raise a ValueError if the repoid is not in self.base
’s configuration
when ignore_missing is False.
Source code in src/fedrq/backends/dnf/backend/__init__.py
enable_repo
¶
Enable a repo by its id.
Raise a ValueError if the repoid is not in self.base
’s configuration.
Source code in src/fedrq/backends/dnf/backend/__init__.py
enable_repos
¶
Enable a list of repositories by their repoid.
Raise a ValueError if the repoid is not in self.base
’s configuration.
Source code in src/fedrq/backends/dnf/backend/__init__.py
enable_source_repos
¶
fill_sack
¶
Fill the sack and returns the dnf.Base object. The repository configuration shouldn’t be manipulated after this.
Note that the _cachedir
arg is private and subject to removal.
Source code in src/fedrq/backends/dnf/backend/__init__.py
load_changelogs
¶
Load changelog metadata
Parameters:
-
enable
(bool
, default:True
) –Whether to enable or disable filelists
load_filelists
¶
Load the filelists if they’re not already enabled by default
Parameters:
-
enable
(bool
, default:True
) –Whether to enable or disable filelists
Source code in src/fedrq/backends/dnf/backend/__init__.py
load_release_repos
¶
Load the repositories from a fedrq.config.Release object
Parameters:
-
release
(Release
) –Release
object -
set_releasever
(bool
, default:True
) –Whether to set the
$releasever
based on the release or just leave it alone
Source code in src/fedrq/backends/base/__init__.py
read_repofile
¶
Load repositories from a repo file
read_system_repos
¶
Load system repositories into the base object. By default, they are all disabled even if ‘enabled=1’ is in the repository configuration.
Source code in src/fedrq/backends/dnf/backend/__init__.py
repolist
¶
List available repoids.
Parameters:
-
enabled
(bool | None
, default:None
) –Only show enabled repositories
set
¶
set_var
¶
Set substitutions (e.g. arch, basearch, releasever). Needs to be called before reading repos.
sets
¶
Set options on the base object
Parameters:
-
conf
(dict[str, Any]
) –A dict of configuration options. Call self.set() for each k-v pair.
-
substitutions
(dict[str, Any]
) –A dict of substitutions/vars options. Call self.set_var() for each k-v pair.
Source code in src/fedrq/backends/base/__init__.py
NEVRAForms
¶
Enum of NEVRAForms to pass to Repoquery.resolve_pkg_specs
Attributes:
Repoquery
¶
Bases: RepoqueryBase[PackageCompat, PackageQueryCompat[PackageCompat]]
Helpers to query a repository. Provides a unified repoquery interface for different backends.
Methods:
-
arch_filter
–Filter a query’s architectures and return it.
-
arch_filterm
–Filter a query’s architectures in place and return it.
-
get_package
–Return the latest Package that matches the ‘name’ and ‘arch’.
-
get_subpackages
–Return a PackageQuery containing the binary RPMS/subpackages produced
-
query
–Return an inital PackageQuery that’s filtered with **kwargs.
-
resolve_pkg_specs
–Resolve pkg specs.
Attributes:
-
backend
(BackendMod
) –Return fedrq.backends.dnf.backend module
-
base
(Base
) – -
base_arches
(set[str]
) –Return a set of the system’s arch and basearch.
Source code in src/fedrq/backends/dnf/backend/__init__.py
arch_filter
¶
Filter a query’s architectures and return it. It includes a little more functionality than query.filter(arch=…).
- When arch is None, the query is left untouched.
- If arch equals ‘notsrc’, all src and multilib packages are excluded.
- If arch equals ‘arched’, all noarch, multilib, and source packages are excluded.
- Otherwise, arch is passed to query.filterm(arch=…) and no other validation is preformed.
Source code in src/fedrq/backends/base/__init__.py
arch_filterm
¶
Filter a query’s architectures in place and return it. It includes a little more functionality than query.filterm(arch=…).
- When arch is None, the query is left untouched.
- If arch equals ‘notsrc’, all src and multilib packages are excluded.
- If arch equals ‘arched’, all noarch, multilib, and source packages are excluded.
- Otherwise, arch is passed to query.filterm(arch=…) and no other validation is preformed.
Source code in src/fedrq/backends/base/__init__.py
get_package
¶
Return the latest Package that matches the ‘name’ and ‘arch’. A ValueError is raised when no matches are found.
Source code in src/fedrq/backends/base/__init__.py
get_subpackages
¶
Return a PackageQuery containing the binary RPMS/subpackages produced by {packages}.
Parameters:
-
packages
(Iterable[_PackageT]
) –An interable of
PackageCompat
containing source packages
Source code in src/fedrq/backends/base/__init__.py
query
¶
Return an inital PackageQuery that’s filtered with **kwargs. Further filtering can be applied with the PackageQuery’s filter and filterm methods.
Source code in src/fedrq/backends/base/__init__.py
resolve_pkg_specs
¶
resolve_pkg_specs(
specs: Collection[str],
resolve: bool = False,
latest: int | None = None,
with_src: bool = True,
*,
with_filenames: bool | None = None,
with_provides: bool | None = None,
resolve_provides: bool | None = None,
nevra_forms: list[NEVRAForms | int] | None = None
)
Resolve pkg specs. See https://dnf.readthedocs.io/en/latest/command_ref.html?highlight=spec#specifying-packages or https://dnf5.readthedocs.io/en/latest/misc/specs.7.html for valid forms.
Parameters:
-
specs
(Collection[str]
) –Package specs to resolve.
-
resolve
(bool
, default:False
) –Whether to resolve file paths or virtual Provides in addition to package specs
-
latest
(int | None
, default:None
) –Limit packages with the same name and arch.
-
with_src
(bool
, default:True
) –Whether to consider
.src
packages when resolvingspecs
Source code in src/fedrq/backends/dnf/backend/__init__.py
get_changelogs
¶
Given a Package object, return an iterator of ChangelogEntry objects.