autobuild 0.6.5 → 0.6.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,14 @@
1
+ == Version 0.6.6
2
+
3
+ * add Package#post_install: executes either a block or an external
4
+ command after the package has been installed
5
+ * allow to reference pkg-config packages not built by autobuild.
6
+ The .pc file is then used as installation stamp file
7
+ * the configure.ac.user file generated by Genom may not be present
8
+ in the RCS. Do not expect it to be there after import.
9
+ * removed the Ruby package. If there are extensions to build, better
10
+ have a post_install script to do that
11
+
1
12
  == Version 0.6.5
2
13
 
3
14
  * add Autobuild.default_packages
@@ -18,7 +18,6 @@ lib/autobuild/packages/autotools.rb
18
18
  lib/autobuild/packages/genom.rb
19
19
  lib/autobuild/packages/import.rb
20
20
  lib/autobuild/packages/pkgconfig.rb
21
- lib/autobuild/packages/ruby.rb
22
21
  lib/autobuild/pkgconfig.rb
23
22
  lib/autobuild/reporting.rb
24
23
  lib/autobuild/subcommand.rb
data/TODO CHANGED
@@ -2,4 +2,9 @@ TODO list for Autobuild
2
2
  * create HTML log pages
3
3
  * use Logger to be able to remove all non-error output
4
4
  * test patch support (which has not been used for long) and document it in the README
5
+ * add a disable_packages attribute to Autobuild to disable the build of specific
6
+ packages. This would allow to use autobuild in scripts where the list of packages
7
+ is asked to the user
8
+ * add an --interactive option, which could ask to disable/enable packages before doing
9
+ the build
5
10
 
@@ -3,6 +3,6 @@ require 'autobuild/reporting'
3
3
  require 'autobuild/package'
4
4
 
5
5
  module Autobuild
6
- VERSION = "0.6.5" unless defined? Autobuild::VERSION
6
+ VERSION = "0.6.6" unless defined? Autobuild::VERSION
7
7
  end
8
8
 
@@ -23,6 +23,11 @@ module Autobuild
23
23
  @options_co = Array[*@options_co]
24
24
  super(options)
25
25
  end
26
+
27
+ # Array of options to give to 'cvs checkout'
28
+ attr_reader :options_co
29
+ # Array of options to give to 'cvs update'
30
+ attr_reader :options_up
26
31
 
27
32
  # Returns the module to get
28
33
  def modulename; @module end
@@ -11,6 +11,10 @@ class Autobuild::Importer
11
11
  # More options are specific to each importer type.
12
12
  def initialize(options); @options = options end
13
13
 
14
+ def patches
15
+ @options[:patches] ||= []
16
+ end
17
+
14
18
  # Performs the import of +package+
15
19
  def import(package)
16
20
  srcdir = package.srcdir
@@ -71,10 +75,10 @@ class Autobuild::Importer
71
75
  unapply(package, p)
72
76
  end
73
77
 
74
- @options[:patch].to_a.each { |p|
78
+ patches.to_a.each do |p|
75
79
  apply(package, p)
76
80
  cur_patches << p
77
- }
81
+ end
78
82
  ensure
79
83
  File.open(patchlist(package), 'w+') do |f|
80
84
  f.write(cur_patches.join("\n"))
@@ -25,8 +25,13 @@ class Autobuild::Package
25
25
  # it is relative to Autobuild.prefix. Defaults to ''
26
26
  attr_writer :prefix
27
27
 
28
- # The importer object for this package
29
- attr_accessor :import
28
+ # Sets importer object for this package. Defined for backwards compatibility.
29
+ # Use the #importer attribute instead
30
+ def import=(value)
31
+ @importer = value
32
+ end
33
+ # Sets an importer object for this package
34
+ attr_accessor :importer
30
35
 
31
36
  # The list of packages this one depends upon
32
37
  attr_reader :dependencies
@@ -61,7 +66,19 @@ class Autobuild::Package
61
66
  yield(self) if block_given?
62
67
 
63
68
  # Declare the installation stampfile
64
- file installstamp
69
+ file installstamp do
70
+ Dir.chdir(srcdir) do
71
+ case @post_install
72
+ when Array
73
+ args = @post_install.dup
74
+ tool = Autobuild.tool(args.shift)
75
+
76
+ Autobuild::Subprocess.run name, 'post-install', tool, *args
77
+ when Proc
78
+ @post_install.call
79
+ end
80
+ end
81
+ end
65
82
  task "#{name}-build" => installstamp
66
83
  task :build => "#{name}-build"
67
84
 
@@ -84,9 +101,19 @@ class Autobuild::Package
84
101
  task :default => name
85
102
  end
86
103
 
87
- def import; @import.import(self) if @import end
104
+ def import; @importer.import(self) if @importer end
88
105
  def prepare; end
89
106
 
107
+ def post_install(*args, &block)
108
+ if args.empty?
109
+ @post_install = block
110
+ elsif !block
111
+ @post_install = args
112
+ else
113
+ raise ArgumentError, "cannot set both arguments and block"
114
+ end
115
+ end
116
+
90
117
  # This package depends on +packages+
91
118
  def depends_on(*packages)
92
119
  packages.each do |p|
@@ -96,7 +123,7 @@ class Autobuild::Package
96
123
  raise ConfigException.new(name), "package #{p} not defined"
97
124
  end
98
125
  file installstamp => Package[p].installstamp
99
- task "#{name}-import" => "#{p}-import"
126
+ task "#{name}-import" => "#{p}-import"
100
127
  task "#{name}-prepare" => "#{p}-prepare"
101
128
  @dependencies << p
102
129
  end
@@ -90,6 +90,8 @@ module Autobuild
90
90
  end
91
91
 
92
92
  def prepare
