autoproj 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt ADDED
@@ -0,0 +1,2 @@
1
+ = Version 1.0
2
+ * initial release
data/Manifest.txt ADDED
@@ -0,0 +1,37 @@
1
+ History.txt
2
+ Manifest.txt
3
+ README.txt
4
+ Rakefile
5
+ bin/autoproj
6
+ doc/guide/config.yaml
7
+ doc/guide/ext/init.rb
8
+ doc/guide/ext/previous_next.rb
9
+ doc/guide/ext/rdoc_links.rb
10
+ doc/guide/src/autobuild.page
11
+ doc/guide/src/autoproj_bootstrap
12
+ doc/guide/src/default.css
13
+ doc/guide/src/default.template
14
+ doc/guide/src/htmldoc.metainfo
15
+ doc/guide/src/images/bodybg.png
16
+ doc/guide/src/images/contbg.png
17
+ doc/guide/src/images/footerbg.png
18
+ doc/guide/src/images/gradient1.png
19
+ doc/guide/src/images/gradient2.png
20
+ doc/guide/src/index.page
21
+ doc/guide/src/source_yml.page
22
+ doc/guide/src/structure.page
23
+ lib/autoproj.rb
24
+ lib/autoproj/autobuild.rb
25
+ lib/autoproj/default.osdeps
26
+ lib/autoproj/manifest.rb
27
+ lib/autoproj/options.rb
28
+ lib/autoproj/osdeps.rb
29
+ lib/autoproj/system.rb
30
+ lib/autoproj/version.rb
31
+ samples/manifest
32
+ samples/manifest.xml
33
+ samples/osdeps.yml
34
+ test/data/test_manifest/autoproj/local/local.autobuild
35
+ test/data/test_manifest/autoproj/manifest
36
+ test/test_debian.rb
37
+ test/test_manifest.rb
data/README.txt ADDED
@@ -0,0 +1,79 @@
1
+ What is Autoproj
2
+ ----------------
3
+ Autoproj allows to easily install and maintain software that is under source
4
+ code form (usually from a version control system). It has been designed to support a
5
+ package-oriented development process, where each package can have its own
6
+ version control repository (think "distributed version control"). It also
7
+ provides an easy integration of the local operating system (Debian, Ubuntu,
8
+ Fedora, maybe MacOSX at some point).
9
+
10
+ This tool has been developped in the frame of the RubyInMotion project
11
+ (http://sites.google.com/site/rubyinmotion), to install robotics-related
12
+ software -- that is often bleeding edge. Unlike [the ROS build
13
+ system](http://ros.org), it is not bound to one build system, one VCS and one
14
+ integration framework. The philosophy behind autoproj
15
+ is:
16
+ * supports both CMake and autotools, and can be adapted to other tools
17
+ * supports different VCS: cvs, svn, git, plain tarballs.
18
+ * software packages are plain packages, meaning that they can be built and
19
+ installed /outside/ an autoproj tree, and are not tied *at all* to the
20
+ autoproj build system.
21
+ * leverage the actual OS package management system. Right now, only Debian-like
22
+ systems (like Ubuntu) are supported, simply because it is the only one I have
23
+ access to.
24
+ * handle code generation properly
25
+
26
+ It tries as much as possible to follow the lead of Willow Garage on the package
27
+ specification. More specifically, the package manifest files are common between
28
+ ROS package management and autoproj (more details in the following of this
29
+ document).
30
+
31
+ Components of an Autoproj installation
32
+ -------------------------------------
33
+ A autoproj installation is seeded by _package sets_. A package set is a local or remote
34
+ directory in which there is:
35
+ * autobuild scripts that describe what can be built and how it should be built.
36
+ These scripts an also list a set of configuration options that allow to
37
+ parametrize the build. In general, there should be only a limited number of
38
+ such options.
39
+ * a source.yml file which describes the package set itself, and where the software
40
+ packages are located (what version control system and what URL).
41
+ * optionally, a file that describe prepackaged dependencies that can be
42
+ installed by using the operating system package management system.
43
+
44
+ Bootstrapping
45
+ -------------
46
+ "Bootstrapping" means getting autoproj itself before it can work its magic ...
47
+ The canonical way is the following:
48
+
49
+ * install Ruby by yourself. On Debian or Ubuntu, this is done with
50
+ done with
51
+
52
+ sudo apt-get install wget ruby
53
+ {.cmdline}
54
+
55
+ * then, [download this script](autoproj_bootstrap) *in the directory where
56
+ you want to create an autoproj installation*, and run it. This can be done with
57
+
58
+ wget http://doudou.github.com/autoproj/autoproj\_bootstrap <br />
59
+ ruby autoproj\_bootstrap
60
+ {.cmdline}
61
+
62
+ * follow the instructions printed by the script above :)
63
+
64
+ Software packages in Autoproj
65
+ -----------------------------
66
+ In the realm of autoproj, a software package should be a self-contained build
67
+ system, that could be built outside of an autoproj tree. In practice, it means
68
+ that the package writer should leverage its build system (for instance, cmake)
69
+ to discover if the package dependencies are installed, and what are the
70
+ appropriate build options that should be given (for instance, include
71
+ directories or library names).
72
+
73
+ As a guideline, we recommend that inter-package dependencies are managed by
74
+ using pkg-config.
75
+
76
+ To describe the package, and more importantly to setup cross-package
77
+ dependencies, an optional manifest file can be added. This manifest file is
78
+ named manifest.xml. Its format is described later in this user's guide.
79
+
data/Rakefile ADDED
@@ -0,0 +1,84 @@
1
+ $LOAD_PATH.unshift File.join(Dir.pwd, 'lib')
2
+
3
+ begin
4
+ require 'hoe'
5
+ namespace 'dist' do
6
+ config = Hoe.spec 'autoproj' do
7
+ self.developer "Sylvain Joyeux", "sylvain.joyeux@dfki.de"
8
+
9
+ self.rubyforge_name = 'autobuild'
10
+ self.summary = 'Easy installation and management of robotics software'
11
+ self.description = paragraphs_of('README.txt', 0..1).join("\n\n")
12
+ self.changes = paragraphs_of('History.txt', 0..1).join("\n\n")
13
+
14
+ extra_deps <<
15
+ ['autobuild', '>= 1.3.0'] <<
16
+ ['rmail', '>= 1.0.0'] <<
17
+ ['utilrb', '>= 1.3.3'] <<
18
+ ['nokogiri', '>= 1.3.3'] <<
19
+ ['highline', '>= 1.5.0']
20
+
21
+ extra_dev_deps <<
22
+ ['webgen', '>= 0.5.9'] <<
23
+ ['rdoc', '>= 2.4.0']
24
+ end
25
+
26
+ desc "generate the bootstrap script"
27
+ task 'bootstrap' do
28
+ osdeps_code = File.read(File.join(Dir.pwd, 'lib', 'autoproj', 'osdeps.rb'))
29
+ bootstrap_code = File.read(File.join(Dir.pwd, 'bin', 'autoproj_bootstrap.in')).
30
+ gsub('OSDEPS_CODE', osdeps_code)
31
+ File.open(File.join(Dir.pwd, 'doc', 'guide', 'src', 'autoproj_bootstrap'), 'w') do |io|
32
+ io.write bootstrap_code
33
+ end
34
+ end
35
+ end
36
+
37
+ # Define our own documentation handling. Rake.clear_tasks is defined by Hoe
38
+ Rake.clear_tasks(/dist:(re|clobber_|)docs/)
39
+
40
+ rescue LoadError
41
+ STDERR.puts "cannot load the Hoe gem. Distribution is disabled"
42
+ rescue Exception => e
43
+ STDERR.puts "cannot load the Hoe gem, or Hoe fails. Distribution is disabled"
44
+ STDERR.puts "error message is: #{e.message}"
45
+ end
46
+
47
+ do_doc = begin
48
+ require 'webgen/webgentask'
49
+ require 'rdoc/task'
50
+ true
51
+ rescue LoadError => e
52
+ STDERR.puts "ERROR: cannot load webgen and/or RDoc, documentation generation disabled"
53
+ STDERR.puts "ERROR: #{e.message}"
54
+ end
55
+
56
+ if do_doc
57
+ task 'doc' => 'doc:all'
58
+ task 'clobber_docs' => 'doc:clobber'
59
+ task 'redocs' do
60
+ Rake::Task['doc:clobber'].invoke
61
+ Rake::Task['doc'].invoke
62
+ end
63
+
64
+ namespace 'doc' do
65
+ task 'all' => %w{guide api}
66
+ task 'clobber' => 'clobber_guide'
67
+ Webgen::WebgenTask.new('guide') do |website|
68
+ website.clobber_outdir = true
69
+ website.directory = File.join(Dir.pwd, 'doc', 'guide')
70
+ website.config_block = lambda do |config|
71
+ config['output'] = ['Webgen::Output::FileSystem', File.join(Dir.pwd, 'doc', 'html')]
72
+ end
73
+ end
74
+ task 'guide' => 'dist:bootstrap'
75
+ RDoc::Task.new("api") do |rdoc|
76
+ rdoc.rdoc_dir = 'doc/html/api'
77
+ rdoc.title = "oroGen"
78
+ rdoc.options << '--show-hash'
79
+ rdoc.rdoc_files.include('lib/**/*.rb')
80
+ end
81
+ end
82
+ end
83
+
84
+
data/bin/autoproj ADDED
@@ -0,0 +1,465 @@
1
+ #! /usr/bin/env ruby
2
+
3
+ require 'autoproj'
4
+ require 'autoproj/autobuild'
5
+ require 'open-uri'
6
+
7
+ require 'highline'
8
+ include Autoproj
9
+
10
+ InputError = Autoproj::InputError
11
+ module Autoproj
12
+ @verbose = false
13
+ @console = HighLine.new
14
+
15
+ class << self
16
+ attr_accessor :verbose
17
+ attr_reader :console
18
+ end
19
+ end
20
+
21
+ # Some configuration variables
22
+ mail_config = Hash.new
23
+ only_update_sources = false
24
+ only_do_status = false
25
+ no_os_deps = false
26
+ debug = false
27
+
28
+ # Parse the configuration options
29
+ parser = OptionParser.new do |opts|
30
+ opts.banner = <<-EOBANNER
31
+ autoproj mode [options]
32
+ where 'mode' is one of:
33
+ build: import, build and install all selected packages
34
+ doc: generate and install documentation for packages that have some
35
+ update: only import/update packages, do not build them
36
+ status: displays the state of the packages w.r.t. their source VCS
37
+ bootstrap: starts a new autoproj installation. Usage:
38
+ autoproj bootstrap [manifest_url|source_vcs source_url opt1=value1 opt2=value2 ...]
39
+
40
+ list-sources: list all available sources
41
+ update-sources: update all remote sources, but do not build
42
+
43
+ Additional options:
44
+ EOBANNER
45
+ opts.on("--reconfigure", "re-ask all configuration options (build mode only)") do
46
+ Autoproj.reconfigure = true
47
+ end
48
+ opts.on("--no-update", "do not update already checked-out sources (build mode only)") do
49
+ Autobuild.do_update = false
50
+ end
51
+
52
+ opts.on("--no-osdeps", "do not install prepackaged dependencies") do
53
+ no_os_deps = true
54
+ end
55
+
56
+ opts.on("--verbose", "verbose output") do
57
+ Autoproj.verbose = true
58
+ Autobuild.verbose = true
59
+ Rake.application.options.trace = false
60
+ end
61
+ opts.on("--debug", "debugging output") do
62
+ Autoproj.verbose = true
63
+ Autobuild.verbose = true
64
+ Rake.application.options.trace = true
65
+ debug = true
66
+ end
67
+ opts.on('--nice NICE', Integer, 'nice the subprocesses to the given value') do |value|
68
+ Autobuild.nice = value
69
+ end
70
+ opts.on("-h", "--help", "Show this message") do
71
+ puts opts
72
+ exit
73
+ end
74
+ opts.on("--mail-from EMAIL", String, "From: field of the sent mails") do |from_email|
75
+ mail[:from] = from_email
76
+ end
77
+ opts.on("--mail-to EMAILS", String, "comma-separated list of emails to which the reports should be sent") do |emails|
78
+ mail[:to] ||= []
79
+ mail[:to] += emails.split(',')
80
+ end
81
+ opts.on("--mail-subject SUBJECT", String, "Subject: field of the sent mails") do |subject_email|
82
+ mail[:subject] = subject_email
83
+ end
84
+ opts.on("--mail-smtp HOSTNAME", String, " address of the mail server written as hostname[:port]") do |smtp|
85
+ raise "invalid SMTP specification #{smtp}" unless smtp =~ /^([^:]+)(?::(\d+))?$/
86
+ mail[:smtp] = $1
87
+ mail[:port] = Integer($2) if $2 && !$2.empty?
88
+ end
89
+ opts.on("--mail-only-errors", "send mail only on errors") do
90
+ mail[:only_errors] = true
91
+ end
92
+ end
93
+
94
+ args = ARGV.dup
95
+ parser.parse!(args)
96
+ mode = args.shift
97
+ selected_packages = args.dup
98
+
99
+ def color(*args)
100
+ Autoproj.console.color(*args)
101
+ end
102
+
103
+ def do_status(packages)
104
+ console = Autoproj.console
105
+
106
+ Autobuild::Reporting.report do
107
+ last_was_in_sync = false
108
+ packages.sort.each do |pkg|
109
+ pkg = Autobuild::Package[pkg]
110
+
111
+ if !pkg.importer.respond_to?(:status)
112
+ # This importer does not support status display
113
+ STDERR.puts color(" this package's importer does not support status display", :bold, :red)
114
+ next
115
+ end
116
+
117
+ lines = []
118
+ status = pkg.importer.status(pkg)
119
+ if status.uncommitted_code
120
+ lines << color(" contains uncommitted modifications", :red)
121
+ end
122
+
123
+ case status.status
124
+ when Autobuild::Importer::Status::UP_TO_DATE
125
+ if !status.uncommitted_code
126
+ if last_was_in_sync
127
+ STDERR.print ", #{pkg.name}"
128
+ else
129
+ STDERR.print pkg.name
130
+ end
131
+ last_was_in_sync = true
132
+ next
133
+ else
134
+ lines << color(" local and remote are in sync", :green)
135
+ end
136
+ when Autobuild::Importer::Status::ADVANCED
137
+ lines << color(" local contains #{status.local_commits.size} commit that remote does not have:", :magenta)
138
+ status.local_commits.each do |line|
139
+ lines << color(" #{line}", :magenta)
140
+ end
141
+ when Autobuild::Importer::Status::SIMPLE_UPDATE
142
+ lines << color(" remote contains #{status.remote_commits.size} commit that local does not have:", :magenta)
143
+ status.remote_commits.each do |line|
144
+ lines << color(" #{line}", :magenta)
145
+ end
146
+ when Autobuild::Importer::Status::NEEDS_MERGE
147
+ lines << color(" local and remote have diverged with respectively #{status.local_commits.size} and #{status.remote_commits.size} commits each", :magenta)
148
+ lines << " -- local commits --"
149
+ status.local_commits.each do |line|
150
+ lines << color(" #{line}", :magenta)
151
+ end
152
+ lines << " -- remote commits --"
153
+ status.remote_commits.each do |line|
154
+ lines << color(" #{line}", :magenta)
155
+ end
156
+ end
157
+
158
+ if last_was_in_sync
159
+ STDERR.puts color(": local and remote are in sync", :green)
160
+ end
161
+
162
+ last_was_in_sync = false
163
+ STDERR.print "#{pkg.name}:"
164
+
165
+ if lines.size == 1
166
+ STDERR.puts lines.first
167
+ else
168
+ STDERR.puts
169
+ STDERR.puts lines.join("\n")
170
+ end
171
+ end
172
+ if last_was_in_sync
173
+ STDERR.puts color(": local and remote are in sync", :green)
174
+ end
175
+ end
176
+ end
177
+
178
+
179
+ def do_bootstrap(*args)
180
+ if args.empty? # no argument, simply add a manifest template
181
+ sample_dir = File.expand_path(File.join("..", "samples"), File.dirname(__FILE__))
182
+ FileUtils.mkdir_p "autoproj"
183
+ manifest_data = File.read(File.join(sample_dir, "manifest"))
184
+
185
+ elsif args.size == 1 # must be a manifest file
186
+ manifest_url = args.first
187
+ STDERR.puts color("autoproj: downloading manifest file #{manifest_url}", :bold)
188
+ manifest_data = open(manifest_url) { |file| file.read }
189
+
190
+ else # must be a source definition
191
+ manifest_data = <<-EOF
192
+ sources:
193
+ - type: #{args.shift}
194
+ url: #{args.shift}
195
+ EOF
196
+ while !args.empty?
197
+ name, value = args.shift.split("=")
198
+ manifest_data << " #{name}: #{value}\n"
199
+ end
200
+
201
+ end
202
+
203
+ File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
204
+ io.write(manifest_data)
205
+ end
206
+ end
207
+
208
+ case mode
209
+ when "bootstrap"
210
+ # If there is no argument, We need one more argument. It is either a VCS type or a path to a
211
+ # manifest.
212
+ #
213
+ # In the first case, we create a new manifest and add the source given on
214
+ # the command line to it. In the second case, we simply use it as a
215
+ # manifest.
216
+ do_bootstrap(*args)
217
+ only_update_sources = true
218
+
219
+ when "build"
220
+ when "update"
221
+ Autobuild.do_build = false
222
+ when "status"
223
+ only_do_status = true
224
+ Autobuild.do_update = false
225
+ no_os_deps = true
226
+ when "update-sources"
227
+ only_update_sources = true
228
+ when "list-sources"
229
+ only_update_sources = true
230
+ Autobuild.do_update = false
231
+
232
+ when "doc"
233
+ Autobuild.do_update = false
234
+ Autobuild.do_doc = true
235
+ Autobuild.only_doc = true
236
+ else
237
+ puts parser
238
+ exit(1)
239
+ end
240
+
241
+ # Find the autoproj root dir
242
+ root_dir = Autoproj.root_dir
243
+ # Load user configuration
244
+ Autoproj.load_config
245
+ # Set the initial environment
246
+ Autoproj.set_initial_env
247
+ # Set up some important autobuild parameters
248
+ Autobuild.prefix = Autoproj.build_dir
249
+ Autobuild.srcdir = root_dir
250
+ Autobuild.doc_errors = false
251
+ Autobuild.do_doc = false
252
+ Autobuild::Reporting << Autoproj::Reporter.new
253
+ if mail_config[:to]
254
+ Autobuild::Reporting << MailReporter.new(mail_config)
255
+ end
256
+
257
+
258
+ Dir.chdir(root_dir)
259
+ begin
260
+ # Load the installation's manifest
261
+ manifest = Autoproj.manifest = Manifest.load(File.join('autoproj', 'manifest'))
262
+ source_os_dependencies = manifest.each_remote_source(false).
263
+ inject(Set.new) do |set, source|
264
+ set << source.vcs.type if !source.local?
265
+ end
266
+
267
+ # If we need to install some packages to import our remote sources, do it
268
+ if !no_os_deps && !source_os_dependencies.empty?
269
+ STDERR.puts color("autoproj: installing prepackaged dependencies to access the source definitions", :bold)
270
+ osdeps = manifest.known_os_packages
271
+ osdeps.install(source_os_dependencies)
272
+ end
273
+
274
+ # Update the remote sources if there are any
275
+ if manifest.has_remote_sources?
276
+ STDERR.puts color("autoproj: updating remote sources", :bold)
277
+ Autobuild::Reporting.report do
278
+ manifest.update_remote_sources
279
+ end
280
+ STDERR.puts
281
+ end
282
+
283
+ # If in verbose mode, or if we only update sources, list the sources
284
+ #
285
+ # Note that we can't have the Manifest class load the source.yml file, as it
286
+ # cannot resolve all constants. So we need to do it ourselves to get the
287
+ # name ...
288
+ if Autoproj.verbose || only_update_sources
289
+ sources = manifest.each_source(false).to_a
290
+
291
+ if sources.empty?
292
+ STDERR.puts color("autoproj: no sources defined in autoproj/manifest", :bold, :red)
293
+ else
294
+ STDERR.puts color("autoproj: available sources", :bold)
295
+ manifest.each_source(false) do |source|
296
+ source_yml = source.raw_description_file
297
+ STDERR.puts " #{source_yml['name']}"
298
+ if source.local?
299
+ STDERR.puts " local source in #{source.local_dir}"
300
+ else
301
+ STDERR.puts " vcs: #{source.vcs}, #{source.vcs.options.inspect}"
302
+ STDERR.puts " local: #{source.local_dir}"
303
+ end
304
+ end
305
+ end
306
+ end
307
+ if only_update_sources
308
+ exit(0)
309
+ end
310
+
311
+ # Load init.rb files. each_source must not load the source.yml file, as
312
+ # init.rb may define configuration options that are used there
313
+ manifest.each_source(false) do |source|
314
+ init_rb = File.join(source.local_dir, "init.rb")
315
+ if File.exists?(init_rb)
316
+ load init_rb
317
+ end
318
+ end
319
+
320
+ # Load the required autobuild definitions
321
+ STDERR.puts color("autoproj: loading build files and configuring build", :bold)
322
+ if !Autoproj.reconfigure?
323
+ STDERR.puts color("run 'autoproj --reconfigure' to change configuration values", :bold)
324
+ end
325
+ manifest.each_autobuild_file do |source, name|
326
+ Autoproj.import_autobuild_file source, name
327
+ end
328
+
329
+ # The user is asked for configuration values both during the manifest
330
+ # loading and the loading of autobuild files. Save it now.
331
+ Autoproj.save_config
332
+
333
+ # Now, load the package's importer configurations (from the various
334
+ # source.yml files)
335
+ manifest.load_importers
336
+ if Autoproj.verbose
337
+ # List defined packages, and in which autobuild files they are defined
338
+ STDERR.puts "Available packages:"
339
+ Autoproj.manifest.packages.each_value do |package, source, file|
340
+ STDERR.puts " #{package.name}: #{file} from #{source.name}"
341
+ end
342
+ end
343
+
344
+ # Create the build target from the manifest if the user did not provide an
345
+ # explicit one
346
+ if selected_packages.empty?
347
+ selected_packages = Autoproj.manifest.default_packages
348
+ end
349
+ if Autoproj.verbose
350
+ STDERR.puts "will install #{selected_packages.to_a.join(", ")}"
351
+ end
352
+ if selected_packages.empty? # no packages, terminate
353
+ STDERR.puts
354
+ STDERR.puts color("autoproj: no packages defined", :red)
355
+ exit 0
356
+ end
357
+ selected_packages = selected_packages.to_set
358
+
359
+ # Install prepackaged dependencies needed to import and build the packages
360
+ if !no_os_deps
361
+ STDERR.puts
362
+ STDERR.puts color("autoproj: installing prepackaged dependencies for build system & version control", :bold)
363
+ osdeps = manifest.known_os_packages
364
+ osdeps.install(Autoproj.build_system_dependencies - source_os_dependencies)
365
+ end
366
+
367
+ # Now starts a different stage of the whole build. Until now, we were
368
+ # working on the whole package set. Starting from now, we need to build the
369
+ # package sets based on the layout file
370
+ Autoproj.manifest.each_package_set(selected_packages) do |name, packages, enabled_packages|
371
+ srcdir = File.join(Autoproj.root_dir, name)
372
+ prefix = File.join(Autoproj.build_dir, name)
373
+ logdir = File.join(prefix, "log")
374
+ Autobuild.logdir = logdir
375
+ packages.each do |pkg_name|
376
+ pkg = Autobuild::Package[pkg_name]
377
+ pkg.srcdir = File.join(srcdir, pkg_name)
378
+ pkg.prefix = prefix
379
+ pkg.logdir = logdir
380
+ end
381
+
382
+ # We are doing a status, now is the right time
383
+ STDERR.puts
384
+ if only_do_status
385
+ do_status(packages)
386
+ next
387
+ end
388
+
389
+
390
+ # ... but build only the selected packages (and avoid display of
391
+ # progress messages if there is nothing to build)
392
+ if !enabled_packages.empty?
393
+ STDERR.puts
394
+ STDERR.puts color("autoproj: now building #{name}", :bold)
395
+
396
+ STDERR.puts color(" updating packages", :bold)
397
+ Autobuild::Reporting.report do
398
+ import_targets = enabled_packages.map { |pkg| "#{pkg}-import" }
399
+ task "autoproj-#{name}-import" => import_targets
400
+ Rake::Task["autoproj-#{name}-import"].invoke
401
+ end
402
+
403
+ # Load package manifests, apply dependencies to the autobuild definitions
404
+ # and install OS packages
405
+ manifest.load_package_manifests(packages)
406
+ if !no_os_deps
407
+ STDERR.puts color(" installing prepackaged dependencies", :bold)
408
+ manifest.install_os_dependencies
409
+ end
410
+
411
+ # Call the prepare target now, after we did the import *and* loaded
412
+ # the manifests
413
+ Autobuild::Reporting.report do
414
+ prepare_targets = enabled_packages.map { |pkg| "#{pkg}-prepare" }
415
+ task "autoproj-#{name}-prepare" => prepare_targets
416
+ Rake::Task["autoproj-#{name}-prepare"].invoke
417
+ end
418
+
419
+ # And now build
420
+ if Autobuild.only_doc
421
+ STDERR.puts color(" building and installing documentation", :bold)
422
+ else
423
+ STDERR.puts color(" building and installing packages", :bold)
424
+ end
425
+
426
+ Autobuild::Reporting.report do
427
+ Autobuild.apply(enabled_packages, "autoproj-#{name}")
428
+ Autobuild::Reporting.success
429
+ end
430
+ end
431
+
432
+ # Now call the prepare target for all packages as it may be useful for
433
+ # the rest of the builds and for the generation of the env.sh file
434
+ #
435
+ # Note that we don't really have to care about dependencies, but we do
436
+ # it anyway
437
+ old_update_flag = Autobuild.do_update
438
+ begin
439
+ Autobuild.do_update = false
440
+ Autobuild::Reporting.report do
441
+ prepare_targets = (packages - enabled_packages).map { |pkg_name| "#{pkg_name}-prepare" }
442
+ task "autoproj-#{name}-prepare" => prepare_targets
443
+ Rake::Task["autoproj-#{name}-prepare"].invoke
444
+ end
445
+ ensure
446
+ Autobuild.do_update = old_update_flag
447
+ end
448
+
449
+ Autoproj.export_env_sh(name)
450
+ end
451
+
452
+ rescue ConfigError => e
453
+ STDERR.puts
454
+ STDERR.puts color(e.message, :red, :bold)
455
+ if debug then raise
456
+ else exit 1
457
+ end
458
+ rescue Interrupt
459
+ STDERR.puts
460
+ STDERR.puts color("Interrupted by user", :red, :bold)
461
+ if debug then raise
462
+ else exit 1
463
+ end
464
+ end
465
+