Class: RPM::DB
- Inherits:
-
Data
- Object
- Data
- RPM::DB
- Includes:
- Enumerable
- Defined in:
- lib/rpm.rb,
ext/rpm/db.c
Class Method Summary (collapse)
- + (Object) each_match(tag, val)
-
+ (Object) init
Initialize the package database The database #root / var / lib /rpm is created.
-
+ (RPM::DB) new
The package database is opened, but transactional processing (@see RPM::DB#transaction) cannot be done for when writable is false.
-
+ (RPM::DB) open
The package database is opened, but transactional processing (@see RPM::DB#transaction) cannot be done for when writable is false.
-
+ (Object) packages(label = nil)
def DB.packages.
-
+ (Object) rebuild
Rebuild the package database It should reside in root / var / lib /rpm.
Instance Method Summary (collapse)
-
- (Object) close
Closes the database.
-
- (Boolean) closed?
true if the database is closed.
- - (Object) each {|Package| ... }
- - (Object) each_match {|Package| ... }
-
- (String) home
The home path of the database.
- - (Object) init_iterator
-
- (String) root
The root path of the database.
- - (Object) transaction
-
- (Boolean) writable?
true if the database is writable.
Class Method Details
+ (Object) each_match(tag, val)
46 47 48 49 50 51 52 |
# File 'lib/rpm.rb', line 46 def DB.each_match(tag, val) begin db = RPM::DB.new db.each_match(tag, val) {|*a| yield a} end GC.start end |
+ (Object) init
Initialize the package database The database #root / var / lib /rpm is created.
|
# File 'ext/rpm/db.c'
static VALUE
db_s_init(int argc, VALUE* argv, VALUE obj)
{
int writable = 0;
const char* root;
switch (argc) {
case 0:
rb_raise(rb_eArgError, "too few argument(1..2)");
case 1: case 2:
if (TYPE(argv[0]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
+ (RPM::DB) new
The package database is opened, but transactional processing (@see RPM::DB#transaction) cannot be done for when writable is false. When writable is false then the generated object gets freezed.
|
# File 'ext/rpm/db.c'
static VALUE
db_s_open(int argc, VALUE* argv, VALUE obj)
{
VALUE db;
rpm_db_t* rdb;
int writable = 0;
const char* root = "";
switch (argc) {
case 0:
break;
case 1:
writable = RTEST(argv[0]);
break;
case 2:
if (!NIL_P(argv[1])) {
if (TYPE(argv[1]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
+ (RPM::DB) open
The package database is opened, but transactional processing (@see RPM::DB#transaction) cannot be done for when writable is false. When writable is false then the generated object gets freezed.
|
# File 'ext/rpm/db.c'
static VALUE
db_s_open(int argc, VALUE* argv, VALUE obj)
{
VALUE db;
rpm_db_t* rdb;
int writable = 0;
const char* root = "";
switch (argc) {
case 0:
break;
case 1:
writable = RTEST(argv[0]);
break;
case 2:
if (!NIL_P(argv[1])) {
if (TYPE(argv[1]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
+ (Object) packages(label = nil)
def DB.packages
54 55 56 57 58 59 60 61 62 |
# File 'lib/rpm.rb', line 54 def DB.packages(label=nil) packages = [] if label then DB.each_match(RPM::DBI_LABEL, label) {|a| packages.push a} else packages = DB.packages end packages end |
+ (Object) rebuild
Rebuild the package database It should reside in root / var / lib /rpm
|
# File 'ext/rpm/db.c'
static VALUE
db_s_rebuild(int argc, VALUE* argv, VALUE obj)
{
const char* root = "";
int ret;
switch (argc) {
case 0:
break;
case 1:
if (!NIL_P(argv[0])) {
if (TYPE(argv[0]) != T_STRING) {
rb_raise(rb_eTypeError, "illegal argument type");
}
|
Instance Method Details
- (Object) close
Closes the database
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_close(VALUE db)
{
db_unref((rpm_db_t*)DATA_PTR(db));
DATA_PTR(db) = NULL;
rb_gc();
return Qnil;
}
|
- (Boolean) closed?
true if the database is closed
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_is_closed(VALUE vdb)
{
return DATA_PTR(vdb) ? Qfalse : Qtrue;
}
|
- (Object) each {|Package| ... }
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_each(VALUE db)
{
check_closed(db);
return rpm_db_each_match(db,INT2NUM(RPMDBI_PACKAGES),Qnil);
}
|
- (Object) each_match {|Package| ... }
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_each_match(VALUE db, VALUE key, VALUE val)
{
VALUE mi;
check_closed(db);
mi = rpm_db_init_iterator (db, key, val);
if (!NIL_P(mi))
return rpm_mi_each (mi);
return Qnil;
}
|
- (String) home
The home path of the database
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_get_home(VALUE db)
{
check_closed(db);
return rb_str_new2(RPM_DB(db)->db_home);
}
|
- (Object) init_iterator
- (String) root
The root path of the database
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_get_root(VALUE db)
{
check_closed(db);
return rb_str_new2(RPM_DB(db)->db_root);
}
|
- (Object) transaction
- (Boolean) writable?
true if the database is writable
|
# File 'ext/rpm/db.c'
VALUE
rpm_db_is_writable(VALUE db)
{
check_closed(db);
return OBJ_FROZEN(db) ? Qfalse : Qtrue;
}
|