Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

PackageManager Class Reference

The main class that interfaces with the database backend. More...

#include <packagemanager.h>

List of all members.

Public Member Functions

 PackageManager ()
 Constructor.
 PackageManager (Keyword acceptKeyword, PMString useFlags, std::vector< Virtual > virtuals)
 Constructor.
 ~PackageManager ()
 Destructor.
std::vector< PackageSearchPackageName (PMString name)
 Search for name. Can be category/name or just name.
std::vector< PackageSearchRegExpName (PMString expression)
 Search for category/name using regexp.
std::vector< PackageSearchNameContains (PMString lookup)
 Search for category/name that contains lookup.
std::vector< PackageSearchRegExpDescription (PMString expression)
 Search description for expression using regexp.
std::vector< PackageSearchDescriptionContains (PMString lookup)
 Search for description containing lookup.
PackageVersion SearchSpecificVersion (Package searchPackage, PMString version)
 Search for version of searchPackage.
PackageVersion GetLatestVersion (Package searchPackage, bool hardMasked=false, PMString slot="")
 Get latest version of searchPackage.
PackageVersion GetLatestAvailableVersion (Package searchPackage, PMString slot="")
 Get latest available version of searchPackage.
PackageVersion GetLatestVersionInstalled (Package passedPackage)
 Get latest version installed of passedPackage.
PackageVersion GetVirtual (PMString virtualString)
 Get PackageVersion that should be installed for virtualString.
std::vector< PackageVersionFullSearchPackage (PMString searchString)
 Search for PackageVersion using searchString ( cat/name-ver or name-ver ).
std::vector< PackageVersionGetVersions (Package searchPackage, bool hardMasked=false, PMString slot="")
 Get all versions of searchPackage.
std::vector< PackageVersionGetAvailableVersions (Package searchPackage, PMString slot="")
 Get available versions of searchPackage.
std::vector< PackageVersionGetVersionsInstalled (Package passedPackage)
 Get versions installed of passedPackage.
std::vector< PackageVersionCalculateNotInstalledDependencies (PackageVersion version)
 Calculate all dependencies not installed for version.
std::vector< PackageVersionCalculateAllDependencies (PackageVersion version)
 Calculate all dependencies for version.
bool SearchVersionExists (Package searchPackage, PMString version)
 Returns true if version of searchPackage exists.
bool IsVersionInstalled (PackageVersion passedVersion)
 Returns true if passedVersion is installed.
bool IsPackageInstalled (Package passedPackage)
 Returns true if passedPackage is installed.
bool IsPackageInWorld (Package passedPackage)
 Returns true if passedPackage is in world.
bool IsSlotInstalled (Package passedPackage, PMString slot)
 Returns true if slot of package is installed.
void CreateAllDatabases (bool clearCache=true, bool cacheFileSizes=false)
 Create the DB, also refill.
void CreatePackageDatabases (bool clearCache=true, bool cacheFileSizes=false)
 Create the DB's for packages - should be done after each sync.
void CreateInstalledDatabase ()
 Create the installed DB - should be done whenever emerge is used.
void SetPackageInstalled (PackageVersion version, bool upgrade=false, bool inWorld=true)
 Set version to be installed.
void SetPackageRemoved (PackageVersion version, bool upgrade=false)
 Set version to be removed.
void RegenWorldFile ()
 Regenerate the world file from the InstalledDb.
void AddToWorld (Package toAdd)
 Add package to the world file.
void RemoveFromWorld (Package toRemove)
 Remove package from the world file.
void SetKeyword (PMString keyword)
 Set keyword to keyword.
void SetKeyword (Keyword keyword)
 Set keyword to keyword.
void AddUseFlag (PMString flag)
 Add a use flag.
void SetUseFlags (PMString flags)
 Set the use flags.
void SetVirtuals (std::vector< Virtual > virtuals)
 Set the virtuals.
void AddVirtual (Virtual passedVirtual)
 Add a virtual.
void SetHardMaskedPackages (std::vector< PMString > hardMasked)
 Set the hardMasked package regexp.
void SetUnstablePackages (std::vector< PMString > unStable)
 Set the unstable package regexp.
void SetStablePackages (std::vector< PMString > stable)
 Set the stable package regexp.
