Deepsolver
|
The general interface to librpm functions. More...
Public Member Functions | |
std::auto_ptr < AbstractInstalledPackagesIterator > | enumInstalledPackages () const |
Creates an instance of an iterator over the set of installed packages. | |
void | initialize () |
Prepares package back-end for any operations. | |
void | readPackageFile (const std::string &fileName, PkgFile &pkgFile) const |
Reads header information from package file on disk. | |
RpmBackEnd () | |
The default constructor. | |
bool | transaction (const StringVector &toInstall, const StringVector &toRemove, const StringToStringMap &toUpgrade, const StringToStringMap &toDowngrade) |
Performs install/remove transaction with given packages. | |
bool | validPkgFileName (const std::string &fileName) const |
Checks if provided file name is a proper package name. | |
bool | validSourcePkgFileName (const std::string &fileName) const |
Checks if provided file name is a proper source package name. | |
int | versionCompare (const std::string &ver1, const std::string &ver2) const |
Compares two version strings. | |
bool | versionEqual (const std::string &ver1, const std::string &ver2) const |
Compares two version values for equality. | |
bool | versionGreater (const std::string &ver1, const std::string &ver2) const |
Checks if one version is newer than another. | |
bool | versionOverlap (const VersionCond &ver1, const VersionCond &ver2) const |
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::auto_ptr< AbstractInstalledPackagesIterator > RpmBackEnd::enumInstalledPackages | ( | ) | const [virtual] |
Use this method to get the complete list of packages currently installed in the user system. Since iteration process is very back-end specific the iterator is also provided by abstract interface as back-end object itself.
Implements Deepsolver::AbstractPackageBackEnd.
void RpmBackEnd::initialize | ( | ) | [virtual] |
This method should be called before performing any operations with particular package library. For safety reasons it is assumed invocation is needed for every created instance of the back-end but actually it is not always so. For example in case of RpmBackEnd this method may be called only once with any instance.
Implements Deepsolver::AbstractPackageBackEnd.
void RpmBackEnd::readPackageFile | ( | const std::string & | fileName, |
PkgFile & | pkgFile | ||
) | const [virtual] |
This method reads header data from package file on dist using corresponding functions of an particular package library. Retrieved data is saved in the instance of the universal package class PkgFile.
[in] | fileName | The name of the file to read data from |
[out] | pkgFile | The object to save retrieved data in |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::transaction | ( | const StringVector & | toInstall, |
const StringVector & | toRemove, | ||
const StringToStringMap & | toUpgrade, | ||
const StringToStringMap & | toDowngrade | ||
) | [virtual] |
This method gives a way to make desired changes in operating system state. Using 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 | A file names vector with packages to install |
[in] | toRemove | A file names vector with packages to remove |
[in] | toUpgrade | A map from package names to file names with packages to upgrade |
[in] | toDowngrade | A map from package names to file names with packages to downgrade |
PackageBackEndException |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::validPkgFileName | ( | const std::string & | fileName | ) | const [virtual] |
Use this method to check package file extension.
[in] | fileName | The file name to check |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::validSourcePkgFileName | ( | const std::string & | fileName | ) | const [virtual] |
Use this method to check source package file extension.
[in] | fileName | The file name to check |
Implements Deepsolver::AbstractPackageBackEnd.
int RpmBackEnd::versionCompare | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [virtual] |
This method compares two version values and returns an integer value reflecting its relation.
[in] | ver1 | The first version value to compare |
[in] | ver2 | The second version value to compare |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::versionEqual | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [virtual] |
This method checks two strings designate same version value.
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::versionGreater | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [virtual] |
This method checks one version string designates version value newer than another.
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implements Deepsolver::AbstractPackageBackEnd.
bool RpmBackEnd::versionOverlap | ( | const VersionCond & | ver1, |
const VersionCond & | ver2 | ||
) | const [virtual] |
This method is not symmetric. If second version range has no epoch indication it assumes the same as in first one if there any. So if this method is used for requires processing the require entry should go only as second argument.
[in] | ver1 | The first version range to intersect |
[in] | ver2 | The second version range to intersect |
Implements Deepsolver::AbstractPackageBackEnd.