autobuild 1.4.3 → 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,6 @@
1
+ == Version 1.4.4
2
+ * minor bug fixes
3
+
1
4
  == Version 1.4.3
2
5
  * minor changes in how the shell environment is managed
3
6
  * update LD_LIBRARY_PATH when applicable
@@ -1,5 +1,5 @@
1
1
  module Autobuild
2
- VERSION = "1.4.3" unless defined? Autobuild::VERSION
2
+ VERSION = "1.4.4" unless defined? Autobuild::VERSION
3
3
  end
4
4
 
5
5
  require 'autobuild/config'
@@ -53,7 +53,7 @@ module Autobuild
53
53
  if root != expected_root || mod != @module
54
54
  raise ConfigException, "checkout in #{package.srcdir} is from #{root}:#{mod}, was expecting #{expected_root}:#{@module}"
55
55
  end
56
- Subprocess.run(package.name, :import, @program, 'up', *@options_up)
56
+ Subprocess.run(package, :import, @program, 'up', *@options_up)
57
57
  end
58
58
  end
59
59
 
@@ -64,7 +64,7 @@ module Autobuild
64
64
  FileUtils.mkdir_p(head) if !File.directory?(head)
65
65
  Dir.chdir(head) do
66
66
  options = [ @program, '-d', cvsroot, 'co', '-d', tail ] + @options_co + [ modulename ]
67
- Subprocess.run(package.name, :import, *options)
67
+ Subprocess.run(package, :import, *options)
68
68
  end
69
69
  end
70
70
  end
@@ -27,7 +27,7 @@ module Autobuild
27
27
  raise ConfigException, "#{package.srcdir} is not a Darcs repository"
28
28
  end
29
29
 
30
- Subprocess.run(package.name, :import, @program,
30
+ Subprocess.run(package, :import, @program,
31
31
  'pull', '--all', "--repodir=#{package.srcdir}", '--set-scripts-executable', @source, *@pull)
32
32
  end
33
33
 
@@ -37,7 +37,7 @@ module Autobuild
37
37
  FileUtils.mkdir_p(basedir)
38
38
  end
39
39
 
40
- Subprocess.run(package.name, :import, @program,
40
+ Subprocess.run(package, :import, @program,
41
41
  'get', '--set-scripts-executable', @source, package.srcdir, *@get)
42
42
  end
43
43
  end
@@ -85,9 +85,9 @@ module Autobuild
85
85
  validate_srcdir(package)
86
86
  Dir.chdir(package.srcdir) do
87
87
  if commit # we are checking out a specific commit. We just call git fetch
88
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository)
88
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'fetch', repository)
89
89
  else
90
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'fetch', repository, branch || tag)
90
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'fetch', repository, branch || tag)
91
91
  end
92
92
  if File.readable?( File.join('.git', 'FETCH_HEAD') )
93
93
  fetch_commit = File.readlines( File.join('.git', 'FETCH_HEAD') ).
@@ -185,7 +185,7 @@ module Autobuild
185
185
 
186
186
  # If we are tracking a commit/tag, just check it out and return
187
187
  if commit || tag
188
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', commit || tag)
188
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', commit || tag)
189
189
  return
190
190
  end
191
191
 
@@ -193,9 +193,9 @@ module Autobuild
193
193
  # Check if the target branch already exists. If it is the
194
194
  # case, check it out. Otherwise, create it.
195
195
  if File.file?(File.join(".git", "refs", "heads", branch))
196
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', branch)
196
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', branch)
197
197
  else
198
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'checkout', '-b', branch, "FETCH_HEAD")
198
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'checkout', '-b', branch, "FETCH_HEAD")
199
199
  end
200
200
  end
201
201
 
@@ -204,7 +204,7 @@ module Autobuild
204
204
  if !merge? && status.status == Status::NEEDS_MERGE
205
205
  raise PackageException, "importing the current version would require a merge"
206
206
  end
207
- Subprocess.run(package.name, :import, Autobuild.tool('git'), 'merge', fetch_commit)
207
+ Subprocess.run(package, :import, Autobuild.tool('git'), 'merge', fetch_commit)
208
208
  end