void FetchPackages (PackageVersion version, redi::ipstream &streamToOutput)
 Fetch version.
void InstallPackage (PackageVersion version, redi::ipstream &streamToOutput, bool threaded=false, bool inWorld=true)
 Install version.
void RemovePackage (PackageVersion version, redi::ipstream &streamToOutput, bool threaded=false)
 Remove version.
Virtual GetVirtual (PackageVersion passedVersion)
 Returns the virtual that passedVersion provides.
std::vector< InstalledPackageGetWorldPackages ()
 Fetch all world packages.
std::vector< InstalledPackageGetAllInstalledPackages ()
 Fetch all installed packages.
std::vector< InstalledPackageFindRedundantPackages ()
 Returns all the redundant packages.
std::vector< InstalledPackageReverseDependencies (PackageVersion passedVersion)
 Returns the reverse dependencies of passedVersion.
std::vector< PackageUpgradeGetWorldUpdates ()
 Fetch all world updates.
std::vector< PackageUpgradeGetAllUpdates ()
 Fetch all the updates on the system.
std::vector< PMStringGetVirtualsProvided ()
 Get all virtuals provided by installed packages.
std::vector< PMStringFindRedundantSourceFiles ()
 Finds source files not needed by anything installed.

Protected Member Functions

void _FillDatabase (bool cacheFileSizes)
 Fill the PackageVersion and PackageName DB's.
void _FillInstalledDatabase ()
 Fill the installed DB.
bool _DependenciesArrange (std::vector< PackageVersion > &hayStack, PackageVersion dependency, PackageVersion mainPackage, DependencyStage stage)
 Adds dependency to hayStack based on the location of the dependent package, mainPackage.
bool _FindRegExpMatch (std::vector< PMString > hayStack, PMString needle)
 See if the needle matches any of the regular expressions in haystack.
PMString _GetSlotFromPortageDB (PackageVersion version)
 Return the slot from /var/db/pkg.
PackageVersion _VirtualInList (std::vector< PackageVersion > list, PMString virtualString)
 Returns the version that provides a virtual in the list.
PackageVersion _FulfillDependency (Dependency dependency)
 Returns a PackageVersion to fulfill dependency.

Protected Attributes

PackageDatabase _packageNameDatabase
 Package Name DB.
PackageVersionDatabase _packageVersionDatabase
 Package Version DB.
InstalledDatabase _installedPackagesDatabase
 Installed Packages DB.
Keyword _acceptKeyword
 The Arch Keyword.
PMString _useFlags
 Use flags.
std::vector< Virtual_virtuals
 Virtuals.
std::vector< PMString_hardMaskedPackages
 Hard masked packages regexps.
std::vector< PMString_unStablePackages
 Unstable packages regexps.
std::vector< PMString_stablePackages
 Stable packages regexps.


Detailed Description

The Package Management system. This is the daddy that glues all the classes together and is the main interface for users. This should be the only class needed to interface with all the DB's. If there is any functionality missing, let me know ASAP.


Constructor & Destructor Documentation

PackageManager::PackageManager  ) 
 

Constructor that sets the keyword to the default value, eX86Stable.

PackageManager::PackageManager Keyword  acceptKeyword,
PMString  useFlags,
std::vector< Virtual virtuals
 

Constructor to set up all internal variables in one go.

Parameters:
acceptKeyword The keyword to be accepted by the package manager.
useFlags The use flags to be accepted by the package manager.
virtuals The virtuals to be installed if it isn't provided.

PackageManager::~PackageManager  ) 
 

Destructor.


Member Function Documentation

bool PackageManager::_DependenciesArrange std::vector< PackageVersion > &  hayStack,
PackageVersion  dependency,
PackageVersion  mainPackage,
DependencyStage  stage
[protected]
 

Arrange the dependencies. Always makes sure that dependency is the correct side of mainPackage. Technically for runtime dependencies it doesnt matter when they are installed, but we try to make sure they go before the main package to stop the user killing the install after the package they wanted is installed and wondering why things are broken :-).

Parameters:
hayStack The list of PackageVersions to be installed, in order.
dependency The PackageVersion of the dependency
mainPackage The PackageVersion the dependency is of ( needed to order the list )
stage The stage of the dependency, so we know when to install this package
Returns:
true if this is a new dependency.

