Class: Rake::AutoToolsRPMTask

Inherits:
RPMTask
  • Object
show all
Defined in:
lib/rake/autotoolstask.rb

Overview

Create a build task that will generate an RPM package from an autotools package.

Author

Steve Sloan ([email protected])

Copyright

Copyright © 2006-2009 Steve Sloan

License

MIT

Instance Attribute Summary

Attributes inherited from RPMTask

#build_srpms, #name, #spec_path

Instance Method Summary collapse

Methods inherited from RPMTask

#spec

Constructor Details

#initialize(args, &blk) ⇒ AutoToolsRPMTask



13
14
15
# File 'lib/rake/autotoolstask.rb', line 13

def initialize( args, &blk )
  super
end

Instance Method Details

#define_tasksObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rake/autotoolstask.rb', line 21

def define_tasks
  task @name => @prereqs  do |t|
    re = %r{#{spec.name}-#{spec.version}.*\.tar\.bz2$}
    src = spec.sources.find { |s|  re === s.filename }
    next unless src

    file File.join( project_dir, src.filename )  do |t|
      path = File.join File.basename( File.dirname(t.name) ), File.basename(t.name)
      puts '', '-' * 80,
          "Creating #{path} ...",
          '-' * 80

      system( "make -C #{File.dirname(t.name)} dist-bzip2" ) and $?.exitstatus.zero?  or raise "Make dist-bzip2 failure"
    end.invoke
  end

  file @spec_path => [File.join(project_dir, 'configure')]
  CLEAN.include @spec_path
  super
end

#project_dirObject



17
18
19
# File 'lib/rake/autotoolstask.rb', line 17

def project_dir
  @project_dir ||= File.dirname @spec_path
end