Deepsolver
|
The general interface to librpm functions. More...
Public Member Functions | |
std::string | combineNameAndVer (const std::string &name, const std::string &ver) const override |
Combines the package name and the package version into one string. | |
AbstractInstalledPkgIterator::Ptr | enumInstalledPkg () const override |
Creates an instance of an iterator over the set of installed packages. | |
std::string | getDesignation (const PkgBase &pkg, int epochMode) const override |
Constructs the string designation of the provided package. | |
std::string | getDesignation (const NamedPkgRel &rel) const override |
Constructs the string designation of the package relation. | |
void | initialize () override |
Prepares package back-end for any operations. | |
std::string | makeVer (int epoch, const std::string &ver, const std::string &release, int epochMode) const override |
Constructs a version designating string. | |
std::string | makeVer (const PkgBase &pkg, int epochMode) const override |
Constructs the string designating the package version. | |
bool | matches (const NamedPkgRel &rel, const Pkg &pkg) const override |
Checks if the package suits to the relation. | |
bool | matches (const NamedPkgRel &rel, const NamedPkgRel &provide) const override |
Checks if the provide entry suits to the relation (named form) | |
bool | matches (const IdPkgRel &rel, const IdPkgRel &provide) const override |
Checks if the provide entry suits to the relation (IDs form) | |
void | readPkgFile (const std::string &fileName, PkgFile &pkgFile) const override |
Reads header information from package file on disk. | |
RpmBackEnd () | |
The default constructor. | |
bool | theSamePkg (const PkgBase &pkg1, const PkgBase &pkg2) const override |
Checks if two instances represent the same package. | |
bool | transaction (const StringVector &toInstall, const StringVector &toRemove, const StringToStringMap &toUpgrade, const StringToStringMap &toDowngrade) override |
Performs install/remove transaction with given packages. | |
bool | validPkgFileName (const std::string &fileName) const override |
Checks if provided file name is a proper package name. | |
bool | validSourcePkgFileName (const std::string &fileName) const override |
Checks if provided file name is a proper source package name. | |
int | verCmp (const std::string &ver1, const std::string &ver2) const override |
Compares two version strings. | |
bool | verEqual (const std::string &ver1, const std::string &ver2) const override |
Checks the equality of two version values. | |
bool | verGreater (const std::string &ver1, const std::string &ver2) const override |
Checks if one version is newer than another. | |
bool | verOverlap (const VerSubset &ver1, const VerSubset &ver2) const override |
Overlaps two version ranges. | |
virtual | ~RpmBackEnd () |
The destructor. |
This class covers all functions of librpm needed for proper Deepsolver work. Since Deepsolver purposed by design as universal package manager all package libraries should be used through an abstraction layer represented by AbstractPackageBackEnd class. Be careful, even with abstraction layer user can face compatibility problems due to differences in details implementation.
std::string RpmBackEnd::combineNameAndVer | ( | const std::string & | name, |
const std::string & | ver | ||
) | const [override, virtual] |
[in] | name | The package name |
[in] | ver | The package version |
Implements Deepsolver::AbstractPkgBackEnd.
AbstractInstalledPkgIterator::Ptr RpmBackEnd::enumInstalledPkg | ( | ) | const [override, virtual] |
Implements Deepsolver::AbstractPkgBackEnd.
std::string Deepsolver::RpmBackEnd::getDesignation | ( | const PkgBase & | pkg, |
int | epochMode | ||
) | const [override, virtual] |
[in] | pkg | The package to construct string designation for |
[in] | The | epoch including mode (can be EpochNever, EpochIfNonZero or EpochAlways) |
Implements Deepsolver::AbstractPkgBackEnd.
std::string Deepsolver::RpmBackEnd::getDesignation | ( | const NamedPkgRel & | rel | ) | const [override, virtual] |
[in] | rel | The package relation to construct designation for |
Implements Deepsolver::AbstractPkgBackEnd.
void RpmBackEnd::initialize | ( | ) | [override, virtual] |
This method should be called before performing any operations with particular package library. For safety reasons it is assumed that invocation is needed for every created instance of the back-end but actually it is not always the case. For example, if RpmBackEnd is used, this method may be called only once using any instance.
Implements Deepsolver::AbstractPkgBackEnd.
std::string Deepsolver::RpmBackEnd::makeVer | ( | int | epoch, |
const std::string & | ver, | ||
const std::string & | release, | ||
int | epochMode | ||
) | const [override, virtual] |
[in] | epoch | The version epoch |
[in | ver The package version | |
[in] | The package release | |
[in] | The | epoch including mode (can be EpochNever, EpochIfNonZero or EpochAlways) |
Implements Deepsolver::AbstractPkgBackEnd.
std::string Deepsolver::RpmBackEnd::makeVer | ( | const PkgBase & | pkg, |
int | epochMode | ||
) | const [override, virtual] |
[in] | pkg | The package to construct version string for |
[in] | The | epoch including mode (can be EpochNever, EpochIfNonZero or EpochAlways) |
Implements Deepsolver::AbstractPkgBackEnd.
bool Deepsolver::RpmBackEnd::matches | ( | const NamedPkgRel & | rel, |
const Pkg & | pkg | ||
) | const [override, virtual] |
[in] | rel | The relation |
[in] | pkg | The package to check for |
Implements Deepsolver::AbstractPkgBackEnd.
bool Deepsolver::RpmBackEnd::matches | ( | const NamedPkgRel & | rel, |
const NamedPkgRel & | provide | ||
) | const [override, virtual] |
[in] | rel | The relation to check with |
[in] | provide | The provide entry to check |
Implements Deepsolver::AbstractPkgBackEnd.
bool Deepsolver::RpmBackEnd::matches | ( | const IdPkgRel & | rel, |
const IdPkgRel & | provide | ||
) | const [override, virtual] |
[in] | rel | The relation to check with |
[in] | provide | The provide entry to check |
Implements Deepsolver::AbstractPkgBackEnd.
void RpmBackEnd::readPkgFile | ( | const std::string & | fileName, |
PkgFile & | pkgFile | ||
) | const [override, virtual] |
[in] | fileName | The name of the file to read data from |
[out] | pkgFile | The object to save retrieved data to |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::theSamePkg | ( | const PkgBase & | pkg1, |
const PkgBase & | pkg2 | ||
) | const [override, virtual] |
[in] | pkg1 | The first package to compare |
[in] | pkg2 | The second package to compare |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::transaction | ( | const StringVector & | toInstall, |
const StringVector & | toRemove, | ||
const StringToStringMap & | toUpgrade, | ||
const StringToStringMap & | toDowngrade | ||
) | [override, virtual] |
This method gives a way to make desired changes in operating system state. With it everybody can perform a transaction containing any installation, removing, upgrading and downgrading tasks. The main restriction is a requirement that all package dependencies and conflicts must be satisfied. The package to install must be provided with their file names, packages to remove by their names (without a version or any other additional information), packages to upgrade and downgrade must be specified by a string-to-string map from package names to file names.
If a transaction fails this method returns zero. The state of OS after failed transaction is unspecified and package back-end dependent.
[in] | toInstall | The file names vector with packages to install |
[in] | toRemove | The file names vector with packages to remove |
[in] | toUpgrade | The map from package names to file names with packages to upgrade |
[in] | toDowngrade | The map from package names to file names with packages to downgrade |
PackageBackEndException |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::validPkgFileName | ( | const std::string & | fileName | ) | const [override, virtual] |
[in] | fileName | The file name to check |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::validSourcePkgFileName | ( | const std::string & | fileName | ) | const [override, virtual] |
[in] | fileName | The file name to check |
Implements Deepsolver::AbstractPkgBackEnd.
int RpmBackEnd::verCmp | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [override, virtual] |
[in] | ver1 | The first version value to compare |
[in] | ver2 | The second version value to compare |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::verEqual | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [override, virtual] |
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::verGreater | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [override, virtual] |
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implements Deepsolver::AbstractPkgBackEnd.
bool RpmBackEnd::verOverlap | ( | const VerSubset & | ver1, |
const VerSubset & | ver2 | ||
) | const [override, virtual] |
This method is not symmetric. If second version range has no epoch indication it assumes the first one may have any. So if this method is used for requires processing, the require entry can go only as second argument.
[in] | ver1 | The first version range to intersect |
[in] | ver2 | The second version range to intersect |
Implements Deepsolver::AbstractPkgBackEnd.