Sack
—The fundamental hawkey structure¶
-
class
hawkey.
Sack
¶ Instances of
hawkey.Sack
represent collections of packages. An application typically needs at least one instance because it provides much of the hawkey’s functionality.len(sack)
returns the number of the packages loaded into the sack.Sacks cannot be deeply copied.
-
cache_dir
¶ A read-only string property giving the path to the location where a metadata cache is stored.
-
installonly
¶ A write-only sequence of strings property setting the provide names of packages that should only ever be installed, never upgraded.
-
installonly_limit
¶ A write-only integer property setting how many installonly packages with the same name are allowed to be installed concurrently. If
0
, any number of packages can be installed.
-
__init__
(cachedir=_CACHEDIR, arch=_ARCH, rootdir=_ROOTDIR, pkgcls=hawkey.Package, pkginitval=None, make_cache_dir=False, logfile=_LOGFILE)¶ Initialize the sack with a default cache directory, log file location set to
hawkey.log
in the cache directory, an automatically detected architecture and the current root (/
) as an installroot. The cache is disabled by default.cachedir is a string giving a path of a cache location.
arch is a string specifying an architecture.
rootdir is a string giving a path to an installroot.
pkgcls is a class of packages retrieved from the sack. The class’
__init__
method must accept two arguments. The first argument is a tuple of the sack and the ID of the package. The second argument is the pkginitval argument. pkginitval cannot beNone
if pkgcls is specified.make_cache_dir is a boolean that specifies whether the cache should be used to speedup loading of repositories or not (see Building and Reusing the Repo Cache).
logfile is a string giving a path of a log file location.
-
add_cmdline_package
(filename)¶ Add a package to a command line repository and return it. The package is specified as a string filename of an RPM file. The command line repository will be automatically created if doesn’t exist already. It could be referenced later by @commandline name.
-
add_excludes
(packages)¶ Add a sequence of packages that cannot be fetched by Queries nor Selectors.
-
add_includes
(packages)¶ Add a sequence of the only packages that can be fetched by Queries or Selectors.
This is the inverse operation of
add_excludes()
. Any package that is not in the union of all the included packages is excluded. This works in conjunction with exclude and doesn’t override it. So, if you both include and exclude the same package, the package is considered excluded no matter of the order.
-
disable_repo
(name)¶ Disable the repository identified by a string name. Packages in that repository cannot be fetched by Queries nor Selectors.
-
enable_repo
(name)¶ Enable the repository identified by a string name. Packages in that repository can be fetched by Queries or Selectors.
-
evr_cmp
(evr1, evr2)¶ Compare two EVR strings and return a negative integer if evr1 < evr2, zero if evr1 == evr2 or a positive integer if evr1 > evr2.
-
get_running_kernel
()¶ Detect and return the package of the currently running kernel. If the package cannot be found,
None
is returned.
-
list_arches
()¶ List strings giving all the supported architectures.
-
load_system_repo
(repo=None, build_cache=False)¶ Load the information about the packages in the system repository (in Fedora it is the RPM database) into the sack. This makes the dependency solving aware of the already installed packages. The system repository is always called
@System
. The information is not written to the cache by default.repo is an optional
Repo
object that represents the system repository. The object is updated during the loading.build_cache is a boolean that specifies whether the information should be written to the cache (see Building and Reusing the Repo Cache).
-
load_yum_repo
(repo, build_cache=False, load_filelists=False, load_presto=False, load_updateinfo=False)¶ Load the metadata of packages that can be obtained from different sources into the sack. This makes the dependency solving aware of these packages.
repo is a
Repo
object providing valid readable paths to the Yum metadata XML files that specify the sources of the packages. The object is updated during the loading.build_cache is a boolean that specifies whether the information should be written to the cache (see Building and Reusing the Repo Cache).
load_filelists, load_presto and load_updateinfo are booleans that specify whether the
<hash>filelists.xml.gz
,<hash>prestodelta.xml.gz
and<hash>updateinfo.xml.gz
files of the repository should be processed. These files may contain information needed for dependency solving, downloading or querying of some packages. Enable it if you are not sure (see Case for Loading the Filelists).
-