#include <RpmDb.h>
Inheritance diagram for zypp::target::rpm::RpmDb:

Public Types | |
| typedef InstTargetError | Error |
| Default error class. | |
| typedef std::set< std::string > | FileList |
| enum | RpmInstFlag { RPMINST_NONE = 0x0000, RPMINST_NODOCS = 0x0001, RPMINST_NOSCRIPTS = 0x0002, RPMINST_FORCE = 0x0004, RPMINST_NODEPS = 0x0008, RPMINST_IGNORESIZE = 0x0010, RPMINST_JUSTDB = 0x0020, RPMINST_NODIGEST = 0x0040, RPMINST_NOSIGNATURE = 0x0080, RPMINST_NOUPGRADE = 0x0100, RPMINST_TEST = 0x0200 } |
| Bits representing rpm installation options, useable as or combination. More... | |
| enum | checkPackageResult { CHK_OK = 0, CHK_NOTFOUND = 1, CHK_FAIL = 2, CHK_NOTTRUSTED = 3, CHK_NOKEY = 4, CHK_ERROR = 5 } |
| checkPackage result More... | |
Public Member Functions | |
| RpmDb () | |
| Constructor. | |
| ~RpmDb () | |
| Destructor. | |
| Date | timestamp () const |
| timestamp of the rpm database (last modification) | |
| const Pathname & | root () const |
| const Pathname & | dbPath () const |
| bool | initialized () const |
| void | initDatabase (Pathname root_r=Pathname(), Pathname dbPath_r=Pathname()) |
| Prepare access to the rpm database. | |
| void | closeDatabase () |
| Block further access to the rpm database and go back to uninitialized state. | |
| void | rebuildDatabase () |
| Rebuild the rpm database (rpm --rebuilddb). | |
| void | importPubkey (const Pathname &pubkey_r) |
| Import ascii armored public key in file pubkey_r. | |
| std::list< PublicKey > | pubkeys () const |
| Return the long ids of all installed public keys. | |
| std::set< Edition > | pubkeyEditions () const |
| Return the edition of all installed public keys. | |
| bool | packagesValid () const |
| const std::list< Package::Ptr > & | getPackages () |
| If necessary build, and return the list of all installed packages. | |
| std::list< FileInfo > | fileList (const std::string &name_r, const Edition &edition_r) const |
| return complete file list for installed package name_r (in FileInfo.filename) if edition_r != Edition::noedition, check for exact edition if full==true, fill all attributes of FileInfo | |
| bool | hasFile (const std::string &file_r, const std::string &name_r="") const |
| Return true if at least one package owns a certain file (name_r empty) Return true if package name_r owns file file_r (name_r nonempty). | |
| std::string | whoOwnsFile (const std::string &file_r) const |
| Return name of package owning file or empty string if no installed package owns file. | |
| bool | hasProvides (const std::string &tag_r) const |
| Return true if at least one package provides a certain tag. | |
| bool | hasRequiredBy (const std::string &tag_r) const |
| Return true if at least one package requires a certain tag. | |
| bool | hasConflicts (const std::string &tag_r) const |
| Return true if at least one package conflicts with a certain tag. | |
| bool | hasPackage (const std::string &name_r) const |
| Return true if package is installed. | |
| bool | hasPackage (const std::string &name_r, const Edition &ed_r) const |
| Return true if package is installed in a certain edition. | |
| void | getData (const std::string &name_r, RpmHeader::constPtr &result_r) const |
| Get an installed packages data from rpmdb. | |
| void | getData (const std::string &name_r, const Edition &ed_r, RpmHeader::constPtr &result_r) const |
| Get an installed packages data from rpmdb. | |
| void | importZyppKeyRingTrustedKeys () |
| iterates through zypp keyring and import all non existant keys into rpm keyring | |
| void | exportTrustedKeysInZyppKeyRing () |
| insert all rpm trusted keys into zypp trusted keyring | |
| checkPackageResult | checkPackage (const Pathname &path_r) |
| Check signature of rpm file on disk. | |
| void | installPackage (const Pathname &filename, unsigned flags=0) |
| install rpm package | |
| void | removePackage (const std::string &name_r, unsigned flags=0) |
| remove rpm package | |
| void | removePackage (Package::constPtr package, unsigned flags=0) |
| Pathname | getBackupPath (void) |
| get backup dir for rpm config files | |
| bool | backupPackage (const std::string &packageName) |
| create tar.gz of all changed files in a Package | |
| bool | backupPackage (const Pathname &filename) |
| queries file for name and then calls above backupPackage function. | |
| void | setBackupPath (const Pathname &path) |
| set path where package backups are stored | |
| void | createPackageBackups (bool yes) |
| whether to create package backups during install or removal | |
| bool | queryChangedFiles (FileList &fileList, const std::string &packageName) |
| determine which files of an installed package have been modified. | |
| virtual std::ostream & | dumpOn (std::ostream &str) const |
| Dump debug info. | |
Static Public Member Functions | |
| static Package::Ptr | makePackageFromHeader (const RpmHeader::constPtr header, std::set< std::string > *filerequires, const Pathname &location, Source_Ref source) |
| Create a package from RpmHeader return NULL on error. | |
Protected Member Functions | |
| void | doRemovePackage (const std::string &name_r, unsigned flags, callback::SendReport< RpmRemoveReport > &report) |
| void | doInstallPackage (const Pathname &filename, unsigned flags, callback::SendReport< RpmInstallReport > &report) |
| const std::list< Package::Ptr > & | doGetPackages (callback::SendReport< ScanDBReport > &report) |
| void | doRebuildDatabase (callback::SendReport< RebuildDBReport > &report) |
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 | |
| 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 |
| void | internal_initDatabase (const Pathname &root_r, const Pathname &dbPath_r, DbStateInfoBits &info_r) |
| Internal helper for initDatabase. | |
| void | modifyDatabase () |
| Called before the database is modified by installPackage/removePackage. | |
| void | run_rpm (const RpmArgVec &options, ExternalProgram::Stderr_Disposition stderr_disp=ExternalProgram::Stderr_To_Stdout) |
| Run rpm with the specified arguments and handle stderr. | |
| bool | systemReadLine (std::string &line) |
| Read a line from the general rpm query. | |
| int | systemStatus () |
| Return the exit status of the general rpm process, closing the connection if not already done. | |
| void | systemKill () |
| Forcably kill the system process. | |
| void | processConfigFiles (const std::string &line, const std::string &name, const char *typemsg, const char *difffailmsg, const char *diffgenmsg) |
| handle rpm messages like "/etc/testrc saved as /etc/testrc.rpmorig" | |
Static Private Member Functions | |
| static void | removeV4 (const Pathname &dbdir_r, bool v3backup_r) |
| Remove the rpm4 database in dbdir_r and optionally any backup created on conversion. | |
| static void | removeV3 (const Pathname &dbdir_r, bool v3backup_r) |
| Remove the rpm3 database in dbdir_r. | |
Private Attributes | |
| DbStateInfoBits | _dbStateInfo |
| Internal state info. | |
| Pathname | _root |
| Root directory for all operations. | |
| Pathname | _dbPath |
| Directory that contains the rpmdb. | |
| Packages & | _packages |
| std::set< std::string > | _filerequires |
| ExternalProgram * | process |
| The connection to the rpm process. | |
| int | exit_code |
| The exit code of the rpm process, or -1 if not yet known. | |
| Pathname | _backuppath |
| /var/adm/backup | |
| bool | _packagebackups |
| create package backups? | |
| bool | _warndirexists |
| whether <_root>/<WARNINGMAILPATH> was already created | |
Friends | |
| std::ostream & | operator<< (std::ostream &str, const DbStateInfoBits &obj) |
Classes | |
| class | Packages |
| Helper class for RpmDb::getPackages() to build the list<Package::Ptr> returned. More... | |
Definition at line 47 of file RpmDb.h.
|
|
Default error class.
|
|
|
|
|
|
|
|
|
|
|
|
Bits representing rpm installation options, useable as or combination.
|
|
|
checkPackage result
|
|
|
Constructor. There's no rpmdb access until initDatabase was called. Definition at line 270 of file RpmDb.cc. References exit_code, process, and zypp::target::rpm::sKeyRingReceiver. |
|
|
Destructor.
Definition at line 293 of file RpmDb.cc. References _packages, closeDatabase(), MIL, process, and zypp::target::rpm::sKeyRingReceiver. |
|
||||||||||||
|
Definition at line 75 of file RpmDb.h. Referenced by modifyDatabase(). |
|
||||||||||||
|
Definition at line 79 of file RpmDb.h. Referenced by initDatabase(), and modifyDatabase(). |
|
||||||||||||
|
Definition at line 83 of file RpmDb.h. Referenced by closeDatabase(), initDatabase(), and modifyDatabase(). |
|
||||||||||||||||
|
Internal helper for initDatabase.
Definition at line 469 of file RpmDb.cc. References DbSI_NO_INIT, zypp::target::rpm::librpmDb::DbDirInfo::illegalArgs(), and ZYPP_THROW. Referenced by initDatabase(). |
|
||||||||||||
|
Remove the rpm4 database in dbdir_r and optionally any backup created on conversion.
Definition at line 599 of file RpmDb.cc. References ERR, and zypp::filesystem::PathInfo::isDir(). Referenced by closeDatabase(), and initDatabase(). |
|
||||||||||||
|
Remove the rpm3 database in dbdir_r. Create a backup copy named packages.rpm3 if it does not already exist. Definition at line 665 of file RpmDb.cc. References ERR, and zypp::filesystem::PathInfo::isDir(). Referenced by closeDatabase(), initDatabase(), and modifyDatabase(). |
|
|
Called before the database is modified by installPackage/removePackage. Invalidates Packages list and moves away any old database. Definition at line 731 of file RpmDb.cc. References _dbPath, _dbStateInfo, _packages, _root, zypp::target::rpm::RpmDb::Packages::_valid, dbsi_clr(), dbsi_has(), DbSI_HAVE_V3, DbSI_MADE_V3TOV4, DbSI_MODIFIED_V4, dbsi_set(), initialized(), MIL, and removeV3(). Referenced by doInstallPackage(). |
|
|
timestamp of the rpm database (last modification)
Definition at line 304 of file RpmDb.cc. References dbPath(), zypp::filesystem::PathInfo::isExist(), zypp::filesystem::PathInfo::mtime(), zypp::Date::now(), and root(). Referenced by zypp::target::TargetImpl::timestamp(). |
|
|
Definition at line 151 of file RpmDb.h. References _root. Referenced by doRebuildDatabase(), rebuildDatabase(), and timestamp(). |
|
|
Definition at line 159 of file RpmDb.h. References _dbPath. Referenced by doRebuildDatabase(), rebuildDatabase(), and timestamp(). |
|
|
Definition at line 167 of file RpmDb.h. References _root, and zypp::filesystem::Pathname::empty(). Referenced by closeDatabase(), initDatabase(), modifyDatabase(), packagesValid(), and run_rpm(). |
|
||||||||||||
|
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:
root: /
dbPath: /var/lib/rpm
Calling initDatabase a second time with different arguments will return an error but leave the database in it's original state. Converting an old batabase is done if necessary. On update: The converted database will be removed by closeDatabase, if it was not modified (no packages were installed or deleted). Otherwise the new database is kept, and the old one is removed.
Definition at line 358 of file RpmDb.cc. References _dbPath, _dbStateInfo, _root, zypp::filesystem::Pathname::absolute(), zypp::target::rpm::librpmDb::blockAccess(), zypp::target::rpm::librpmDb::dbRelease(), dbsi_clr(), dbsi_has(), DbSI_HAVE_V3, DbSI_HAVE_V4, DbSI_MADE_V3TOV4, DbSI_MADE_V4, DbSI_MODIFIED_V4, DbSI_NO_INIT, zypp::filesystem::Pathname::empty(), ERR, exportTrustedKeysInZyppKeyRing(), importZyppKeyRingTrustedKeys(), initialized(), internal_initDatabase(), MIL, rebuildDatabase(), removeV3(), removeV4(), zypp::target::rpm::stringPath(), zypp::target::rpm::librpmDb::unblockAccess(), ZYPP_CAUGHT, ZYPP_RETHROW, and ZYPP_THROW. Referenced by zypp::target::TargetImpl::TargetImpl(). |
|
|
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).
Definition at line 757 of file RpmDb.cc. References _dbPath, _dbStateInfo, _packages, _root, zypp::target::rpm::librpmDb::blockAccess(), zypp::target::rpm::RpmDb::Packages::clear(), dbsi_has(), DbSI_HAVE_V3, DbSI_MADE_V3TOV4, DbSI_MODIFIED_V4, DbSI_NO_INIT, initialized(), MIL, removeV3(), and removeV4(). Referenced by ~RpmDb(), and zypp::target::TargetImpl::~TargetImpl(). |
|
|
Rebuild the rpm database (rpm --rebuilddb).
Definition at line 805 of file RpmDb.cc. References zypp::Exception::asUserString(), dbPath(), doRebuildDatabase(), zypp::target::rpm::RebuildDBReport::FAILED, zypp::target::rpm::RebuildDBReport::NO_ERROR, report, root(), and ZYPP_RETHROW. Referenced by initDatabase(). |
|
|
Import ascii armored public key in file pubkey_r.
Definition at line 977 of file RpmDb.cc. References _packages, zypp::target::rpm::RpmDb::Packages::_valid, zypp::filesystem::Pathname::asString(), DBG, FAILIFNOTINITIALIZED, run_rpm(), zypp::ExternalProgram::Stderr_To_Stdout, systemReadLine(), and WAR. |
|
|
Return the long ids of all installed public keys.
Definition at line 1023 of file RpmDb.cc. References zypp::filesystem::Pathname::asString(), ERR, zypp::target::rpm::librpmDb::db_const_iterator::findByName(), getData(), zypp::Edition::noedition, and zypp::filesystem::TmpPath::path(). Referenced by importZyppKeyRingTrustedKeys(). |
|
|
Return the edition of all installed public keys.
Definition at line 1061 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByName(), and zypp::Edition::noedition. Referenced by exportTrustedKeysInZyppKeyRing(). |
|
|
Definition at line 1081 of file RpmDb.cc. References _packages, zypp::target::rpm::RpmDb::Packages::_valid, and initialized(). Referenced by doGetPackages(). |
|
|
If necessary build, and return the list of all installed packages.
Definition at line 1094 of file RpmDb.cc. References zypp::Exception::asUserString(), doGetPackages(), zypp::target::rpm::ScanDBReport::FAILED, zypp::target::rpm::ScanDBReport::NO_ERROR, report, and ZYPP_RETHROW. Referenced by zypp::target::TargetImpl::loadKindResolvables(). |
|
||||||||||||
|
return complete file list for installed package name_r (in FileInfo.filename) if edition_r != Edition::noedition, check for exact edition if full==true, fill all attributes of FileInfo
Definition at line 1306 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findPackage(), and zypp::Edition::noedition. |
|
||||||||||||
|
Return true if at least one package owns a certain file (name_r empty) Return true if package name_r owns file file_r (name_r nonempty).
Definition at line 1335 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByFile(). Referenced by zypp::target::TargetImpl::providesFile(). |
|
|
Return name of package owning file or empty string if no installed package owns file.
Definition at line 1361 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByFile(). Referenced by zypp::target::TargetImpl::whoOwnsFile(). |
|
|
Return true if at least one package provides a certain tag.
Definition at line 1379 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByProvides(). |
|
|
Return true if at least one package requires a certain tag.
Definition at line 1393 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByRequiredBy(). |
|
|
Return true if at least one package conflicts with a certain tag.
Definition at line 1407 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::findByConflicts(). |
|
|
Return true if package is installed.
|
|
||||||||||||
|
Return true if package is installed in a certain edition.
|
|
||||||||||||
|
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).
Referenced by pubkeys(). |
|
||||||||||||||||
|
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).
Definition at line 1467 of file RpmDb.cc. References zypp::target::rpm::librpmDb::db_const_iterator::dbError(), zypp::target::rpm::librpmDb::db_const_iterator::findPackage(), and ZYPP_THROW. |
|
||||||||||||||||||||
|
Create a package from RpmHeader return NULL on error.
Definition at line 1121 of file RpmDb.cc. References WAR. Referenced by doGetPackages(). |
|
|
iterates through zypp keyring and import all non existant keys into rpm keyring
Definition at line 937 of file RpmDb.cc. References MIL, and pubkeys(). Referenced by initDatabase(). |
|
|
insert all rpm trusted keys into zypp trusted keyring
Definition at line 881 of file RpmDb.cc. References MIL, pubkeyEditions(), and zypp::str::toUpper(). Referenced by initDatabase(). |
|
||||||||||||
|
Run rpm with the specified arguments and handle stderr.
Definition at line 1600 of file RpmDb.cc. References _dbPath, _root, zypp::filesystem::Pathname::asString(), zypp::filesystem::copy(), zypp::target::rpm::librpmDb::dbRelease(), exit_code, initialized(), process, and ZYPP_THROW. Referenced by doInstallPackage(), doRebuildDatabase(), and importPubkey(). |
|
|
Read a line from the general rpm query.
Referenced by doInstallPackage(), doRebuildDatabase(), and importPubkey(). |
|
|
Return the exit status of the general rpm process, closing the connection if not already done.
Definition at line 1667 of file RpmDb.cc. References zypp::ExternalProgram::close(), exit_code, zypp::ExternalProgram::kill(), and process. |
|
|
Forcably kill the system process.
Definition at line 1686 of file RpmDb.cc. References zypp::ExternalProgram::kill(), and process. |
|
||||||||||||||||||||||||
|
handle rpm messages like "/etc/testrc saved as /etc/testrc.rpmorig"
|
|
|
Check signature of rpm file on disk.
Definition at line 1482 of file RpmDb.cc. References CHK_ERROR, ERR, and zypp::filesystem::PathInfo::isFile(). |
|
||||||||||||
|
install rpm package
Definition at line 1790 of file RpmDb.cc. References zypp::target::rpm::RpmInstallReport::ABORT, doInstallPackage(), zypp::target::rpm::RpmInstallReport::IGNORE, report, and ZYPP_RETHROW. Referenced by zypp::target::TargetImpl::commit(). |
|
||||||||||||
|
remove rpm package
Referenced by removePackage(). |
|
||||||||||||
|
Definition at line 1943 of file RpmDb.cc. References zypp::Edition::noepoch, and removePackage(). |
|
|
get backup dir for rpm config files
Definition at line 503 of file RpmDb.h. References _backuppath. |
|
|
create tar.gz of all changed files in a Package
Referenced by backupPackage(), and doInstallPackage(). |
|
|
queries file for name and then calls above backupPackage function. For convenience.
Definition at line 2063 of file RpmDb.cc. References backupPackage(), zypp::target::rpm::RpmHeader::NOSIGNATURE, and zypp::target::rpm::RpmHeader::readPackage(). |
|
|
set path where package backups are stored
Definition at line 2203 of file RpmDb.cc. References _backuppath. |
|
|
whether to create package backups during install or removal
Definition at line 538 of file RpmDb.h. References _packagebackups. |
|
||||||||||||
|
determine which files of an installed package have been modified.
|
|
|
Dump debug info.
Reimplemented from zypp::base::ReferenceCounted. Definition at line 327 of file RpmDb.cc. References _dbPath, _dbStateInfo, _root, DbSI_HAVE_V3, DbSI_HAVE_V3TOV4, DbSI_HAVE_V4, DbSI_MADE_V3TOV4, DbSI_MADE_V4, DbSI_MODIFIED_V4, DbSI_NO_INIT, ENUM_OUT, and zypp::target::rpm::stringPath(). |
|
||||||||||||||||
|
|
|
||||||||||||||||
|
Definition at line 1820 of file RpmDb.cc. References _packagebackups, zypp::filesystem::Pathname::asString(), backupPackage(), ERR, FAILIFNOTINITIALIZED, MIL, modifyDatabase(), report, RPMINST_FORCE, RPMINST_IGNORESIZE, RPMINST_JUSTDB, RPMINST_NODEPS, RPMINST_NODIGEST, RPMINST_NODOCS, RPMINST_NOSCRIPTS, RPMINST_NOSIGNATURE, RPMINST_NOUPGRADE, RPMINST_TEST, zypp::target::rpm::rpmQuoteFilename(), run_rpm(), zypp::ExternalProgram::Stderr_To_Stdout, and systemReadLine(). Referenced by installPackage(). |
|
|
Definition at line 1225 of file RpmDb.cc. References _filerequires, zypp::target::rpm::RpmDb::Packages::_list, _packages, zypp::target::rpm::RpmDb::Packages::clear(), zypp::target::rpm::librpmDb::dbAccess(), DBG, zypp::target::rpm::librpmDb::db_const_iterator::findAll(), makePackageFromHeader(), packagesValid(), report, and WAR. Referenced by getPackages(). |
|
|
Definition at line 823 of file RpmDb.cc. References _packages, zypp::target::rpm::RpmDb::Packages::_valid, dbPath(), zypp::filesystem::Pathname::extend(), FAILIFNOTINITIALIZED, zypp::str::form(), zypp::ExternalProgram::getpid(), MIL, zypp::filesystem::PathInfo::path(), process, report, root(), run_rpm(), zypp::filesystem::PathInfo::size(), zypp::ExternalProgram::Stderr_To_Stdout, systemReadLine(), and WAR. Referenced by rebuildDatabase(). |
|
||||||||||||
|
|
|
|
Internal state info.
Definition at line 91 of file RpmDb.h. Referenced by closeDatabase(), dumpOn(), initDatabase(), and modifyDatabase(). |
|
|
Root directory for all operations.
Definition at line 96 of file RpmDb.h. Referenced by closeDatabase(), dumpOn(), initDatabase(), initialized(), modifyDatabase(), root(), and run_rpm(). |
|
|
Directory that contains the rpmdb.
Definition at line 101 of file RpmDb.h. Referenced by closeDatabase(), dbPath(), dumpOn(), initDatabase(), modifyDatabase(), and run_rpm(). |
|
|
Definition at line 240 of file RpmDb.h. Referenced by closeDatabase(), doGetPackages(), doRebuildDatabase(), importPubkey(), modifyDatabase(), packagesValid(), and ~RpmDb(). |
|
|
Definition at line 244 of file RpmDb.h. Referenced by doGetPackages(). |
|
|
The connection to the rpm process.
Definition at line 362 of file RpmDb.h. Referenced by doRebuildDatabase(), RpmDb(), run_rpm(), systemKill(), systemStatus(), and ~RpmDb(). |
|
|
The exit code of the rpm process, or -1 if not yet known.
Definition at line 399 of file RpmDb.h. Referenced by RpmDb(), run_rpm(), and systemStatus(). |
|
|
/var/adm/backup
Definition at line 402 of file RpmDb.h. Referenced by getBackupPath(), and setBackupPath(). |
|
|
create package backups?
Definition at line 405 of file RpmDb.h. Referenced by createPackageBackups(), and doInstallPackage(). |
|
|
whether <_root>/<WARNINGMAILPATH> was already created
|
1.4.6