Class: RPM::DB
Class Method Summary collapse
-
.each ⇒ Object
deprecated
Deprecated.
Use RPM::Transaction#each
-
.open(_writable = false, root = '/', &block) ⇒ RPM::DB
The package database is opened, but transactional processing (@see RPM::DB#transaction) cannot be done for when
writableis false.
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
-
#count_packages(name) ⇒ Object
database.
- #each {|Package| ... } ⇒ Object
- #each_match(key, val) {|Package| ... } ⇒ Object
-
#home ⇒ Object
deprecated
Deprecated.
Not possible to get home value in newer RPM versions
-
#init_iterator(tag, val) ⇒ RPM::MatchIterator
Creates an iterator for
tagandval. -
#root ⇒ String
The root path of the database.
Class Method Details
.each ⇒ Object
Deprecated.
Use RPM::Transaction#each
102 103 104 105 106 107 108 109 110 111 |
# File 'lib/rpm/db.rb', line 102 def self.each DB.open do |db| it = MatchIterator.from_ptr(RPM::C.rpmdbInitIterator(db.ptr, 0, nil, 0)) if block_given? it.each do |pkg| yield pkg end end end end |
.open(_writable = false, root = '/', &block) ⇒ RPM::DB
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.
74 75 76 |
# File 'lib/rpm/db.rb', line 74 def self.open(_writable = false, root = '/', &block) open_for_transaction(Transaction.new(root: root), writable: false, &block) end |
Instance Method Details
#close ⇒ Object
52 53 54 |
# File 'lib/rpm/db.rb', line 52 def close RPM::C.rpmtsCloseDB(@ts.ptr) end |
#closed? ⇒ Boolean
56 57 58 |
# File 'lib/rpm/db.rb', line 56 def closed? ptr.null? end |
#count_packages(name) ⇒ Object
database
115 |
# File 'lib/rpm/db.rb', line 115 def count_packages(name); end |
#each {|Package| ... } ⇒ Object
43 44 45 |
# File 'lib/rpm/db.rb', line 43 def each(&block) @ts.each(&block) end |
#each_match(key, val) {|Package| ... } ⇒ Object
32 33 34 |
# File 'lib/rpm/db.rb', line 32 def each_match(key, val, &block) @ts.each_match(key, val, &block) end |
#home ⇒ Object
Deprecated.
Not possible to get home value in newer RPM versions
92 93 94 |
# File 'lib/rpm/db.rb', line 92 def home raise NotImplementedError end |
#init_iterator(tag, val) ⇒ RPM::MatchIterator
Returns Creates an iterator for tag and val.
17 18 19 |
# File 'lib/rpm/db.rb', line 17 def init_iterator(tag, val) @ts.init_iterator(tag, val) end |
#root ⇒ String
Returns The root path of the database.
97 98 99 |
# File 'lib/rpm/db.rb', line 97 def root RPM::C.rpmtsRootDir(@ts.ptr) end |