#include <RpmDb.h>
Inheritance diagram for RpmDb:
Public Types | |
typedef InstTargetError | Error |
typedef std::set< std::string > | FileList |
enum | RpmInstFlag { RPMINST_NONE = 0x00, RPMINST_NODOCS = 0x01, RPMINST_NOSCRIPTS = 0x02, RPMINST_FORCE = 0x04, RPMINST_NODEPS = 0x08, RPMINST_IGNORESIZE = 0x10, RPMINST_JUSTDB = 0x20, RPMINST_NODIGEST = 0x40, RPMINST_NOSIGNATURE = 0x80 } |
enum | checkPackageResult { CHK_OK = 0x00, CHK_INCORRECT_VERSION = 0x01, CHK_INCORRECT_FILEMD5 = 0x02, CHK_GPGSIG_MISSING = 0x04, CHK_MD5SUM_MISSING = 0x08, CHK_INCORRECT_GPGSIG = 0x10, CHK_INCORRECT_PKGMD5 = 0x20, CHK_OTHER_FAILURE = 0x40 } |
Public Member Functions | |
RpmDb () | |
~RpmDb () | |
const Pathname & | root () const |
const Pathname & | dbPath () const |
bool | initialized () const |
PMError | initDatabase (Pathname root_r=Pathname(), Pathname dbPath_r=Pathname()) |
PMError | closeDatabase () |
PMError | rebuildDatabase () |
PMError | importPubkey (const Pathname &pubkey_r) |
PMError | importPubkey (const Pathname &keyring_r, const std::string &keyname_r) |
std::set< PkgEdition > | pubkeys () const |
bool | packagesValid () const |
const std::list< PMPackagePtr > & | getPackages () |
void | traceFileRel (const PkgRelation &rel_r) |
bool | hasFile (const std::string &file_r) const |
bool | hasProvides (const std::string &tag_r) const |
bool | hasRequiredBy (const std::string &tag_r) const |
bool | hasConflicts (const std::string &tag_r) const |
bool | hasPackage (const PkgName &name_r) const |
PMError | getData (const PkgName &name_r, constRpmHeaderPtr &result_r) const |
PMError | getData (const PkgName &name_r, const PkgEdition &ed_r, constRpmHeaderPtr &result_r) const |
unsigned | checkPackage (const Pathname &filename, std::string version="", std::string md5="") |
PMError | installPackage (const Pathname &filename, unsigned flags=0) |
PMError | removePackage (const std::string &name_r, unsigned flags=0) |
PMError | removePackage (constPMPackagePtr package, unsigned flags=0) |
Pathname | getBackupPath (void) |
bool | backupPackage (const std::string &packageName) |
bool | backupPackage (const Pathname &filename) |
void | setBackupPath (const Pathname &path) |
void | createPackageBackups (bool yes) |
bool | queryChangedFiles (FileList &fileList, const std::string &packageName) |
virtual std::ostream & | dumpOn (std::ostream &str) const |
Static Public Member Functions | |
std::string | checkPackageResult2string (unsigned code) |
bool | setInstallationLogfile (const Pathname &filename) |
Private Types | |
typedef std::vector< const char * > | RpmArgVec |
enum | DbStateInfoBits { DbSI_NO_INIT = 0x0000, DbSI_HAVE_V4 = 0x0001, DbSI_MADE_V4 = 0x0002, DbSI_MODIFIED_V4 = 0x0004, DbSI_HAVE_V3 = 0x0008, DbSI_HAVE_V3TOV4 = 0x0010, DbSI_MADE_V3TOV4 = 0x0020 } |
Private Member Functions | |
REP_BODY (RpmDb) | |
void | dbsi_set (DbStateInfoBits &val_r, const unsigned &bits_r) const |
void | dbsi_clr (DbStateInfoBits &val_r, const unsigned &bits_r) const |
bool | dbsi_has (const DbStateInfoBits &val_r, const unsigned &bits_r) const |
PMError | internal_initDatabase (const Pathname &root_r, const Pathname &dbPath_r, DbStateInfoBits &info_r) |
void | modifyDatabase () |
void | run_rpm (const RpmArgVec &options, ExternalProgram::Stderr_Disposition stderr_disp=ExternalProgram::Stderr_To_Stdout) |
bool | systemReadLine (std::string &line) |
int | systemStatus () |
void | systemKill () |
void | processConfigFiles (const std::string &line, const std::string &name, const char *typemsg, const char *difffailmsg, const char *diffgenmsg) |
Static Private Member Functions | |
void | removeV4 (const Pathname &dbdir_r, bool v3backup_r) |
void | removeV3 (const Pathname &dbdir_r, bool v3backup_r) |
Private Attributes | |
DbStateInfoBits | _dbStateInfo |
Pathname | _root |
Pathname | _dbPath |
Packages & | _packages |
FileDeps::FileNames | _filerequires |
ExternalProgram * | process |
int | exit_code |
Pathname | _backuppath |
bool | _packagebackups |
bool | _warndirexists |
Friends | |
std::ostream & | operator<< (std::ostream &str, const DbStateInfoBits &obj) |
|
Default error class |
|
|
|
|
|
Bits of possible package corruptions
|
|
|
|
Bits representing rpm installation options, useable as or combination
|
|
Constructor. There's no rpmdb access until initDatabase was called. |
|
Destructor. |
|
queries file for name and then calls above backupPackage function. For convenience.
|
|
create tar.gz of all changed files in a Package
|
|
Check rpm with rpm --checksig
|
|
create error description of bits set according to checkPackageResult |
|
Block further access to the rpm database and go back to uninitialized state. On update: Decides what to do with any converted database (see initDatabase). |
|
whether to create package backups during install or removal
|
|
|
|
|
|
|
|
|
|
Dump debug info. Reimplemented from CountedRep. |
|
get backup dir for rpm config files |
|
Get an installed packages data from rpmdb. Package is identified by name and edition. Data returned via result are NULL, if packge is not installed (PMError is not set), or RPM database could not be read (PMError is set). |
|
Get an installed packages data from rpmdb. Package is identified by name. Data returned via result are NULL, if packge is not installed (PMError is not set), or RPM database could not be read (PMError is set). |
|
If necessary build, and return the list of all installed packages. |
|
Return true if at least one package conflicts with a certain tag. |
|
Return true if at least one package owns a certain file. |
|
Return true if package is installed. |
|
Return true if at least one package provides a certain tag. |
|
Return true if at least one package requires a certain tag. |
|
Import ascii armored public key keyname_r exported by keyring_r. |
|
Import ascii armored public key in file pubkey_r. |
|
Prepare access to the rpm database. Optional arguments may denote the root directory for all operations and the directory (below root) that contains the rpmdb (usg. you won't need to set this). On empty Pathnames the default is used:
|
|
|
|
install rpm package
|
|
Internal helper for initDatabase. |
|
Called before the database is modified by installPackage/removePackage. Invalidates Packages list and moves away any old database. |
|
|
|
handle rpm messages like "/etc/testrc saved as /etc/testrc.rpmorig"
|
|
Return the editions of all installed public keys. |
|
determine which files of an installed package have been modified.
|
|
Rebuild the rpm database (rpm --rebuilddb). |
|
|
|
remove rpm package
|
|
Remove the rpm3 database in dbdir_r. Create a backup copy named packages.rpm3 if it does not already exist. |
|
Remove the rpm4 database in dbdir_r and optionally any backup created on conversion. |
|
|
|
|
|
Run rpm with the specified arguments and handle stderr.
|
|
set path where package backups are stored
|
|
Set logfile for progress log. Empty filename to disable logging. |
|
Forcably kill the system process |
|
Read a line from the general rpm query |
|
Return the exit status of the general rpm process, closing the connection if not already done. |
|
Hack to lookup required and conflicting file relations. |
|
|
|
/var/adm/backup |
|
Directory that contains the rpmdb. |
|
Internal state info |
|
|
|
create package backups? |
|
|
|
Root directory for all operations. |
|
whether / was already created |
|
The exit code of the rpm process, or -1 if not yet known. |
|
The connection to the rpm process. |