void PackageManager::_FillDatabase bool  cacheFileSizes  )  [protected]
 

Fills the 2 package and package version databases. We ensure that we only add each package to the package database once ( and only the latest version ) to stop the bug where slight description differences fooled us into creating 2 packages. This takes a bool that says whether we will load the digest files and cache the file sizes now or later. Usually makes the database creation too slow to be worthwhile.

Parameters:
cacheFileSizes Determines if the file sizes inside the packages digest should be cached into the database. Slows down Fills alot, defaults to false.
Exceptions:
DbException if received from the database.
PortageException(eErrorOpeningFile,filename) if a file could not be opened.
PortageException(eBadVersionCompare,thisVersion secondVersion) if a versions comparison didn't work.
PortageException(eEmptyVersionCompare) if an empty versions was found.
std::runtime_error from regex_match() if a regular expression error occured.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

void PackageManager::_FillInstalledDatabase  )  [protected]
 

Fills the installed packages database.

Exceptions:
DbException if received from the database.
PortageException(eErrorOpeningFile,filename) if a file could not be opened.
PortageException(eFileStreamError,filename) if an error occured with a stream.
PortageException(eBadVersionCompare,thisVersion secondVersion) if a versions comparison didn't work.
PortageException(eEmptyVersionCompare) if an empty versions was found.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

bool PackageManager::_FindRegExpMatch std::vector< PMString hayStack,
PMString  needle
[protected]
 

See if the needle matches any of the regular expressions in haystack.

Parameters:
hayStack A vector of regular expressions to check against needle.
needle A string to search.
Returns:
true if needle is found in haystack
Exceptions:
std::runtime_error from regex_match()

PackageVersion PackageManager::_FulfillDependency Dependency  dependency  )  [protected]
 

Returns a PackageVersion to fulfill the dependency. This function does take into account the Package masked status.

Parameters:
dependency The dependency to fulfill.
Returns:
The PackageVersion that fulfills the dependency.
Exceptions:
PortageException(eNoResults) if the dependency cannot be fulfilled.

PMString PackageManager::_GetSlotFromPortageDB PackageVersion  version  )  [protected]
 

Returns the SLOT from /var/db/pkg.

Parameters:
version The PackageVersion to get the slot for.
Returns:
The slot for version.
Exceptions:
PortageException(eFileStreamError,slotFilename) if a file couldn't be opened

PackageVersion PackageManager::_VirtualInList std::vector< PackageVersion list,
PMString  virtualString
[protected]
 

Returns the version that provides a certain virtual in the given vector.

Parameters:
list The vector of PackageVersions to search.
virtualString The string representation of the virtual.
Returns:
The PackageVersion that provides the virtualString.
Exceptions:
PortageException(eNoResults) if the virtual is not provided in the list.

void PackageManager::AddToWorld Package  toAdd  ) 
 

Add the Package to the world file.

Parameters:
toAdd The Package to add to the world file.
Exceptions:
PortageException(eFileStreamError,"/var/lib/portage/world") if stream error occured.
PortageException(eErrorOpeningFile,"/var/lib/portage/world") if file could not be opened.

void PackageManager::AddUseFlag PMString  flag  ) 
 

Add a useflag.

Parameters:
flag The use flag to add.

void PackageManager::AddVirtual Virtual  passedVirtual  ) 
 

Pushes the passedVirtual to the internal list of virtuals within the PackageManager class.

Parameters:
passedVirtual The virtual to be added.

std::vector< PackageVersion > PackageManager::CalculateAllDependencies PackageVersion  version  ) 
 

Returns all the dependencies needed by version.

Parameters:
version The PackageVersion whose dependencies need calculating.
Returns:
A vector of PackageVersions to be installed to meet the dependencies for version. This vector is in order so that the packages need to be installed from start to finish. Also includes version.
Exceptions:
DbException if received from the database.
PortageException(eBadFormatOrDependency) if after a || there is no ( in the dependencies.
DependencyException(Dependency,PackageVersion) if the dependency can not be met.
PortageException(eVirtualUnavailable,virtualString) if virtual can not be met.

std::vector< PackageVersion > PackageManager::CalculateNotInstalledDependencies PackageVersion  version  ) 
 

