Deepsolver
|
The abstract package back-end interface. More...
Public Types | |
enum | { EpochNever, EpochIfNonZero, EpochAlways } |
typedef std::shared_ptr < AbstractPkgBackEnd > | Ptr |
Public Member Functions | |
AbstractPkgBackEnd () | |
The default constructor. | |
virtual std::string | combineNameAndVer (const std::string &name, const std::string &ver) const =0 |
Combines the package name and the package version into one string. | |
virtual AbstractInstalledPkgIterator::Ptr | enumInstalledPkg () const =0 |
Creates an instance of an iterator over the set of installed packages. | |
virtual std::string | getDesignation (const PkgBase &pkg, int epochMode) const =0 |
Constructs the string designation of the provided package. | |
virtual std::string | getDesignation (const NamedPkgRel &rel) const =0 |
Constructs the string designation of the package relation. | |
virtual void | initialize ()=0 |
Prepares package back-end for any operations. | |
virtual std::string | makeVer (int epoch, const std::string &ver, const std::string &release, int epochMode) const =0 |
Constructs a version designating string. | |
virtual std::string | makeVer (const PkgBase &pkg, int epochMode) const =0 |
Constructs the string designating the package version. | |
virtual bool | matches (const NamedPkgRel &rel, const Pkg &pkg) const =0 |
Checks if the package suits to the relation. | |
virtual bool | matches (const NamedPkgRel &rel, const NamedPkgRel &provide) const =0 |
Checks if the provide entry suits to the relation (named form) | |
virtual bool | matches (const IdPkgRel &rel, const IdPkgRel &provide) const =0 |
Checks if the provide entry suits to the relation (IDs form) | |
virtual void | readPkgFile (const std::string &fileName, PkgFile &pkgFile) const =0 |
Reads header information from package file on disk. | |
virtual bool | theSamePkg (const PkgBase &pkg1, const PkgBase &pkg2) const =0 |
Checks if two instances represent the same package. | |
virtual bool | transaction (const StringVector &toInstall, const StringVector &toRemove, const StringToStringMap &toUpgrade, const StringToStringMap &toDowngrade)=0 |
Performs install/remove transaction with given packages. | |
virtual bool | validPkgFileName (const std::string &fileName) const =0 |
Checks if provided file name is a proper package name. | |
virtual bool | validSourcePkgFileName (const std::string &fileName) const =0 |
Checks if provided file name is a proper source package name. | |
virtual int | verCmp (const std::string &ver1, const std::string &ver2) const =0 |
Compares two version strings. | |
virtual bool | verEqual (const std::string &ver1, const std::string &ver2) const =0 |
Checks the equality of two version values. | |
virtual bool | verGreater (const std::string &ver1, const std::string &ver2) const =0 |
Checks if one version is newer than another. | |
virtual bool | verOverlap (const VerSubset &ver1, const VerSubset &ver2) const =0 |
Overlaps two version ranges. | |
virtual | ~AbstractPkgBackEnd () |
The destructor. |
This abstract interface isolates any functions of an particular package library like rpm, dpkg or any other. They can be treated as back-ends for Deepsolver itself. Although all methods has strict declaration they semantics can be not exactly the same due to differences in package libraries behaviour. So every developer and user should be very careful on any attempt to add new library support. The first real implementation of this class was for librpm, so all dependent code has unpremeditated influence of this library.
virtual std::string Deepsolver::AbstractPkgBackEnd::combineNameAndVer | ( | const std::string & | name, |
const std::string & | ver | ||
) | const [pure virtual] |
[in] | name | The package name |
[in] | ver | The package version |
Implemented in Deepsolver::RpmBackEnd.
virtual AbstractInstalledPkgIterator::Ptr Deepsolver::AbstractPkgBackEnd::enumInstalledPkg | ( | ) | const [pure virtual] |
Implemented in Deepsolver::RpmBackEnd.
virtual std::string Deepsolver::AbstractPkgBackEnd::getDesignation | ( | const PkgBase & | pkg, |
int | epochMode | ||
) | const [pure virtual] |
[in] | pkg | The package to construct string designation for |
[in] | The | epoch including mode (can be EpochNever, EpochIfNonZero or EpochAlways) |
Implemented in Deepsolver::RpmBackEnd.
virtual std::string Deepsolver::AbstractPkgBackEnd::getDesignation | ( | const NamedPkgRel & | rel | ) | const [pure virtual] |
[in] | rel | The package relation to construct designation for |
Implemented in Deepsolver::RpmBackEnd.
virtual void Deepsolver::AbstractPkgBackEnd::initialize | ( | ) | [pure 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.
Implemented in Deepsolver::RpmBackEnd.
virtual std::string Deepsolver::AbstractPkgBackEnd::makeVer | ( | int | epoch, |
const std::string & | ver, | ||
const std::string & | release, | ||
int | epochMode | ||
) | const [pure 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) |
Implemented in Deepsolver::RpmBackEnd.
virtual std::string Deepsolver::AbstractPkgBackEnd::makeVer | ( | const PkgBase & | pkg, |
int | epochMode | ||
) | const [pure virtual] |
[in] | pkg | The package to construct version string for |
[in] | The | epoch including mode (can be EpochNever, EpochIfNonZero or EpochAlways) |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::matches | ( | const NamedPkgRel & | rel, |
const Pkg & | pkg | ||
) | const [pure virtual] |
[in] | rel | The relation |
[in] | pkg | The package to check for |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::matches | ( | const NamedPkgRel & | rel, |
const NamedPkgRel & | provide | ||
) | const [pure virtual] |
[in] | rel | The relation to check with |
[in] | provide | The provide entry to check |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::matches | ( | const IdPkgRel & | rel, |
const IdPkgRel & | provide | ||
) | const [pure virtual] |
[in] | rel | The relation to check with |
[in] | provide | The provide entry to check |
Implemented in Deepsolver::RpmBackEnd.
virtual void Deepsolver::AbstractPkgBackEnd::readPkgFile | ( | const std::string & | fileName, |
PkgFile & | pkgFile | ||
) | const [pure virtual] |
[in] | fileName | The name of the file to read data from |
[out] | pkgFile | The object to save retrieved data to |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::theSamePkg | ( | const PkgBase & | pkg1, |
const PkgBase & | pkg2 | ||
) | const [pure virtual] |
[in] | pkg1 | The first package to compare |
[in] | pkg2 | The second package to compare |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::transaction | ( | const StringVector & | toInstall, |
const StringVector & | toRemove, | ||
const StringToStringMap & | toUpgrade, | ||
const StringToStringMap & | toDowngrade | ||
) | [pure 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 |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::validPkgFileName | ( | const std::string & | fileName | ) | const [pure virtual] |
[in] | fileName | The file name to check |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::validSourcePkgFileName | ( | const std::string & | fileName | ) | const [pure virtual] |
[in] | fileName | The file name to check |
Implemented in Deepsolver::RpmBackEnd.
virtual int Deepsolver::AbstractPkgBackEnd::verCmp | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure virtual] |
[in] | ver1 | The first version value to compare |
[in] | ver2 | The second version value to compare |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::verEqual | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure virtual] |
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::verGreater | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure virtual] |
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implemented in Deepsolver::RpmBackEnd.
virtual bool Deepsolver::AbstractPkgBackEnd::verOverlap | ( | const VerSubset & | ver1, |
const VerSubset & | ver2 | ||
) | const [pure 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 |
Implemented in Deepsolver::RpmBackEnd.