Class: Buildozer::Builder::Rpm
- Inherits:
-
Object
- Object
- Buildozer::Builder::Rpm
- Defined in:
- lib/buildozer/builder/rpm.rb
Instance Method Summary collapse
- #build ⇒ Object
- #command ⇒ Object
-
#initialize(package, directory) ⇒ Rpm
constructor
A new instance of Rpm.
- #name ⇒ Object
- #show ⇒ Object
- #validate ⇒ Object
Constructor Details
#initialize(package, directory) ⇒ Rpm
Returns a new instance of Rpm.
7 8 9 10 11 12 |
# File 'lib/buildozer/builder/rpm.rb', line 7 def initialize(package, directory) @package = package @directory = directory validate() end |
Instance Method Details
#build ⇒ Object
14 15 16 |
# File 'lib/buildozer/builder/rpm.rb', line 14 def build() system(command()) end |
#command ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/buildozer/builder/rpm.rb', line 22 def command() buffer = StringIO.new buffer << "fpm -s dir -t rpm" buffer << " -n \"#{@package.name}\"" buffer << " -v \"#{@package.version}\"" buffer << " -C \"#{@directory}\"" buffer << " -p \"#{name()}\"" buffer << " -m \"#{@package.maintainer}\"" if @package.maintainer if @package.architecture and not @package.architecture == :auto buffer << " -a \"#{@package.architecture}\"" end @package.provides.each do |provide| buffer << " --provides \"#{provide}\"" end @package.depends.each do |dependency| buffer << " -d \"#{dependency}\"" end @package.includes.each do |entry| buffer << " #{entry}" end return buffer.string end |
#name ⇒ Object
52 53 54 |
# File 'lib/buildozer/builder/rpm.rb', line 52 def name() "#{@package.archive}_ARCH.rpm" end |
#show ⇒ Object
18 19 20 |
# File 'lib/buildozer/builder/rpm.rb', line 18 def show() puts(command()) end |
#validate ⇒ Object
56 57 58 59 60 |
# File 'lib/buildozer/builder/rpm.rb', line 56 def validate() if @package.includes.empty?() raise Builder::InvalidRpmPackage, "Invalid rpm package, must have at least one 'includes'" end end |