Deepsolver
Public Member Functions
RpmBackEnd Class Reference

The general interface to librpm functions. More...

Inheritance diagram for RpmBackEnd:
AbstractPackageBackEnd

List of all members.

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 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.

Detailed Description

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.

See also:
AbstractPackageBackEnd

Member Function Documentation

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.

Returns:
The iterator over set of installed packages

Implements 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 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.

Parameters:
[in]fileNameThe name of the file to read data from
[out]pkgFileThe object to save retrieved data in

Implements AbstractPackageBackEnd.

bool RpmBackEnd::validPkgFileName ( const std::string &  fileName) const [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

Implements AbstractPackageBackEnd.

bool RpmBackEnd::validSourcePkgFileName ( const std::string &  fileName) const [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

Implements 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.

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

Implements AbstractPackageBackEnd.

bool RpmBackEnd::versionEqual ( const std::string &  ver1,
const std::string &  ver2 
) const [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

Implements 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.

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

Implements 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.

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

Implements AbstractPackageBackEnd.