209
209
  end
210
210
  end
@@ -215,24 +215,24 @@ module Autobuild
215
215
  FileUtils.mkdir_p base_dir
216
216
  end
217
217
 
218
- Subprocess.run(package.name, :import,
218
+ Subprocess.run(package, :import,
219
219
  Autobuild.tool('git'), 'clone', '-o', 'autobuild',
220
220
  repository, package.srcdir)
221
221
 
222
222
  Dir.chdir(package.srcdir) do
223
223
  # If we are tracking a commit/tag, just check it out
224
224
  if commit || tag
225
- Subprocess.run(package.name, :import, Autobuild.tool('git'),
225
+ Subprocess.run(package, :import, Autobuild.tool('git'),
226
226
  'checkout', commit || tag)
227
227
  return
228
228
  end
229
229
 
230
230
  current_branch = `git symbolic-ref HEAD`.chomp
231
231
  if current_branch == "refs/heads/#{branch}"
232
- Subprocess.run(package.name, :import, Autobuild.tool('git'),
232
+ Subprocess.run(package, :import, Autobuild.tool('git'),
233
233
  'reset', '--hard', "autobuild/#{branch}")
234
234
  else
235
- Subprocess.run(package.name, :import, Autobuild.tool('git'),
235
+ Subprocess.run(package, :import, Autobuild.tool('git'),
236
236
  'checkout', '-b', branch, "autobuild/#{branch}")
237
237
  end
238
238
  end
@@ -38,13 +38,13 @@ module Autobuild
38
38
  if source != @source
39
39
  raise ConfigException, "current checkout found at #{package.srcdir} is from #{source}, was expecting #{@source}"
40
40
  end
41
- Subprocess.run(package.name, :import, @program, 'up', "--non-interactive", *@options_up)
41
+ Subprocess.run(package, :import, @program, 'up', "--non-interactive", *@options_up)
42
42
  }
43
43
  end
44
44
 
45
45
  def checkout(package) # :nodoc:
46
46
  options = [ @program, 'co', "--non-interactive" ] + @options_co + [ @source, package.srcdir ]
47
- Subprocess.run(package.name, :import, *options)
47
+ Subprocess.run(package, :import, *options)
48
48
  end
49
49
  end
50
50
 
@@ -123,7 +123,7 @@ module Autobuild
123
123
  FileUtils.mkdir_p base_dir
124
124
  cmd = [ 'tar', "x#{TAR_OPTION[mode]}f", cachefile, '-C', base_dir ]
125
125
 
126
- Subprocess.run(package.name, :import, *cmd)
126
+ Subprocess.run(package, :import, *cmd)
127
127
  if tardir
128
128
  File.mv File.join(base_dir, tardir), package.srcdir
129
129
  end
@@ -86,9 +86,9 @@ class Autobuild::Importer
86
86
 
87
87
  def call_patch(package, reverse, file)
88
88
  patch = Autobuild.tool('patch')
89
- Dir.chdir(package.srcdir) {
90
- Subprocess.run(package.name, :patch, patch, '-p0', (reverse ? '-R' : nil), "<#{file}")
91
- }
89
+ Dir.chdir(package.srcdir) do
90
+ Subprocess.run(package, :patch, patch, '-p0', (reverse ? '-R' : nil), "<#{file}")
91
+ end
92
92
  end
93
93
 
94
94
  def apply(package, path); call_patch(package, false, path) end
@@ -71,6 +71,9 @@ module Autobuild
71
71
  def srcdir; File.expand_path(@srcdir || name, Autobuild.srcdir) end
72
72
  # Absolute path to the installation directory. See #prefix=
73
73
  def prefix; File.expand_path(@prefix || '', Autobuild.prefix) end
74
+ # Absolute path to the log directory for this package. See #logdir=
75
+ def logdir; File.expand_path(@logdir, prefix) end
76
+
74
77
 
75
78
  # The file which marks when the last sucessful install
76
79
  # has finished. The path is absolute
@@ -4,6 +4,7 @@ require 'autobuild/environment'
4
4
  require 'autobuild/package'
5
5
  require 'autobuild/subcommand'
6
6
  require 'shellwords'
7
+ require 'fileutils'
7
8
 
8
9
  module Autobuild
9
10
  def self.autotools(opts, &proc)
@@ -62,7 +63,7 @@ module Autobuild
62
63
  doc_task do
63
64
  Dir.chdir(builddir) do
64
65
  Autobuild.progress "generating documentation for #{name}"
65
- Subprocess.run(name, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
66
+ Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
66
67
  yield if block_given?
67
68
  end
68
69
  end
@@ -138,7 +139,7 @@ module Autobuild
138
139
  old_opt = options.find { |o| !testflags.include?(o) }
139
140
  new_opt = testflags.find { |o| !options.include?(o) }
140
141
  if old_opt || new_opt
141
- File.rm_f config_status # to force reconfiguration
142
+ FileUtils.rm_f config_status # to force reconfiguration
142
143
  end
143
144
  end
144
145
 
@@ -176,14 +177,14 @@ module Autobuild
176
177
  end
177
178
 
178
179
  file conffile do
179
- Dir.chdir(srcdir) {
180
+ Dir.chdir(srcdir) do
180
181
  if using[:autogen].nil?
181
182
  using[:autogen] = %w{autogen autogen.sh}.find { |f| File.exists?(f) }
182
183
  end
183
184
 
184
185
  Autobuild.progress "generating build system for #{name}"
185
186
  if using[:autogen]
186
- Subprocess.run(name, 'configure', File.expand_path(using[:autogen]))
187
+ Subprocess.run(self, 'configure', File.expand_path(using[:autogen]))
187
188
  else
188
189
  # Autodetect autoconf/aclocal/automake
189
190
  #
@@ -202,11 +203,11 @@ module Autobuild
202
203
  else; Autobuild.tool(tool)
203
204
  end
204
205
 
205
- Subprocess.run(name, 'configure', tool_program)
206
+ Subprocess.run(self, 'configure', tool_program)
206
207
  end
207
208
  end
208
209
  end
209
- }
210
+ end
210
211
  end
211
212
 
212
213
  return conffile
@@ -224,26 +225,26 @@ module Autobuild
224
225
  command += Array[*configureflags]
225
226
 
226
227
  Autobuild.progress "configuring build system for #{name}"
227
- Subprocess.run(name, 'configure', *command)
228
+ Subprocess.run(self, 'configure', *command)
228
229
  }
229
230
  end
230
231
 
231
232
  # Do the build in builddir
232
233
  def build
233
- Dir.chdir(builddir) {
234
+ Dir.chdir(builddir) do
234
235
  Autobuild.progress "building #{name}"
235
- Subprocess.run(name, 'build', './config.status')
236
- Subprocess.run(name, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}")
237
- }
236
+ Subprocess.run(self, 'build', './config.status')
237
+ Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}")
238
+ end
238
239
  Autobuild.touch_stamp(buildstamp)
239
240
  end
240
241
 
241
242
  # Install the result in prefix
242
243
  def install
243
- Dir.chdir(builddir) {
244
+ Dir.chdir(builddir) do
244
245
  Autobuild.progress "installing #{name}"
245
- Subprocess.run(name, 'install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
246
- }
246
+ Subprocess.run(self, 'install', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
247
+ end
247
248
  Autobuild.touch_stamp(installstamp)
248
249
  Autobuild.update_environment(prefix)
249
250
  end
@@ -64,7 +64,7 @@ module Autobuild
64
64
  doc_task do
65
65
  Dir.chdir(builddir) do
66
66
  Autobuild.progress "generating documentation for #{name}"
67
- Subprocess.run(name, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
67
+ Subprocess.run(self, 'doc', Autobuild.tool(:make), "-j#{parallel_build_level}", target)
68
68
  yield if block_given?
69
69
  end
70
70
  end
@@ -153,7 +153,7 @@ module Autobuild
153
153
  if full_reconfigures?
154
154
  FileUtils.rm_f configurestamp
155
155
  end
156
- Subprocess.run(name, 'configure', *command)
156
+ Subprocess.run(self, 'configure', *command)
157
157
  super
158
158
  end
159
159
  end
@@ -163,9 +163,9 @@ module Autobuild
163
163
  Dir.chdir(builddir) do
164
164
  Autobuild.progress_with_value "building #{name}"
165
165
  if always_reconfigure || !File.file?('Makefile')
166
- Subprocess.run(name, 'build', Autobuild.tool(:cmake), '.')
166
+ Subprocess.run(self, 'build', Autobuild.tool(:cmake), '.')
167
167
  end
168
- Subprocess.run(name, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}") do |line|
168
+ Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}") do |line|
169
169
  if line =~ /\[\s+(\d+)%\]/
170
170
  Autobuild.progress_value Integer($1)
171
171
  end
@@ -178,7 +178,7 @@ module Autobuild
178
178
  def install
179
179
  Dir.chdir(builddir) do
180
180
  Autobuild.progress "installing #{name}"
181
- Subprocess.run(name, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
181
+ Subprocess.run(self, 'build', Autobuild.tool(:make), "-j#{parallel_build_level}", 'install')
182
182
  Autobuild.update_environment prefix
183
183
  end
184
184
  super
@@ -136,7 +136,7 @@ module Autobuild
136
136
  file genomstamp => srcdir do
137
137
  Dir.chdir(srcdir) do
138
138
  Autobuild.progress "generating GenoM files for #{name}"
139
- Subprocess.run(name, 'genom', *cmdline)
139
+ Subprocess.run(self, 'genom', *cmdline)
140
140
  end
141
141
  end
142
142
 
@@ -146,7 +146,7 @@ module Autobuild
146
146
  # since the generation takes care of rebuilding configure
147
147
  # if .gen has changed
148
148
  Autobuild.progress "generating build system for #{name}"
149
- Dir.chdir(srcdir) { Subprocess.run(name, 'genom', File.expand_path('autogen')) }
149
+ Dir.chdir(srcdir) { Subprocess.run(self, 'genom', File.expand_path('autogen')) }
150
150
  end
151
151
 
152
152
  super("#{srcdir}/autoconf/configure.ac")
@@ -49,6 +49,8 @@ module Autobuild
49
49
  end
50
50
  end
51
51
 
52
+ attr_reader :orogen_file
53
+ attr_reader :base_dir
52
54
  attr_reader :project_name, :dependencies, :provides
53
55
  def self.load(pkg, file)
54
56
  FakeOrogenEnvironment.new(pkg).load(file)
@@ -64,6 +66,8 @@ module Autobuild
64
66
  end
65
67
 
66
68
  def load(file)
69
+ @orogen_file = file
70
+ @base_dir = File.dirname(file)
67
71
  Kernel.eval(File.read(file), binding)
68
72
  self
69
73
  end
@@ -76,6 +80,11 @@ module Autobuild
76
80
  @dependencies.concat(names)
77
81
  nil
78
82
  end
83
+ def import_types_from(name)
84
+ if !File.file?(File.join(base_dir, name)) && name.downcase !~ /\.(hh|hpp|h)/
85
+ using_toolkit name
86
+ end
87
+ end
79
88
  def using_toolkit(*names)
80
89
  names = names.map { |n| "#{n}-toolkit-#{pkg.orocos_target}" }
81
90
  @dependencies.concat(names)
@@ -141,6 +150,17 @@ module Autobuild
141
150
  end
142
151
  end
143
152
 
153
+ def self.orogen_root
154
+ if @orogen_root.nil?
155
+ @orogen_root = `orogen --base-dir 2>&1`
156
+ if @orogen_root.empty?
157
+ @orogen_root = false
158
+ end
159
+ else
160
+ @orogen_root
161
+ end
162
+ end
163
+
144
164
  attr_writer :orocos_target
145
165
  def orocos_target
146
166
  if @orocos_target.nil?
@@ -206,16 +226,22 @@ module Autobuild
206
226
  end
207
227
  end
208
228
 
209
- # Find out where orogen is, and make sure the configurestamp depend
210
- # on it. Ignore if orogen is too old to have a --base-dir option
211
- orogen_root = `orogen --base-dir 2>&1`
212
- if !orogen_root.empty?
213
- orogen_root = orogen_root.split[0].chomp
214
- if File.directory?(orogen_root)
215
- orogen_root = File.join(orogen_root, 'orogen')
216
- file genstamp => Autobuild.source_tree(orogen_root)
229
+ # Check if there is an orogen package registered. If it is the case,
230
+ # simply depend on it. Otherwise, look out for orogen --base-dir
231
+ if Autobuild::Package['orogen']
232
+ depends_on "orogen"
233
+ else
234
+ # Find out where orogen is, and make sure the configurestamp depend
235
+ # on it. Ignore if orogen is too old to have a --base-dir option
236
+ if orogen_root = self.class.orogen_root
237
+ orogen_root = orogen_root.split[0].chomp
238
+ if File.directory?(orogen_root)
239
+ orogen_root = File.join(orogen_root, 'orogen')
240
+ file genstamp => Autobuild.source_tree(orogen_root)
241
+ end
217
242
  end
218
243
  end
244
+
219
245
  file configurestamp => genstamp
220
246
  file genstamp => File.join(srcdir, orogen_file) do
221
247
  regen
@@ -230,7 +256,7 @@ module Autobuild
230
256
 
231
257
  Autobuild.progress "generating oroGen project #{name}"
232
258
  Dir.chdir(srcdir) do
233
- Subprocess.run name, 'orogen', *cmdline
259
+ Subprocess.run self, 'orogen', *cmdline
234
260
  Autobuild.touch_stamp genstamp
235
261
  end
236
262
  end
@@ -72,14 +72,22 @@ module Autobuild::Subprocess
72
72
  command.reject! { |o| o.nil? || (o.respond_to?(:empty?) && o.empty?) }
73
73
  command.collect! { |o| o.to_s }
74
74
 
75
- FileUtils.mkdir_p Autobuild.logdir unless File.directory?(Autobuild.logdir)
76
- logname = "#{Autobuild.logdir}/#{target}-#{phase}.log"
75
+ target_name = if target.respond_to?(:name)
76
+ target.name
77
+ else target.to_str
78
+ end
79
+ logdir = if target.respond_to?(:logdir)
80
+ target.logdir
81
+ else Autobuild.logdir
82
+ end
83
+
84
+ logname = "#{logdir}/#{target_name}-#{phase}.log"
77
85
  if !File.directory?(File.dirname(logname))
78
86
  FileUtils.mkdir_p File.dirname(logname)
79
87
  end
80
88
 
81
89
  if Autobuild.verbose
82
- puts "#{target}: running #{command.join(" ")}\n (output goes to #{logname})"
90
+ puts "#{target_name}: running #{command.join(" ")}\n (output goes to #{logname})"
83
91
  end
84
92
 
85
93
  input_streams = command.collect { |o| $1 if o =~ /^\<(.+)/ }.compact
@@ -188,12 +196,12 @@ module Autobuild::Subprocess
188
196
  childstatus
189
197
  end
190
198
 
191
- if status.exitstatus > 0
199
+ if !status.exitstatus || status.exitstatus > 0
192
200
  raise Failed.new(status.exitstatus), "'#{command.join(' ')}' returned status #{status.exitstatus}"
193
201
  end
194
202
 
195
203
  rescue Failed => e
196
- error = Autobuild::SubcommandFailed.new(target, command.join(" "), logname, e.status)
204
+ error = Autobuild::SubcommandFailed.new(target_name, command.join(" "), logname, e.status)
197
205
  error.phase = phase
198
206
  raise error, e.message
199
207
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: autobuild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-26 00:00:00 +01:00
12
+ date: 2009-12-07 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency