Class: RPMdb
- Inherits:
-
Object
- Object
- RPMdb
- Defined in:
- lib/rpm.rb
Overview
module RPM
Class Method Summary collapse
Instance Method Summary collapse
-
#close ⇒ Object
def RPMdb.open(root=”).
-
#each ⇒ Object
def requires(name).
-
#file(filespec) ⇒ Object
def close.
-
#group(groupname) ⇒ Object
def file(filespec).
-
#initialize(root = '') ⇒ RPMdb
constructor
def each.
-
#package(packagename) ⇒ Object
def group(groupname).
-
#provides(name) ⇒ Object
def whatrequires(caps).
-
#requires(name) ⇒ Object
def provides(name).
-
#whatprovides(caps) ⇒ Object
def package(packagename).
-
#whatrequires(caps) ⇒ Object
def whatprovides(caps).
Constructor Details
Class Method Details
Instance Method Details
#close ⇒ Object
def RPMdb.open(root=”)
84 85 86 87 |
# File 'lib/rpm.rb', line 84 def close @db = nil GC.start end |
#each ⇒ Object
def requires(name)
156 157 158 159 160 161 |
# File 'lib/rpm.rb', line 156 def each raise RuntimeError, 'closed DB' if @db.nil? @db.each do |pkg| yield pkg.name, pkg.version.v, pkg.version.r end end |
#file(filespec) ⇒ Object
def close
89 90 91 92 93 94 95 96 |
# File 'lib/rpm.rb', line 89 def file(filespec) raise RuntimeError, 'closed DB' if @db.nil? pkgs = [] @db.each_match(RPM::TAG_BASENAMES, filespec) do |pkg| [pkg.name, pkg.version.v, pkg.version.r] end pkgs end |
#group(groupname) ⇒ Object
def file(filespec)
98 99 100 101 102 103 104 105 |
# File 'lib/rpm.rb', line 98 def group(groupname) raise RuntimeError, 'closed DB' if @db.nil? pkgs = [] @db.each_match(RPM::TAG_GROUP, groupname) do |pkg| pkgs << [pkg.name, pkg.version.v, pkg.version.r] end pkgs end |
#package(packagename) ⇒ Object
def group(groupname)
107 108 109 110 111 112 113 114 |
# File 'lib/rpm.rb', line 107 def package(packagename) raise RuntimeError, 'closed DB' if @db.nil? pkgs = [] @db.each_match(RPM::DBI_LABEL, packagename) do |pkg| pkgs << [pkg.name, pkg.version.v, pkg.version.r] end pkgs end |
#provides(name) ⇒ Object
def whatrequires(caps)
134 135 136 137 138 139 140 141 142 143 |
# File 'lib/rpm.rb', line 134 def provides(name) raise RuntimeError, 'closed DB' if @db.nil? pkg = nil @db.each_match(RPM::DBI_LABEL, name) {|p| pkg = p} if pkg then pkg.provides.collect {|prov| prov.name } else [] end end |
#requires(name) ⇒ Object
def provides(name)
145 146 147 148 149 150 151 152 153 154 |
# File 'lib/rpm.rb', line 145 def requires(name) raise RuntimeError, 'closed DB' if @db.nil? pkg = nil @db.each_match(RPM::DBI_LABEL, name) {|p| pkg = p; break} if pkg then pkg.requires.collect {|req| [req.name, req.version.v, req.version.r] } else [] end end |
#whatprovides(caps) ⇒ Object
def package(packagename)
116 117 118 119 120 121 122 123 |
# File 'lib/rpm.rb', line 116 def whatprovides(caps) raise RuntimeError, 'closed DB' if @db.nil? pkgs = [] @db.each_match(RPM::TAG_PROVIDENAME, caps) do |pkg| pkgs << [pkg.name, pkg.version.v, pkg.version.r] end pkgs end |
#whatrequires(caps) ⇒ Object
def whatprovides(caps)
125 126 127 128 129 130 131 132 |
# File 'lib/rpm.rb', line 125 def whatrequires(caps) raise RuntimeError, 'closed DB' if @db.nil? pkgs = [] @db.each_match(RPM::TAG_REQUIRENAME, caps) do |pkg| pkgs << [pkg.name, pkg.version.v, pkg.version.r] end pkgs end |