15#ifndef ZYPP_TARGET_RPM_RPMDB_H
16#define ZYPP_TARGET_RPM_RPMDB_H
24#include <zypp/Pathname.h>
25#include <zypp/ExternalProgram.h>
39class RpmPostTransCollector;
56 typedef class InstTargetError
Error;
165 std::list<PublicKey>
pubkeys()
const;
184 std::list<FileInfo>
fileList(
const std::string & name_r,
const Edition & edition_r )
const;
190 bool hasFile(
const std::string & file_r,
const std::string & name_r =
"" )
const;
196 std::string
whoOwnsFile(
const std::string & file_r )
const;
201 bool hasProvides(
const std::string & tag_r )
const;
216 bool hasPackage(
const std::string & name_r )
const;
234 void getData(
const std::string & name_r,
339 const std::string& name,
341 const char* difffailmsg,
342 const char* diffgenmsg);
431 int runposttrans(
const Pathname & filename_r, std::function<
void(
const std::string&)> output_r );
494 virtual std::ostream &
dumpOn( std::ostream &
str )
const;
506std::ostream &
operator<<( std::ostream &
str,
const RpmDb::CheckPackageDetail & obj );
Edition represents [epoch:]version[-release]
Execute a program and give access to its io An object of this class encapsulates the execution of an ...
Stderr_Disposition
Define symbols for different policies on the handling of stderr.
TraitsType::constPtrType constPtr
Class representing one GPG Public Key (PublicKeyData + ASCII armored in a tempfile).
Base class for reference counted objects.
bool empty() const
Test for an empty path.
Extract and remember posttrans scripts for later execution.
Interface to the rpm program.
void getData(const std::string &name_r, RpmHeader::constPtr &result_r) const
Get an installed packages data from rpmdb.
void doRebuildDatabase(callback::SendReport< RebuildDBReport > &report)
bool queryChangedFiles(FileList &fileList, const std::string &packageName)
determine which files of an installed package have been modified.
std::string error_message
Error message from running rpm as external program.
bool hasRequiredBy(const std::string &tag_r) const
Return true if at least one package requires a certain tag.
virtual std::ostream & dumpOn(std::ostream &str) const
Dump debug info.
std::string whoOwnsFile(const std::string &file_r) const
Return name of package owning file or empty string if no installed package owns file.
void exportTrustedKeysInZyppKeyRing()
insert all rpm trusted keys into zypp trusted keyring
void importPubkey(const PublicKey &pubkey_r)
Import ascii armored public key in file pubkey_r.
void installPackage(const Pathname &filename, RpmInstFlags flags=RPMINST_NONE)
install rpm package
Pathname _backuppath
/var/adm/backup
void run_rpm(const RpmArgVec &options, ExternalProgram::Stderr_Disposition stderr_disp=ExternalProgram::Stderr_To_Stdout)
Run rpm with the specified arguments and handle stderr.
void initDatabase(Pathname root_r=Pathname(), bool doRebuild_r=false)
Prepare access to the rpm database below root_r.
ExternalProgram * process
The connection to the rpm process.
SyncTrustedKeyBits
Sync mode for syncTrustedKeys.
@ SYNC_TO_KEYRING
export rpm trusted keys into zypp trusted keyring
@ SYNC_FROM_KEYRING
import zypp trusted keys into rpm database.
int runposttrans(const Pathname &filename_r, std::function< void(const std::string &)> output_r)
Run collected posttrans and transfiletrigger(postun|in) if rpm --runposttrans is supported.
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.
int systemStatus()
Return the exit status of the general rpm process, closing the connection if not already done.
CheckPackageResult checkPackageSignature(const Pathname &path_r, CheckPackageDetail &detail_r)
Check signature of rpm file on disk (strict check returning CHK_NOSIG if file is unsigned).
bool backupPackage(const std::string &packageName)
create tar.gz of all changed files in a Package
bool hasProvides(const std::string &tag_r) const
Return true if at least one package provides a certain tag.
void systemKill()
Forcably kill the system process.
const Pathname & root() const
void removePubkey(const PublicKey &pubkey_r)
Remove a public key from the rpm database.
void removePackage(const std::string &name_r, RpmInstFlags flags=RPMINST_NONE)
remove rpm package
void createPackageBackups(bool yes)
whether to create package backups during install or removal
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 !...
const Pathname & dbPath() const
Pathname _dbPath
Directory that contains the rpmdb.
void closeDatabase()
Block further access to the rpm database and go back to uninitialized state.
void setBackupPath(const Pathname &path)
set path where package backups are stored
bool _packagebackups
create package backups?
CheckPackageResult checkPackage(const Pathname &path_r, CheckPackageDetail &detail_r)
Check signature of rpm file on disk (legacy version returning CHK_OK if file is unsigned,...
void importZyppKeyRingTrustedKeys()
iterates through zypp keyring and import all non-existent keys into rpm keyring
void doInstallPackage(const Pathname &filename, RpmInstFlags flags, RpmPostTransCollector *postTransCollector_r, callback::SendReport< RpmInstallReport > &report)
Pathname getBackupPath(void)
get backup dir for rpm config files
Pathname _root
Root directory for all operations.
class InstTargetError Error
Default error class.
bool hasConflicts(const std::string &tag_r) const
Return true if at least one package conflicts with a certain tag.
std::vector< const char * > RpmArgVec
int exit_code
The exit code of the rpm process, or -1 if not yet known.
void syncTrustedKeys(SyncTrustedKeyBits mode_r=SYNC_BOTH)
Sync trusted keys stored in rpm database and zypp trusted keyring.
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"
CheckPackageResult
checkPackage result
bool hasPackage(const std::string &name_r) const
Return true if package is installed.
void doRemovePackage(const std::string &name_r, RpmInstFlags flags, RpmPostTransCollector *postTransCollector_r, callback::SendReport< RpmRemoveReport > &report)
std::set< std::string > FileList
bool systemReadLine(std::string &line)
Read a line from the general rpm query.
void rebuildDatabase()
Rebuild the rpm database (rpm –rebuilddb).
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 ...
String related utilities and Regular expression matching.
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
std::ostream & operator<<(std::ostream &str, const librpmDb::db_const_iterator &obj)
Easy-to use interface to the ZYPP dependency resolver.
Detailed rpm signature check log messages A single multiline message if CHK_OK.