Class: RPM::Problem

Inherits:
Object
  • Object
show all
Defined in:
lib/rpm/problem.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create(type, pkg_nevr, key, alt_nevr, str, number) ⇒ Object

Create a problem item.

Parameters:

  • type (RPM::ProblemType)

    problem type

  • pkg_nver (String)

    name-version-edition-release of the related package

  • key (String)

    key of the related package

  • alt_nver (String)

    name-version-edition-release of the other related package

  • str (String)

    generic data string from a problem



29
30
31
32
# File 'lib/rpm/problem.rb', line 29

def self.create(type, pkg_nevr, key, alt_nevr, str, number)
  ptr = ::FFI::AutoPointer.new(RPM::C.rpmProblemCreate(type, pkg_nevr, key, alt_nevr, str, number), Problem.method(:release))
  new(ptr)
end

.from_ptr(ptr) ⇒ RPM::Problem

Creates a problem from an existing C pointer, refcounting it first.

Parameters:

  • ptr (FFI::Pointer)

    existing C pointer

Returns:



14
15
16
17
18
19
20
21
# File 'lib/rpm/problem.rb', line 14

def self.from_ptr(ptr)
  case ptr
    when FFI::Pointer
      new(FFI::AutoPointer.new(RPM::C.rpmProblemLink(ptr), Problem.method(:release)))
    else
      raise "Can't initialize header with '#{ptr}'"
  end
end

.release(ptr) ⇒ Object



6
7
8
# File 'lib/rpm/problem.rb', line 6

def self.release(ptr)
  RPM::C.rpmProblemFree(ptr)
end

Instance Method Details

#<=>(other) ⇒ Fixnum

Returns compare two problems for equality.

Returns:

  • (Fixnum)

    compare two problems for equality.



60
61
62
# File 'lib/rpm/problem.rb', line 60

def <=>(other)
  RPM::C.rpmProblemCompare(@ptr, other.ptr)
end

#keyString

Returns filename or python object address of a problem.

Returns:

  • (String)

    filename or python object address of a problem.



45
46
47
# File 'lib/rpm/problem.rb', line 45

def key
  RPM::C.rpmProblemGetKey(@ptr).read_string
end

#strString

Returns a generic data string from a problem.

Returns:

  • (String)

    a generic data string from a problem.



50
51
52
# File 'lib/rpm/problem.rb', line 50

def str
  RPM::C.rpmProblemGetStr(@ptr)
end

#to_sString

Returns formatted string representation of a problem

Returns:

  • (String)

    formatted string representation of a problem



55
56
57
# File 'lib/rpm/problem.rb', line 55

def to_s
  RPM::C.rpmProblemString(@ptr)
end

#typeRPM::ProblemType

Returns type of problem (dependency, diskpace etc).

Returns:

  • (RPM::ProblemType)

    type of problem (dependency, diskpace etc).



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

def type
  RPM::C.rpmProblemGetType(@ptr)
end