Deepsolver
|
The abstract package back-end interface. More...
Public Member Functions | |
AbstractPackageBackEnd () | |
The default constructor. | |
virtual std::auto_ptr < AbstractInstalledPackagesIterator > | enumInstalledPackages () const =0 |
Creates an instance of an iterator over the set of installed packages. | |
virtual void | initialize ()=0 |
Prepares package back-end for any operations. | |
virtual void | readPackageFile (const std::string &fileName, PkgFile &pkgFile) const =0 |
Reads header information from package file on disk. | |
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 | versionCompare (const std::string &ver1, const std::string &ver2) const =0 |
Compares two version strings. | |
virtual bool | versionEqual (const std::string &ver1, const std::string &ver2) const =0 |
Compares two version values for equality. | |
virtual bool | versionGreater (const std::string &ver1, const std::string &ver2) const =0 |
Checks if one version is newer than another. | |
virtual bool | versionOverlap (const VersionCond &ver1, const VersionCond &ver2) const =0 |
Overlaps two version ranges. | |
virtual | ~AbstractPackageBackEnd () |
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. Nevertheless 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 librpm so all dependent code has its unpremeditated influence.
virtual std::auto_ptr<AbstractInstalledPackagesIterator> AbstractPackageBackEnd::enumInstalledPackages | ( | ) | const [pure 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.
Implemented in RpmBackEnd.
virtual void AbstractPackageBackEnd::initialize | ( | ) | [pure 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.
Implemented in RpmBackEnd.
virtual void AbstractPackageBackEnd::readPackageFile | ( | const std::string & | fileName, |
PkgFile & | pkgFile | ||
) | const [pure 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 |
Implemented in RpmBackEnd.
virtual bool AbstractPackageBackEnd::validPkgFileName | ( | const std::string & | fileName | ) | const [pure virtual] |
Use this method to check package file extension.
[in] | fileName | The file name to check |
Implemented in RpmBackEnd.
virtual bool AbstractPackageBackEnd::validSourcePkgFileName | ( | const std::string & | fileName | ) | const [pure virtual] |
Use this method to check source package file extension.
[in] | fileName | The file name to check |
Implemented in RpmBackEnd.
virtual int AbstractPackageBackEnd::versionCompare | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure 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 |
Implemented in RpmBackEnd.
virtual bool AbstractPackageBackEnd::versionEqual | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure virtual] |
This method checks two strings designate same version value.
[in] | ver1 | The first string to compare |
[in] | ver2 | The second string to compare |
Implemented in RpmBackEnd.
virtual bool AbstractPackageBackEnd::versionGreater | ( | const std::string & | ver1, |
const std::string & | ver2 | ||
) | const [pure 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 |
Implemented in RpmBackEnd.
virtual bool AbstractPackageBackEnd::versionOverlap | ( | const VersionCond & | ver1, |
const VersionCond & | ver2 | ||
) | const [pure 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 |
Implemented in RpmBackEnd.