15 #ifndef ZYPP_TARGET_RPM_RPMDB_H
16 #define ZYPP_TARGET_RPM_RPMDB_H
54 typedef class InstTargetError
Error;
85 return( (val_r & bits_r) == bits_r );
116 static void removeV4(
const Pathname & dbdir_r,
bool v3backup_r );
122 static void removeV3(
const Pathname & dbdir_r,
bool v3backup_r );
169 return( !
_root.empty() );
198 Pathname dbPath_r = Pathname(),
199 bool doRebuild_r =
false );
238 std::list<PublicKey>
pubkeys()
const;
257 std::list<FileInfo>
fileList(
const std::string & name_r,
const Edition & edition_r )
const;
263 bool hasFile(
const std::string & file_r,
const std::string & name_r =
"" )
const;
269 std::string
whoOwnsFile(
const std::string & file_r )
const;
274 bool hasProvides(
const std::string & tag_r )
const;
289 bool hasPackage(
const std::string & name_r )
const;
307 void getData(
const std::string & name_r,
415 const std::string& name,
417 const char* difffailmsg,
418 const char* diffgenmsg);
534 virtual std::ostream &
dumpOn( std::ostream & str )
const;
546 #endif // ZYPP_TARGET_RPM_RPMDB_H
Interface to the rpm program.
bool hasPackage(const std::string &name_r) const
Return true if package is installed.
bool hasProvides(const std::string &tag_r) const
Return true if at least one package provides a certain tag.
Pathname _root
Root directory for all operations.
void getData(const std::string &name_r, RpmHeader::constPtr &result_r) const
Get an installed packages data from rpmdb.
void exportTrustedKeysInZyppKeyRing()
insert all rpm trusted keys into zypp trusted keyring
void rebuildDatabase()
Rebuild the rpm database (rpm –rebuilddb).
void installPackage(const Pathname &filename, RpmInstFlags flags=RPMINST_NONE)
install rpm package
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.
virtual std::ostream & dumpOn(std::ostream &str) const
Dump debug info.
Edition represents [epoch:]version[-release]
bool hasConflicts(const std::string &tag_r) const
Return true if at least one package conflicts with a certain tag.
import zypp trusted keys into rpm database.
void importZyppKeyRingTrustedKeys()
iterates through zypp keyring and import all non existant keys into rpm keyring
bool backupPackage(const std::string &packageName)
create tar.gz of all changed files in a Package
Pathname getBackupPath(void)
get backup dir for rpm config files
void importPubkey(const PublicKey &pubkey_r)
Import ascii armored public key in file pubkey_r.
void systemKill()
Forcably kill the system process.
bool dbsi_has(const DbStateInfoBits &val_r, const unsigned &bits_r) const
void syncTrustedKeys(SyncTrustedKeyBits mode_r=SYNC_BOTH)
Sync trusted keys stored in rpm database and zypp trusted keyring.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
Store and operate on date (time_t).
Pathname _backuppath
/var/adm/backup
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...
int exit_code
The exit code of the rpm process, or -1 if not yet known.
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
SyncTrustedKeyBits
Sync mode for syncTrustedKeys.
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...
ExternalProgram * process
The connection to the rpm process.
void doRebuildDatabase(callback::SendReport< RebuildDBReport > &report)
const Pathname & root() const
void closeDatabase()
Block further access to the rpm database and go back to uninitialized state.
Stderr_Disposition
Define symbols for different policies on the handling of stderr.
DbStateInfoBits _dbStateInfo
Internal state info.
Base class for reference counted objects.
checkPackageResult checkPackage(const Pathname &path_r)
Check signature of rpm file on disk.
export rpm trusted keys into zypp trusted keyring
void doInstallPackage(const Pathname &filename, RpmInstFlags flags, callback::SendReport< RpmInstallReport > &report)
std::set< Edition > pubkeyEditions() const
Return the edition of all installed public keys.
void removePubkey(const PublicKey &pubkey_r)
Remove a public key from the rpm database.
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"
bool _packagebackups
create package backups?
bool hasRequiredBy(const std::string &tag_r) const
Return true if at least one package requires a certain tag.
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
void createPackageBackups(bool yes)
whether to create package backups during install or removal
bool _warndirexists
whether <_root>/<WARNINGMAILPATH> was already created
void doRemovePackage(const std::string &name_r, RpmInstFlags flags, callback::SendReport< RpmRemoveReport > &report)
void setBackupPath(const Pathname &path)
set path where package backups are stored
void initDatabase(Pathname root_r=Pathname(), Pathname dbPath_r=Pathname(), bool doRebuild_r=false)
Prepare access to the rpm database.
std::string error_message
Error message from running rpm as external program.
void removePackage(const std::string &name_r, RpmInstFlags flags=RPMINST_NONE)
remove rpm package
std::list< PublicKey > pubkeys() const
Return the long ids of all installed public keys.
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 ...
Date timestamp() const
timestamp of the rpm database (last modification)
const Pathname & dbPath() const
void dbsi_set(DbStateInfoBits &val_r, const unsigned &bits_r) const
std::string whoOwnsFile(const std::string &file_r) const
Return name of package owning file or empty string if no installed package owns file.
checkPackageResult
checkPackage result
static void removeV3(const Pathname &dbdir_r, bool v3backup_r)
Remove the rpm3 database in dbdir_r.
bool queryChangedFiles(FileList &fileList, const std::string &packageName)
determine which files of an installed package have been modified.
void dbsi_clr(DbStateInfoBits &val_r, const unsigned &bits_r) const
static void removeV4(const Pathname &dbdir_r, bool v3backup_r)
Remove the rpm4 database in dbdir_r and optionally any backup created on conversion.
friend std::ostream & operator<<(std::ostream &str, const DbStateInfoBits &obj)
void run_rpm(const RpmArgVec &options, ExternalProgram::Stderr_Disposition stderr_disp=ExternalProgram::Stderr_To_Stdout)
Run rpm with the specified arguments and handle stderr.
class InstTargetError Error
Default error class.
TraitsType::constPtrType constPtr
Pathname _dbPath
Directory that contains the rpmdb.
std::set< std::string > FileList
std::vector< const char * > RpmArgVec