Deepsolver
Public Member Functions
AbstractPackageBackEnd Class Reference

The abstract package back-end interface. More...

Inheritance diagram for AbstractPackageBackEnd:
RpmBackEnd

List of all members.

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.

Detailed Description

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.

See also:
RpmBackEnd

Member Function Documentation

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.

Returns:
The iterator over set of installed packages

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.

Parameters:
[in]fileNameThe name of the file to read data from
[out]pkgFileThe 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.

Parameters:
[in]fileNameThe file name to check
Returns:
Non-zero if provided file name is a valid package name

Implemented in RpmBackEnd.

virtual bool AbstractPackageBackEnd::validSourcePkgFileName ( const std::string &  fileName) const [pure virtual]

Use this method to check source package file extension.

Parameters:
[in]fileNameThe file name to check
Returns:
Non-zero if provided file name is a valid source package name

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.

Parameters:
[in]ver1The first version value to compare
[in]ver2The second version value to compare
Returns:
The integer value less than zero in case of ver1 less than ver2, greater than zero if ver1 greater than ver2 and zero otherwise

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.

Parameters:
[in]ver1The first string to compare
[in]ver2The second string to compare
Returns:
Non-zero if two strings designates the same value or zero otherwise

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.

Parameters:
[in]ver1The first string to compare
[in]ver2The second string to compare
Returns:
Non-zero if ver1 is greater than ver2 or zero if ver1 is less or equal ver2

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.

Parameters:
[in]ver1The first version range to intersect
[in]ver2The second version range to intersect
Returns:
Non-zero if intersection is not empty

Implemented in RpmBackEnd.