Calculates all dependencies of version that aren't installed. Does not check the integrity of installed packages

Parameters:
version The PackageVersion whose dependencies need calculating.
Returns:
A vector of PackageVersions to be installed to meet the dependencies for version. This vector is in order so that the packages need to be installed from start to finish. Also includes version if its not installed.
Exceptions:
DbException if received from the database.
PortageException(eBadFormatOrDependency) if after a || there is no ( in the dependencies.
DependencyException(Dependency,PackageVersion) if the dependency can not be met.
PortageException(eVirtualUnavailable,virtualString) if virtual can not be met.

void PackageManager::CreateAllDatabases bool  clearCache = true,
bool  cacheFileSizes = false
 

Create the database from scratch.

Parameters:
clearCache Should we clear the Package and PackageVersion databases? Useful not to clear sometimes when the information about installed packages is being deleted by a sync.
cacheFileSizes Should we cache the filesizes in the PackageVersion database or calculate them at runtime? Slows the Fill DB down by a large amount, and doesnt noticeably speed up the program.
Exceptions:
DbException if received from the database.
PortageException(eErrorOpeningFile,filename) if a file could not be opened.
PortageException(eBadVersionCompare,thisVersion secondVersion) if a versions comparison didn't work.
PortageException(eEmptyVersionCompare) if an empty versions was found.
std::runtime_error from regex_match() if a regular expression error occured.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.
PortageException(eFileStreamError,filename) if an error occured with a stream.

void PackageManager::CreateInstalledDatabase  ) 
 

Create just the installed db.

Exceptions:
DbException if received from the database.
PortageException(eErrorOpeningFile,filename) if a file could not be opened.
PortageException(eFileStreamError,filename) if an error occured with a stream.
PortageException(eBadVersionCompare,thisVersion secondVersion) if a versions comparison didn't work.
PortageException(eEmptyVersionCompare) if an empty versions was found.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

void PackageManager::CreatePackageDatabases bool  clearCache = true,
bool  cacheFileSizes = false
 

Create the two package databases

Parameters:
clearCache Should we clear the Package and PackageVersion databases? Useful not to clear sometimes when the information about installed packages is being deleted by a sync.
cacheFileSizes Should we cache the filesizes in the PackageVersion database or calculate them at runtime? Slows the Fill DB down by a large amount, and doesnt noticeably speed up the program.
Exceptions:
DbException if received from the database.
PortageException(eErrorOpeningFile,filename) if a file could not be opened.
PortageException(eBadVersionCompare,thisVersion secondVersion) if a versions comparison didn't work.
PortageException(eEmptyVersionCompare) if an empty versions was found.
std::runtime_error from regex_match() if a regular expression error occured.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

void PackageManager::FetchPackages PackageVersion  version,
redi::ipstream &  streamToOutput
 

Fetch version.

Parameters:
version The PackageVersion to fetch files for. Doesnt fetch dependencies of the PackageVersion.
streamToOutput The stream to send the output to.

std::vector< InstalledPackage > PackageManager::FindRedundantPackages  ) 
 

Finds and returns a vector of PackageVersions that arent in the world file and arent depended on by anything in the world file.

Returns:
A vector of InstalledPackages that can be removed.
Exceptions:
PortageException(eNoVirtualFound,virtualString) if virtualString does not exist.
PortageException(eNoResults,category/name) if cannot find latest available version of the package.
DbException if received from the database.
PortageException(eVirtualUnavailable,virtualString) if virtual can not be met.

std::vector< PMString > PackageManager::FindRedundantSourceFiles  ) 
 

Returns a list of filenames that are no longer required by any installed packages. It is wise to do this with a fully up to date system ( with respect to the local portage tree ). Otherwise the PackageManager makes mistakes as during syncs ebuilds for installed packages are sometimes deleted and so we can get false posisitves.

Returns:
A vector of filenames for redundant sources in /usr/src/distfiles/
Exceptions:
DbException if received from the database.
DirectoryException(scanf_error,directoryName) if scanf returns with an error.

std::vector< PackageVersion > PackageManager::FullSearchPackage PMString  searchString  ) 
 

Search for the package versions described by name-version and cat/name-version.

