Class: RPM::Dependency

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

Direct Known Subclasses

Conflict, Provide, Require

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Dependency) initialize(name, version, flags, owner)



20
21
22
23
24
25
26
27
28
# File 'lib/rpm/dependency.rb', line 20

def initialize(name, version, flags, owner)

  RPM::Utils.check_type(version, RPM::Version)
  
  @name = name
  @version = version
  @flags = flags
  @owner = owner
end

Instance Attribute Details

- (String) flags



12
13
14
# File 'lib/rpm/dependency.rb', line 12

def flags
  @flags
end

- (Object) flagstag

Returns the value of attribute flagstag



18
19
20
# File 'lib/rpm/dependency.rb', line 18

def flagstag
  @flagstag
end

- (String) name



8
9
10
# File 'lib/rpm/dependency.rb', line 8

def name
  @name
end

- (Object) nametag

Returns the value of attribute nametag



16
17
18
# File 'lib/rpm/dependency.rb', line 16

def nametag
  @nametag
end

- (Package) owner



14
15
16
# File 'lib/rpm/dependency.rb', line 14

def owner
  @owner
end

- (String) version



10
11
12
# File 'lib/rpm/dependency.rb', line 10

def version
  @version
end

- (Object) versiontag

Returns the value of attribute versiontag



17
18
19
# File 'lib/rpm/dependency.rb', line 17

def versiontag
  @versiontag
end

Instance Method Details

- (Boolean) eq?



67
68
69
# File 'lib/rpm/dependency.rb', line 67

def eq?
  flags & RPM::SENSE[:equal] 
end

- (Boolean) ge?



77
78
79
# File 'lib/rpm/dependency.rb', line 77

def ge?
  (flags & RPM::SENSE[:greater]) && (flags & RPMSENSE[:equal])
end

- (Boolean) gt?



62
63
64
# File 'lib/rpm/dependency.rb', line 62

def gt?
  flags & RPM::SENSE[:greater]
end

- (Boolean) le?



72
73
74
# File 'lib/rpm/dependency.rb', line 72

def le?
  (flags & RPM::SENSE[:less]) && (flags & RPMSENSE[:equal])
end

- (Boolean) lt?



57
58
59
# File 'lib/rpm/dependency.rb', line 57

def lt?
  flags & RPM::SENSE[:less]
end

- (Boolean) pre?



82
83
84
# File 'lib/rpm/dependency.rb', line 82

def pre?
  flags & RPM::SENSE[:prereq] 
end

- (Boolean) satisfy?(other)



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/rpm/dependency.rb', line 32

def satisfy?(other)
  case other
    when RPM::Package then
      other.provides.each do |prov|
        return true if self.satisfy?(prov)
      end
      return false
    when RPM::Dependency then
      RPM::FFI.rpmdsCompare(
        RPM::FFI.rpmdsSingle(:providename, other.name,
          other.version.to_vre, other.flags),
        RPM::FFI.rpmdsSingle(:providename, name,
          version.to_vre, flags)) != 0
    when RPM::Version then
      RPM::FFI.rpmdsCompare(
        RPM::FFI.rpmdsSingle(:providename, name,
          other.to_vre, other.to_vre.empty? ? 0 : :equal),
        RPM::FFI.rpmdsSingle(:providename, name,
          version.to_vre, flags)) != 0
    else
      raise(TypeError, "#{other} is not a Version or Dependency")
    end
end