Class: Pkgman::Packages::Rpm

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, package, target) ⇒ Rpm

Returns a new instance of Rpm.



8
9
10
11
12
# File 'lib/pkgman/packages/rpm.rb', line 8

def initialize(build, package, target)
  @build = build
  @package = package
  @target = target
end

Instance Attribute Details

#packageObject (readonly)

Returns the value of attribute package.



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

def package
  @package
end

Instance Method Details

#nameObject



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

def name
  @build.build['name']
end

#pathObject



33
34
35
# File 'lib/pkgman/packages/rpm.rb', line 33

def path
  "/tmp/product/#{name}-#{version}-1.x86_64.rpm"
end

#startObject



22
23
24
25
26
27
28
29
30
31
# File 'lib/pkgman/packages/rpm.rb', line 22

def start
  deps = '-d ' + @package['dependencies'].join(' -d ')

  cmd = "fpm -n #{name} "
  cmd += "-v #{version} "
  cmd += "-s #{@build.type} -t rpm #{deps} "
  cmd += "-p /tmp/product -C #{@build.path}"

  @target.execute(cmd)
end

#typeObject



37
38
39
# File 'lib/pkgman/packages/rpm.rb', line 37

def type
  'rpm'
end

#versionObject



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

def version
  @build.build['version']
end