Parameters:
searchString The string to search for in the form "name-version" or "cat/name-version".
Returns:
A vector of PackageVersions that match the searchString.
Exceptions:
DbException if received from the database.

std::vector< InstalledPackage > PackageManager::GetAllInstalledPackages  ) 
 

Returns all the installed packages.

Returns:
A vector of all InstalledPackages.
Exceptions:
DbException if received from the database.
PortageException(eNoResults) if cannot find version details in PackageDatabase

std::vector< PackageUpgrade > PackageManager::GetAllUpdates  ) 
 

Returns all available updates to installedPackages.

Returns:
A vector of PackageUpgrades that can be applied to all InstalledPackages.
Exceptions:
DbException if received from the database.
PortageException(eNoResults) if cannot find an available version. Must have used emerge with ~arch or something.
PortageException(eFileStreamError,slotFilename) if cannot find the slot in portage's installed db.

std::vector< PackageVersion > PackageManager::GetAvailableVersions Package  searchPackage,
PMString  slot = ""
 

Returns the versions that comply with _acceptKeyword.

Parameters:
searchPackage The Package to search for.
slot The slot to get versions from ( defaults to all )
Returns:
A vector of PackageVersions that are available for install.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if there are no results.

PackageVersion PackageManager::GetLatestAvailableVersion Package  searchPackage,
PMString  slot = ""
 

Returns the latest version that complies with _acceptKeyword.

Parameters:
searchPackage The package to search for.
slot The slot to get versions from ( defaults to all )
Returns:
The PackageVersion corresponding to the latest available version.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if there are no results.

PackageVersion PackageManager::GetLatestVersion Package  searchPackage,
bool  hardMasked = false,
PMString  slot = ""
 

Return the latest version of a package.

Parameters:
searchPackage The Package to search for.
hardMasked Should we accept hardmasked PackageVersions or not?
slot The slot to get versions from ( defaults to all )
Returns:
The PackageVersion corresponding to the latest version.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if there are no results.

PackageVersion PackageManager::GetLatestVersionInstalled Package  passedPackage  ) 
 

Returns the latest version of a package that is installed.

Parameters:
passedPackage The Package to search for.
Returns:
The PackageVersion corresponding to the latest version installed.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if version is not installed.
PortageException(eFileStreamError,slotFilename) if cannot find the slot in portage's installed db.

std::vector< PackageVersion > PackageManager::GetVersions Package  searchPackage,
bool  hardMasked = false,
PMString  slot = ""
 

Return all the versions of a package.

Parameters:
searchPackage The Package to search for.
hardMasked Should we return hardmasked Packages also?
slot The slot to get versions from ( defaults to all )
Returns:
A vector of PackageVersions of searchPackage.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if there are no results.

std::vector< PackageVersion > PackageManager::GetVersionsInstalled Package  passedPackage  ) 
 

Get all versions of passedPackage installed.

Parameters:
passedPackage The package to search for.
Returns:
A vector of all PackageVersions of searchPackage installed.
Exceptions:
DbException if received from the database.

Virtual PackageManager::GetVirtual PackageVersion  passedVersion  ) 
 

Returns the Virtual associated with passedVersion.

Exceptions:
PortageException with the code eNoResults. Message is the cat/name of passedVersion.
Parameters:
passedVersion The PackageVersion to check if its a virtual.
Returns:
The Virtual provided by passedVersion.
Exceptions:
PortageException(eNoResults,category/name) if the virtual is not found.

PackageVersion PackageManager::GetVirtual PMString  virtualString  ) 
 

Returns the PackageVersion refered to by virtualString.

Parameters:
virtualString The string form of the virtual that needs satisfying.
Returns:
The PackageVersion that corresponds to the virtual.
Exceptions:
DbException if received from the database.
PortageException(eNoVirtualFound,virtualString) if virtualString does not exist.
PortageException(eNoResults,category/name) if cannot find versions of the package.
PortageException(eNoResults) if cant find package details.
PortageException(eVirtualUnavailable,virtualString) if virtual can not be met.

std::vector< PMString > PackageManager::GetVirtualsProvided  ) 
 

Returns all the virtuals provided by installed packages.

Returns:
A vector of strings of the form virtual/package that are provided by InstalledPackages.
Exceptions:
DbException if received from the database.