93
+ configureflags.flatten!
94
+
93
95
  # Check if config.status has been generated with the
94
96
  # same options than the ones in configureflags
95
97
  config_status = "#{builddir}/config.status"
@@ -102,7 +104,7 @@ module Autobuild
102
104
 
103
105
  # Add the --prefix option to the configureflags array
104
106
  testflags = ["--prefix=#{prefix}"] + Array[*configureflags]
105
- old_opt = options.find { |o| !testflags.include?(o) }
107
+ old_opt = options.find { |o| !testflags.include?(o) }
106
108
  new_opt = testflags.find { |o| !options.include?(o) }
107
109
  if old_opt || new_opt
108
110
  File.rm_f config_status # to force reconfiguration
@@ -25,6 +25,8 @@ module Autobuild
25
25
  # Called before running the rake tasks and
26
26
  # after all imports have been made
27
27
  def prepare
28
+ genomflags.flatten!
29
+
28
30
  super
29
31
  get_requires
30
32
  end
@@ -59,7 +61,9 @@ module Autobuild
59
61
  # Alias this package to the ones defined in the EXTRA_PKGCONFIG
60
62
  # flag in configure.ac.user
61
63
  def get_provides
62
- File.open(File.join(srcdir, 'configure.ac.user')) do |f|
64
+ configure_ac_user = File.join(srcdir, 'configure.ac.user')
65
+ return unless File.readable?(configure_ac_user)
66
+ File.open(configure_ac_user) do |f|
63
67
  f.each_line { |line|
64
68
  if line =~ /^\s*EXTRA_PKGCONFIG\s*=\s*"?([\w\-]+(?:\s+[\w\-]+)*)"?/
65
69
  $1.split(/\s+/).each { |pkg| provides pkg }
@@ -2,19 +2,24 @@ require 'autobuild/pkgconfig'
2
2
 
3
3
  module Autobuild
4
4
  class InstalledPkgConfig < Package
5
+ attr_reader :pkgconfig
6
+ attr_reader :prefix
7
+
5
8
  def initialize(name)
6
9
  @pkgconfig = PkgConfig.new(name)
7
- @prefix = @pkgconfig.prefix
10
+ @prefix = @pkgconfig.prefix
8
11
  super
9
12
  end
10
13
 
11
14
  def installstamp
12
15
  std_stamp = super
13
- if File.file?(std_stamp)
14
- std_stamp
15
- else
16
- raise "#{name} is either not installed or has not been built by autobuild (#{std_stamp} not found)"
16
+ return std_stamp if File.file?(std_stamp)
17
+
18
+ pcfile = File.join(pkgconfig.prefix, "lib", "pkgconfig", "opencv.pc")
19
+ if !File.file?(pcfile)
20
+ raise "cannot find the .pc file for #{name}, tried #{pcfile}"
17
21
  end
22
+ pcfile
18
23
  end
19
24
  end
20
25
  def installed_pkgconfig(name, &block)
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.2
3
3
  specification_version: 1
4
4
  name: autobuild
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.6.5
7
- date: 2007-02-14 00:00:00 +01:00
6
+ version: 0.6.6
7
+ date: 2007-04-24 00:00:00 +02:00
8
8
  summary: Rake-based utility to build and install multiple packages with dependencies
9
9
  require_paths:
10
10
  - lib
@@ -49,7 +49,6 @@ files:
49
49
  - lib/autobuild/packages/genom.rb
50
50
  - lib/autobuild/packages/import.rb
51
51
  - lib/autobuild/packages/pkgconfig.rb
52
- - lib/autobuild/packages/ruby.rb
53
52
  - lib/autobuild/pkgconfig.rb
54
53
  - lib/autobuild/reporting.rb
55
54
  - lib/autobuild/subcommand.rb
@@ -113,5 +112,5 @@ dependencies:
113
112
  requirements:
114
113
  - - ">="
115
114
  - !ruby/object:Gem::Version
116
- version: 1.1.7
115
+ version: 1.2.0
117
116
  version:
@@ -1,53 +0,0 @@
1
- require 'autobuild/timestamps'
2
- require 'autobuild/package'
3
- require 'enumerator'
4
-
5
- module Autobuild
6
- def self.ruby(spec, &proc)
7
- RubyPackage.new(spec, &proc)
8
- end
9
-
10
- class RubyPackage < Package
11
- # The list of all extension directories
12
- attr_reader :extdir
13
-
14
- def installstamp
15
- "#{srcdir}/#{STAMPFILE}"
16
- end
17
- def initialize(target)
18
- super
19
- source_tree srcdir, [/Makefile$/, /\.(?:so|o)$/]
20
- file installstamp => srcdir do
21
- touch_stamp installstamp
22
- end
23
- end
24
-
25
- def prepare
26
- @extdir = Find.enum_for(:find, srcdir).
27
- grep(/extconf.rb$/).
28
- map { |f| File.dirname(f) }
29
-
30
- extdir.each do |dir|
31
- file "#{dir}/Makefile" => "#{dir}/extconf.rb" do
32
- Dir.chdir(dir) do
33
- Subprocess.run(name, 'ext', Autobuild.tool('ruby'), 'extconf.rb')
34
- end
35
- end
36
- end
37
- end
38
-
39
- def extstamp(dir); "#{dir}/ext-#{STAMPFILE}" end
40
- def build
41
- extdir.each do |dir|
42
- source_tree dir, [/Makefile$/, /\.(?:so|o)$/]
43
- file extstamp(dir) => dir do
44
- Dir.chdir(dir) do
45
- Subprocess.run(name, 'ext', Autobuild.tool('make'))
46
- touch_stamp extstamp(dir)
47
- end
48
- end
49
- end
50
- end
51
- end
52
- end
53
-