Module: RPM

Defined in:
lib/rpm/gem_version.rb,
lib/rpm.rb,
lib/rpm/db.rb,
lib/rpm/ffi.rb,
lib/rpm/ffi.rb,
lib/rpm/file.rb,
lib/rpm/utils.rb,
lib/rpm/compat.rb,
lib/rpm/version.rb,
lib/rpm/package.rb,
lib/rpm/ffi/rpmts.rb,
lib/rpm/ffi/rpmtd.rb,
lib/rpm/ffi/rpmps.rb,
lib/rpm/ffi/rpmds.rb,
lib/rpm/ffi/rpmfi.rb,
lib/rpm/ffi/rpmdb.rb,
lib/rpm/ffi/header.rb,
lib/rpm/dependency.rb,
lib/rpm/ffi/rpmlog.rb,
lib/rpm/ffi/rpmlib.rb,
lib/rpm/ffi/rpmtag.rb,
lib/rpm/transaction.rb,
lib/rpm/ffi/rpmprob.rb,
lib/rpm/ffi/rpmmacro.rb,
lib/rpm/ffi/rpmtypes.rb,
lib/rpm/match_iterator.rb,
lib/rpm/ffi/rpmcallback.rb

Overview

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

Defined Under Namespace

Modules: FFI, LibC, Utils Classes: ChangeLog, Conflict, DB, Dependency, File, MatchIterator, Package, Provide, Require, Transaction, Version

Constant Summary

TAG =
RPM::FFI::Tag
LOG =
RPM::FFI::Log
SENSE =
RPM::FFI::Sense
FILE =
RPM::FFI::FileAttrs
FILE_STATE =
RPM::FFI::FileState
TRANS_FLAG =
RPM::FFI::TransFlags
PROB_FILTER =
RPM::FFI::ProbFilter
MIRE =
RPM::FFI::RegexpMode
PKG_NAME =
"ruby-rpm"
GEM_VERSION =
"2.0"

Class Method Summary collapse

Class Method Details

.[](name) ⇒ String



49
50
51
52
53
54
55
# File 'lib/rpm.rb', line 49

def self.[](name)
  val = String.new
  buffer = ::FFI::MemoryPointer.new(:pointer, 1024)
  buffer.write_string("%{#{name}}")
  ret = RPM::FFI.expandMacros(nil, nil, buffer, 1024)
  buffer.read_string
end

.[]=(name, value) ⇒ Object

Setup a macro



60
61
62
63
64
65
66
# File 'lib/rpm.rb', line 60

def self.[]=(name, value)
  if value.nil?
    RPM::FFI.delMacro(nil, name.to_s)
  else
    RPM::FFI.addMacro(nil, name.to_s, nil, value.to_s, RPM::FFI::RMIL_DEFAULT)
  end
end

.transaction(root = '/') {|ts| ... } ⇒ Object

Creates a new transaction and pass it to the given block

Examples:

RPM.transaction do |ts|
   ...
end

Yields:

  • (ts)


40
41
42
43
44
# File 'lib/rpm.rb', line 40

def self.transaction(root = '/')
  ts = Transaction.new
  ts.root_dir = root
  yield ts
end