41 typedef intrusive_ptr<librpmDb>
Ptr;
42 typedef intrusive_ptr<const librpmDb>
constPtr;
122 static std::string
expand(
const std::string & macro_r );
127 static std::string
stringPath(
const Pathname & root_r,
const Pathname & sub_r )
129 return std::string(
"'(" ) + root_r.asString() +
")" + sub_r.asString() +
"'";
164 static void dbAccess(
const Pathname & root_r,
const Pathname & dbPath_r );
189 static unsigned dbRelease(
bool force_r =
false );
223 static std::ostream &
dumpState( std::ostream & str );
236 class db_const_iterator;
257 librpmDb(
const Pathname & root_r,
const Pathname & dbPath_r,
bool readonly_r );
262 virtual void unref_to(
unsigned refCount_r )
const;
274 const Pathname &
root()
const;
279 const Pathname &
dbPath()
const;
285 shared_ptr<RpmException>
error()
const;
303 unsigned size()
const;
315 virtual std::ostream &
dumpOn( std::ostream & str )
const;
369 DbDirInfo(
const Pathname & root_r,
const Pathname & dbPath_r );
435 return _dbDir.path().empty();
460 return _dbV4.isFile();
468 return _dbV3.isFile();
527 shared_ptr<RpmException>
dbError()
const;
569 bool findByFile(
const std::string & file_r );
596 bool findByName(
const std::string & name_r );
PathInfo _dbV4
rpmV4 database (_dbDir/Packages)
bool hasDbV3ToV4() const
Whether dbV3ToV4 file exists.
static const Pathname & defaultRoot()
static bool _dbBlocked
Whether access is blocked (no _defaultDb will be available).
PathInfo _dbV3ToV4
rpmV3 database backup created on conversion to rpmV4 (_dbDir/packages.rpm3)
static unsigned blockAccess()
Blocks further access to rpmdb.
static std::ostream & dumpState(std::ostream &str)
Dump debug info.
friend std::ostream & operator<<(std::ostream &str, const db_const_iterator &obj)
void operator++()
Advance to next RpmHeader::constPtr.
bool findByProvides(const std::string &tag_r)
Reset to iterate all packages that provide a certain tag.
shared_ptr< RpmException > error() const
Return any database error.
static std::string expand(const std::string ¯o_r)
Pathname _dbPath
Directory that contains the rpmdb.
Collect info about what kind of rpmdb seems to be present by looking at paths and filenames...
static void dbAccess()
Access the database at the current default location.
bool findByRequiredBy(const std::string &tag_r)
Reset to iterate all packages that require a certain tag.
librpmDb(const Pathname &root_r, const Pathname &dbPath_r, bool readonly_r)
Private constructor! librpmDb objects are to be created via static interface only.
virtual std::ostream & dumpOn(std::ostream &str) const
Dump debug info.
static librpmDb * newLibrpmDb(Pathname root_r, Pathname dbPath_r, bool readonly_r)
For internal use.
const Pathname & root() const
Root directory for all operations.
Edition represents [epoch:]version[-release]
bool hasDbDir() const
Whether dbDir directory exists.
bool illegalArgs() const
Whether constructor arguments were illegal.
db_const_iterator(const db_const_iterator &)
DbDirInfo(const Pathname &root_r, const Pathname &dbPath_r)
For Constructor arguments see accessPath.
const RpmHeader::constPtr & operator->() const
Forwards to the current RpmHeader::constPtr.
Subclass to retrieve database content.
bool hasDbV4() const
Whether dbV4 file exists.
static librpmDb::constPtr _defaultDb
Current rpmdb handle.
intrusive_ptr< librpmDb > Ptr
virtual ~librpmDb()
Destructor.
const Pathname & root() const
boost::noncopyable NonCopyable
Ensure derived classes cannot be copied.
void * dont_call_it() const
Dont call it ;) It's for development and testing only.
const PathInfo & dbV3ToV4() const
rpmV3 database backup created on conversion to rpmV4 (_dbDir/packages.rpm3)
shared_ptr< RpmException > dbError() const
Return any database error.
static Pathname _defaultRoot
Current root directory for all operations.
static const Pathname & defaultDbPath()
bool findByName(const std::string &name_r)
Reset to iterate all packages with a certain name.
PathInfo _dbDir
database directory (unset on illegal constructor arguments)
static unsigned dbRelease(bool force_r=false)
If there are no outstanding references to the database (e.g.
bool hasDbV3() const
Whether dbV3 file exists.
const RpmHeader::constPtr & operator*() const
Returns the current RpmHeader::constPtr or NULL, if no more entries available.
friend std::ostream & operator<<(std::ostream &str, const DbDirInfo &obj)
bool findByFile(const std::string &file_r)
Reset to iterate all packages that own a certain file.
Base class for reference counted objects.
Manage access to librpm database.
bool findPackage(const std::string &name_r)
Find package by name.
virtual void unref_to(unsigned refCount_r) const
Trigger from Rep, after refCount was decreased.
static void unblockAccess()
Allow access to rpmdb e.g.
const PathInfo & dbV4() const
rpmV4 database (_dbDir/Packages)
static Pathname _defaultDbPath
Current directory (below root) that contains the rpmdb.
bool findAll()
Reset to iterate all packages.
db_const_iterator & operator=(const db_const_iterator &)
librpmDb internal database handle
static bool globalInit()
Initialize lib librpm (read configfiles etc.).
~db_const_iterator()
Destructor.
bool findByConflicts(const std::string &tag_r)
Reset to iterate all packages that conflict with a certain tag.
const PathInfo & dbDir() const
database directory (unset on illegal constructor arguments)
unsigned dbHdrNum() const
Returns the current headers index in database, 0 if no header.
bool usableArgs() const
Whether constructor arguments were llegal and dbDir either is a directory or may be created (path doe...
const PathInfo & dbV3() const
rpmV3 database (_dbDir/packages.rpm)
intrusive_ptr< const librpmDb > constPtr
Pathname _root
Root directory for all operations.
PathInfo _dbV3
rpmV3 database (_dbDir/packages.rpm)
static std::string stringPath(const Pathname &root_r, const Pathname &sub_r)
const Pathname & dbPath() const
Directory that contains the rpmdb.
void restat()
Restat all paths.
const Pathname & dbPath() const
TraitsType::constPtrType constPtr