std::vector< InstalledPackage > PackageManager::GetWorldPackages  ) 
 

Returns all the world packages.

Returns:
A vector of all InstalledPackages in the world file.
Exceptions:
DbException if received from the database.

std::vector< PackageUpgrade > PackageManager::GetWorldUpdates  ) 
 

Returns all the PackageUpgrade's available for world Packages.

Returns:
A vector of PackageUpgrades that can be applied to the world Packages.
Exceptions:
DbException if received from the database.
PortageException(eNoResults) if cannot find an available version. Must have used emerge with ~arch or something.
PortageException(eFileStreamError,slotFilename) if cannot find the slot in portage's installed db.

void PackageManager::InstallPackage PackageVersion  version,
redi::ipstream &  streamToOutput,
bool  threaded = false,
bool  inWorld = true
 

Install version.

Parameters:
version The PackageVersion to install. Does not deal with Dependencies.
streamToOutput The stream to send the output to.
inWorld Is the PackageVersion going to be in the world file - only used if threaded is true.
threaded Is the program threaded? If it is, we keep an eye on the output from ebuild to see if its succesful, and mark the package as installed accordingly. Else, you are responsible for marking the package as installed.

bool PackageManager::IsPackageInstalled Package  passedPackage  ) 
 

Returns true if passedPackage is installed.

Parameters:
passedPackage The Package to be searched for.
Returns:
true if passedPackage is installed.
Exceptions:
DbException if received from the database.

bool PackageManager::IsPackageInWorld Package  passedPackage  ) 
 

Returns true if passedPackage is in world.

Parameters:
passedPackage The Package to be searched for.
Returns:
true if passedPackage is in world.
Exceptions:
DbException if received from the database.

bool PackageManager::IsSlotInstalled Package  passedPackage,
PMString  slot
 

Returns true if the slot of the package is installed.

Parameters:
passedPackage The Package to be searched for.
slot The slot to be searched for.
Returns:
true if passedPackage is in world.
Exceptions:
DbException if received from the database.

bool PackageManager::IsVersionInstalled PackageVersion  passedVersion  ) 
 

Returns true is passedVersion is installed.

Parameters:
passedVersion The PackageVersion to be searched for.
Returns:
true if passedVersion is installed.
Exceptions:
DbException if received from the database.

void PackageManager::RegenWorldFile  ) 
 

Regenerate the world file from the InstalledDb.

Exceptions:
DbException if received from the database.
PortageException(eFileStreamError,"/var/lib/portage/world") if stream error occured.
PortageException(eErrorOpeningFile,"/var/lib/portage/world") if file could not be opened.

void PackageManager::RemoveFromWorld Package  toRemove  ) 
 

Remove the Package from the world file.

Parameters:
toRemove The Package to remove from the world file.
Exceptions:
PortageException(eFileStreamError,"/var/lib/portage/world") if stream error occured.
PortageException(eErrorOpeningFile,"/var/lib/portage/world") if file could not be opened.

void PackageManager::RemovePackage PackageVersion  version,
redi::ipstream &  streamToOutput,
bool  threaded = false
 

Remove version. Lets ebuild check if the version is installed.

Parameters:
version The PackageVersion to remove. Does not deal with Dependencies.
streamToOutput The stream to send the output to.
threaded Is the program threaded? If it is, we keep an eye on the output from ebuild to see if its succesful, and mark the package as removed accordingly. Else, you are responsible for marking the package as removed.

std::vector< InstalledPackage > PackageManager::ReverseDependencies PackageVersion  passedVersion  ) 
 

Finds and returns a vector of PackageVersions that depend on passedVersion.

Parameters:
passedVersion The PackageVersion to do reverse dependencies on.
Returns:
A vector of InstalledPackages that depend on passedVersion.
Exceptions:
DbException if received from the database.
PortageException(eVirtualUnavailable,virtualString) if a virtual can not be met.

std::vector< Package > PackageManager::SearchDescriptionContains PMString  lookup  ) 
 

Return the packages whose description contain the string provided.

Parameters:
lookup A string to search the package descriptions for, to see if it contains it.
Returns:
A vector of matching Packages.
Exceptions:
DbException if received from the database.

