module RPM

The reason this file is gem_version.rb and not version.rb is because it conflicts with the version.rb class

Constants

CallbackData
FILE
FILE_STATE
GEM_VERSION
LOG
MIRE
PKG_NAME
PROB_FILTER
SENSE
TAG
TRANS_FLAG

Public Class Methods

[](name) click to toggle source

@param [String] name Name of the macro @return [String] value of macro name

# File lib/rpm.rb, line 45
def self.[](name)
  val = String.new
  buffer = ::FFI::MemoryPointer.new(:pointer, 1024)
  buffer.write_string("%{#{name}}")
  ret = RPM::C.expandMacros(nil, nil, buffer, 1024)
  buffer.read_string
end
[]=(name, value) click to toggle source

Setup a macro @param [String] name Name of the macro @param [String] value Value of the macro or nil to delete it

# File lib/rpm.rb, line 56
def self.[]=(name, value)
  if value.nil?
    RPM::C.delMacro(nil, name.to_s)
  else
    RPM::C.addMacro(nil, name.to_s, "", value.to_s, RPM::C::RMIL_DEFAULT)
  end
end
transaction(root = '/') { |ts| ... } click to toggle source

Creates a new transaction and pass it to the given block

@param [String] root dir, default ‘/’

@example

RPM.transaction do |ts|
   ...
end
# File lib/rpm.rb, line 33
def self.transaction(root = '/')
  begin
    ts = Transaction.new
    ts.root_dir = root
    yield ts
  ensure
    ts.ptr.free
  end
end