fedrq.backends.libdnf5.backend¶
This module contains a fedrq backend (i.e. an implementation of the
fedrq.backends.base.BackendMod
interface)
that uses the libdnf5 Python bindings.
Classes:
-
BaseMaker
–Create a Base object and load repos
-
Package
–libdnf5.rpm.Package subclass with strong dnf.package.Package compatability
-
PackageQuery
–Subclass of libdnf5.rpm.PackageQuery with dnf.query.Query compatability
-
Repoquery
–Helpers to query a repository.
-
_QueryFilterKwargs
–Keyword-arguments accepted by
Repoquery.query
. -
NEVRAForms
–Enum of NEVRAForms to pass to
Repoquery.resolve_pkg_specs
Functions:
-
get_releasever
–Return the system releasever
Attributes:
BaseMaker
¶
Bases: BaseMakerBase
Create a Base object and load repos
Initialize and configure the base object.
Parameters:
-
base
(Base | None
, default:None
) –Pass in a
libdnf.base.Base
object to configure instead of creating a new one. -
initialized
(bool
, default:False
) –Set to True if
base.setup()
has already been called. Only applies whenbase
is passed. -
config_loaded
(bool
, default:False
) –Set to True if base.load_config_from_file() has already been called. Only applies when
base
is passed.
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 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
-
setup
–
Attributes:
-
backend
(BackendMod
) –Return fedrq.backends.libdnf5.backend module
-
base
(Base
) –The underlying dnf.base object
-
conf
(ConfigMain
) –Return libdnf5 config object.
-
config
(ConfigMain
) –DEPRECATED: use
conf
property instead -
initialized
(bool
) –INTERNAL: Whether the base object has been initialized
-
rs
(RepoSackWeakPtr
) –Return libdnf5 RepoSack object.
-
vars
(Vars
) –Return libdnf5 Vars object.
Source code in src/fedrq/backends/libdnf5/backend/__init__.py
initialized
instance-attribute
¶
INTERNAL: Whether the base object has been initialized
rs
property
¶
Return libdnf5 RepoSack object. Not part of the BaseMakerBase interface!
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/libdnf5/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/libdnf5/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/libdnf5/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/libdnf5/backend/__init__.py
enable_source_repos
¶
fill_sack
¶
Fill the sack and returns the 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/libdnf5/backend/__init__.py
load_changelogs
¶
load_filelists
¶
Load the filelists if they’re not already enabled by default
Parameters:
-
enable
(bool
, default:True
) –Whether to enable or disable filelists
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
¶
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/libdnf5/backend/__init__.py
repolist
¶
List available repoids.
Parameters:
-
enabled
(bool | None
, default:None
) –Only show enabled repositories
set
¶
Set configuration options. Must be called before reading repos.
Source code in src/fedrq/backends/libdnf5/backend/__init__.py
set_var
¶
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
Package
¶
Bases: Package
, PackageCompat
libdnf5.rpm.Package subclass with strong dnf.package.Package compatability
Methods:
Attributes:
-
DEBUGINFO_SUFFIX
– -
DEBUGSOURCE_SUFFIX
– -
a
(str
) – -
arch
(str
) – -
buildtime
(int
) – -
conflicts
(Iterable[Reldep5]
) – -
debug_name
(str
) – -
description
(str
) – -
downloadsize
(int
) – -
e
(int
) – -
enhances
(Iterable[Reldep5]
) – -
epoch
(int
) – -
evr
(str
) – -
files
(Iterable[str]
) – -
from_repo
(str
) – -
installsize
(int
) – -
installtime
(int
) – -
license
(str
) – -
location
(str
) – -
name
(str
) – -
obsoletes
(Iterable[Reldep5]
) – -
packager
(str
) – -
provides
(Iterable[Reldep5]
) – -
r
(str
) – -
reason
(str
) – -
recommends
(Iterable[Reldep5]
) – -
release
(str
) – -
repo
(RepoWeakPtr
) –Return the package’s Repo object.
-
repoid
(str
) – -
reponame
(str
) – -
requires
(Iterable[Reldep5]
) – -
size
(int
) – -
source_debug_name
(str
) – -
source_name
(Optional[str]
) – -
sourcerpm
(Optional[str]
) – -
suggests
(Iterable[Reldep5]
) – -
summary
(str
) – -
supplements
(Iterable[Reldep5]
) – -
url
(str
) – -
v
(str
) – -
vendor
(str
) – -
version
(str
) –
repo
property
¶
Return the package’s Repo object. The exact object depends on which backend is used.
remote_location
¶
remote_location(
schemes: Collection[str] | None = (
"http",
"ftp",
"file",
"https",
)
) -> str | None
Source code in src/fedrq/backends/libdnf5/backend/__init__.py
PackageQuery
¶
Bases: PackageQuery
, PackageQueryCompat[Package]
Subclass of libdnf5.rpm.PackageQuery with dnf.query.Query compatability
Methods:
-
difference
–Return the difference between
self
andother
-
filter
–Filter the PackageQuery.
-
filter_pkg
– -
filterm
–Filter the PackageQuery in place and return ‘self’.
-
intersection
–Return the difference between
self
andother
-
union
–Combine two PackageQuery objects.
difference
¶
Return the difference between self
and other
(packages that are in self
but not other
).
Depending on the backend, this either modifies ‘self’ in place and
returns ‘self’ or returns a new PackageQuery object.
filter
¶
Filter the PackageQuery. Depending on the backend, this either modifies ‘self’ in place and return ‘self’ or return a new PackageQuery object. See https://dnf.readthedocs.io/en/latest/api_queries.html#dnf.query.Query.filter for the allowed kwargs.
filter_pkg
¶
Source code in src/fedrq/backends/libdnf5/backend/__init__.py
filterm
¶
Filter the PackageQuery in place and return ‘self’. See https://dnf.readthedocs.io/en/latest/api_queries.html#dnf.query.Query.filter for the allowed kwargs.
intersection
¶
Return the difference between self
and other
(packages that are in both self
and other
).
Depending on the backend, this either modifies ‘self’ in place and
returns ‘self’ or returns a new PackageQuery object.
union
¶
Repoquery
¶
Bases: RepoqueryBase[Package, PackageQuery]
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.libdnf5.backend module
-
base
(Base
) – -
base_arches
(set[str]
) –Return a set of the system’s arch and basearch.
Source code in src/fedrq/backends/libdnf5/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
) -> PackageQuery
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/libdnf5/backend/__init__.py
_QueryFilterKwargs
¶
Bases: TypedDict
Keyword-arguments accepted by Repoquery.query
.
Attributes:
-
arch
(StrIter
) – -
arch__eq
(StrIter
) – -
arch__glob
(StrIter
) – -
arch__neq
(StrIter
) – -
conflicts
(Union[StrIter, ReldepList, PackageSet]
) – -
conflicts__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
conflicts__glob
(StrIter
) – -
conflicts__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
description
(StrIter
) – -
description__contains
(StrIter
) – -
description__eq
(StrIter
) – -
description__glob
(StrIter
) – -
description__neq
(StrIter
) – -
downgrades
(bool
) – -
empty
(bool
) – -
enhances
(Union[StrIter, ReldepList, PackageSet]
) – -
enhances__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
enhances__glob
(StrIter
) – -
enhances__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
epoch
(Union[StrIter, IntIter]
) – -
epoch__eq
(Union[StrIter, IntIter]
) – -
epoch__glob
(StrIter
) – -
epoch__gt
(IntIter
) – -
epoch__gte
(IntIter
) – -
epoch__lt
(IntIter
) – -
epoch__lte
(IntIter
) – -
epoch__neq
(Union[StrIter, IntIter]
) – -
file
(StrIter
) – -
file__contains
(StrIter
) – -
file__eq
(StrIter
) – -
file__glob
(StrIter
) – -
file__neq
(StrIter
) – -
latest
(int
) – -
latest_per_arch
(int
) – -
name
(Union[StrIter, PackageSet]
) – -
name__contains
(StrIter
) – -
name__eq
(Union[StrIter, PackageSet]
) – -
name__glob
(StrIter
) – -
name__neq
(Union[StrIter, PackageSet]
) – -
obsoletes
(Union[StrIter, ReldepList, PackageSet]
) – -
obsoletes__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
obsoletes__glob
(StrIter
) – -
obsoletes__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
pkg
(Iterable[Package]
) – -
pkg__eq
(Iterable[Package]
) – -
pkg__neq
(Iterable[Package]
) – -
provides
(Union[StrIter, ReldepList]
) – -
provides__eq
(Union[StrIter, ReldepList]
) – -
provides__glob
(StrIter
) – -
provides__neq
(Union[StrIter, ReldepList]
) – -
recommends
(Union[StrIter, ReldepList, PackageSet]
) – -
recommends__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
recommends__glob
(StrIter
) – -
recommends__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
release
(StrIter
) – -
release__eq
(StrIter
) – -
release__glob
(StrIter
) – -
release__gt
(StrIter
) – -
release__gte
(StrIter
) – -
release__lt
(StrIter
) – -
release__lte
(StrIter
) – -
release__neq
(StrIter
) – -
reponame
(StrIter
) – -
reponame__contains
(StrIter
) – -
reponame__eq
(StrIter
) – -
reponame__glob
(StrIter
) – -
reponame__neq
(StrIter
) – -
requires
(Union[StrIter, ReldepList, PackageSet]
) – -
requires__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
requires__glob
(StrIter
) – -
requires__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
sourcerpm
(StrIter
) – -
sourcerpm__eq
(StrIter
) – -
sourcerpm__glob
(StrIter
) – -
sourcerpm__neq
(StrIter
) – -
suggests
(Union[StrIter, ReldepList, PackageSet]
) – -
suggests__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
suggests__glob
(StrIter
) – -
suggests__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
summary
(StrIter
) – -
summary__contains
(StrIter
) – -
summary__eq
(StrIter
) – -
summary__glob
(StrIter
) – -
summary__neq
(StrIter
) – -
supplements
(Union[StrIter, ReldepList, PackageSet]
) – -
supplements__eq
(Union[StrIter, ReldepList, PackageSet]
) – -
supplements__glob
(StrIter
) – -
supplements__neq
(Union[StrIter, ReldepList, PackageSet]
) – -
url
(StrIter
) – -
url__contains
(StrIter
) – -
url__eq
(StrIter
) – -
url__glob
(StrIter
) – -
url__neq
(StrIter
) – -
version
(StrIter
) – -
version__eq
(StrIter
) – -
version__glob
(StrIter
) – -
version__gt
(StrIter
) – -
version__gte
(StrIter
) – -
version__lt
(StrIter
) – -
version__lte
(StrIter
) – -
version__neq
(StrIter
) –
NEVRAForms
¶
Enum of NEVRAForms to pass to Repoquery.resolve_pkg_specs
Attributes:
get_releasever
cached
¶
Return the system releasever