std::vector< Package > PackageManager::SearchNameContains PMString  lookup  ) 
 

Return the packages whose names contain the string provided.

Parameters:
lookup A string to search the package names for, to see if it contains it.
Returns:
A vector of matching Packages.
Exceptions:
DbException if received from the database.

std::vector< Package > PackageManager::SearchPackageName PMString  name  ) 
 

Search for the packages described by the name. Also capable of cat/name.

Parameters:
name A string of the form "name" or "cat/name" to search for.
Returns:
A vector of matching Packages.
Exceptions:
DbException if received from the database.

std::vector< Package > PackageManager::SearchRegExpDescription PMString  expression  ) 
 

Return the packages whose description complies with the regular expression provided

Parameters:
expression A regular expression to search the package descriptions for.
Returns:
A vector of matching Packages.
Exceptions:
DbException if received from the database.

std::vector< Package > PackageManager::SearchRegExpName PMString  expression  ) 
 

Get the packages whose name complies with the regular expression provided.

Parameters:
expression A regular expression to search the package names for.
Returns:
A vector of matching Packages.
Exceptions:
DbException if received from the database.

PackageVersion PackageManager::SearchSpecificVersion Package  searchPackage,
PMString  version
 

Search for a specific version referenced by the string and return it.

Parameters:
searchPackage The package to search for.
version A string that contains a version number.
Returns:
The PackageVersion refered to by the version.
Exceptions:
DbException if received from the database.
PortageException(eNoResults,category/name) if the version does not exist.

bool PackageManager::SearchVersionExists Package  searchPackage,
PMString  version
 

Checks the version referenced by the string exists.

Parameters:
searchPackage The package to be searched for.
version A string representing a version number.
Returns:
true if the version is installed.
Exceptions:
DbException if received from the database.

void PackageManager::SetHardMaskedPackages std::vector< PMString hardMasked  ) 
 

Set the hardmasked packages regexp.

Parameters:
hardMasked The regular expressions for Packages to be hardMasked.

void PackageManager::SetKeyword Keyword  keyword  ) 
 

Utility function to set the keyword if needed.

Parameters:
keyword The keyword to accept.

void PackageManager::SetKeyword PMString  keyword  ) 
 

Set the keyword.

Parameters:
keyword The string according to the gentoo portage standard. E.g arch, means just stable packages on the arch and ~arch means it will accept unstable packages.

void PackageManager::SetPackageInstalled PackageVersion  version,
bool  upgrade = false,
bool  inWorld = true
 

Set version to be installed.

Parameters:
version The PackageVersion to be set installed.
upgrade Is this part of an upgrade? If so we won't touch the world file.
inWorld Is version going to be in the world file? Ammends the external world file accordingly.
Exceptions:
DbException if received from the database.
PortageException(eFileStreamError,"/var/lib/portage/world") if stream error occured.
PortageException(eErrorOpeningFile,"/var/lib/portage/world") if file could not be opened.

void PackageManager::SetPackageRemoved PackageVersion  version,
bool  upgrade = false
 

Set version to be removed.

Parameters:
version The version to be set as removed. Will remove from world file also.
upgrade Is this part of an upgrade? If so we won't touch the world file.
Exceptions:
DbException if received from the database.
PortageException(eFileStreamError,"/var/lib/portage/world") if stream error occured.
PortageException(eErrorOpeningFile,"/var/lib/portage/world") if file could not be opened.

void PackageManager::SetStablePackages std::vector< PMString stable  ) 
 

Set the stable packages regexp.

Parameters:
stable The regular expressions for Packages to be stable.

void PackageManager::SetUnstablePackages std::vector< PMString unStable  ) 
 

Set the unstable packages regexp.

Parameters:
unStable The regular expressions for Packages to be unStable.

void PackageManager::SetUseFlags PMString  flags  ) 
 

Set the use flags.

Parameters:
flags The use flags to set the internal flags to.

void PackageManager::SetVirtuals std::vector< Virtual virtuals  ) 
 

Set the virtuals.

Parameters:
virtuals The virtuals to set the internal virtuals to.


The documentation for this class was generated from the following files:
Generated on Wed May 25 15:29:54 2005 for Package Management System for Gentoo Linux by  doxygen 1.4.1