autoproj 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Rakefile +2 -0
- data/bin/autoproj +165 -98
- data/doc/guide/src/autoproj_bootstrap +15 -6
- data/doc/guide/src/structure.page +2 -2
- data/lib/autoproj/autobuild.rb +18 -2
- data/lib/autoproj/manifest.rb +61 -18
- data/lib/autoproj/options.rb +7 -3
- data/lib/autoproj/osdeps.rb +5 -2
- data/lib/autoproj/system.rb +9 -3
- data/lib/autoproj/version.rb +1 -1
- data/samples/manifest +1 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,2 +1,9 @@
|
|
1
|
+
= Version 1.1
|
2
|
+
* added some sanity checks, especially w.r.t. an already existing GEM
|
3
|
+
installation
|
4
|
+
* improved the bootstrap
|
5
|
+
* autoproj is now able to track a configuration repository (i.e. a VCS that
|
6
|
+
stores both the installation's manifest and the package sets)
|
7
|
+
|
1
8
|
= Version 1.0
|
2
9
|
* initial release
|
data/Rakefile
CHANGED
@@ -6,6 +6,8 @@ begin
|
|
6
6
|
config = Hoe.spec 'autoproj' do
|
7
7
|
self.developer "Sylvain Joyeux", "sylvain.joyeux@dfki.de"
|
8
8
|
|
9
|
+
self.url = ["http://doudou.github.com/autoproj",
|
10
|
+
"git://github.com/doudou/autoproj.git"]
|
9
11
|
self.rubyforge_name = 'autobuild'
|
10
12
|
self.summary = 'Easy installation and management of robotics software'
|
11
13
|
self.description = paragraphs_of('README.txt', 0..1).join("\n\n")
|
data/bin/autoproj
CHANGED
@@ -37,15 +37,15 @@ where 'mode' is one of:
|
|
37
37
|
bootstrap: starts a new autoproj installation. Usage:
|
38
38
|
autoproj bootstrap [manifest_url|source_vcs source_url opt1=value1 opt2=value2 ...]
|
39
39
|
|
40
|
-
list-
|
41
|
-
update-
|
40
|
+
list-sets: list all available sources
|
41
|
+
update-sets: update all remote sources, but do not build
|
42
42
|
|
43
43
|
Additional options:
|
44
44
|
EOBANNER
|
45
45
|
opts.on("--reconfigure", "re-ask all configuration options (build mode only)") do
|
46
46
|
Autoproj.reconfigure = true
|
47
47
|
end
|
48
|
-
opts.on("--no-update", "do not update already checked-out
|
48
|
+
opts.on("--no-update", "do not update already checked-out packages (build mode only)") do
|
49
49
|
Autobuild.do_update = false
|
50
50
|
end
|
51
51
|
|
@@ -95,6 +95,7 @@ args = ARGV.dup
|
|
95
95
|
parser.parse!(args)
|
96
96
|
mode = args.shift
|
97
97
|
selected_packages = args.dup
|
98
|
+
all_env_sh = Array.new
|
98
99
|
|
99
100
|
def color(*args)
|
100
101
|
Autoproj.console.color(*args)
|
@@ -177,88 +178,130 @@ end
|
|
177
178
|
|
178
179
|
|
179
180
|
def do_bootstrap(*args)
|
181
|
+
if File.exists?(File.join("autoproj", "manifest"))
|
182
|
+
raise ConfigError, "this installation is already bootstrapped. Remove the autoproj directory if it is not the case"
|
183
|
+
end
|
184
|
+
|
180
185
|
if args.empty? # no argument, simply add a manifest template
|
181
186
|
sample_dir = File.expand_path(File.join("..", "samples"), File.dirname(__FILE__))
|
182
|
-
FileUtils.mkdir_p "autoproj"
|
183
187
|
manifest_data = File.read(File.join(sample_dir, "manifest"))
|
188
|
+
FileUtils.mkdir_p "autoproj"
|
189
|
+
File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
|
190
|
+
io.write(manifest_data)
|
191
|
+
end
|
184
192
|
|
185
193
|
elsif args.size == 1 # must be a manifest file
|
186
194
|
manifest_url = args.first
|
187
195
|
STDERR.puts color("autoproj: downloading manifest file #{manifest_url}", :bold)
|
188
|
-
manifest_data =
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
+
manifest_data =
|
197
|
+
begin open(manifest_url) { |file| file.read }
|
198
|
+
rescue
|
199
|
+
raise ConfigError, "cannot read #{manifest_url}, did you mean 'autoproj bootstrap VCSTYPE #{manifest_url}' ?"
|
200
|
+
end
|
201
|
+
|
202
|
+
FileUtils.mkdir_p "autoproj"
|
203
|
+
File.open(File.join(Autoproj.config_dir, "manifest"), "w") do |io|
|
204
|
+
io.write(manifest_data)
|
205
|
+
end
|
206
|
+
|
207
|
+
else # is a VCS definition for the manifest itself ...
|
208
|
+
vcs_def = Hash.new
|
209
|
+
vcs_def[:type] = args.shift
|
210
|
+
vcs_def[:url] = args.shift
|
196
211
|
while !args.empty?
|
197
212
|
name, value = args.shift.split("=")
|
198
|
-
|
213
|
+
vcs_def[name] = value
|
214
|
+
end
|
215
|
+
vcs = Autoproj.normalize_vcs_definition(vcs_def)
|
216
|
+
Autoproj::Manifest.import_whole_installation(vcs, File.join(Dir.pwd, "autoproj"))
|
217
|
+
|
218
|
+
# Now write it in the config file
|
219
|
+
File.open(File.join(Autoproj.config_dir, "config.yml"), "a") do |io|
|
220
|
+
io.puts <<-EOTEXT
|
221
|
+
manifest_source:
|
222
|
+
type: #{vcs_def.delete(:type)}
|
223
|
+
url: #{vcs_def.delete(:url)}
|
224
|
+
#{vcs_def.map { |k, v| "#{k}: #{v}" }.join("\n ")}
|
225
|
+
EOTEXT
|
199
226
|
end
|
200
|
-
|
201
227
|
end
|
228
|
+
end
|
229
|
+
|
230
|
+
# Find the autoproj root dir
|
231
|
+
begin
|
232
|
+
case mode
|
233
|
+
when "bootstrap"
|
234
|
+
# If there is no argument, We need one more argument. It is either a VCS type or a path to a
|
235
|
+
# manifest.
|
236
|
+
#
|
237
|
+
# In the first case, we create a new manifest and add the source given on
|
238
|
+
# the command line to it. In the second case, we simply use it as a
|
239
|
+
# manifest.
|
240
|
+
do_bootstrap(*args)
|
241
|
+
if args.empty?
|
242
|
+
# no package sets defined, we're done
|
243
|
+
exit(0)
|
244
|
+
end
|
245
|
+
only_update_sources = true
|
202
246
|
|
203
|
-
|
204
|
-
|
247
|
+
when "build"
|
248
|
+
when "update"
|
249
|
+
Autobuild.do_build = false
|
250
|
+
when "status"
|
251
|
+
only_do_status = true
|
252
|
+
Autobuild.do_update = false
|
253
|
+
no_os_deps = true
|
254
|
+
when "update-sets"
|
255
|
+
only_update_sources = true
|
256
|
+
when "list-sets"
|
257
|
+
only_update_sources = true
|
258
|
+
Autobuild.do_update = false
|
259
|
+
|
260
|
+
when "doc"
|
261
|
+
Autobuild.do_update = false
|
262
|
+
Autobuild.do_doc = true
|
263
|
+
Autobuild.only_doc = true
|
264
|
+
else
|
265
|
+
puts parser
|
266
|
+
exit(1)
|
205
267
|
end
|
206
|
-
end
|
207
268
|
|
208
|
-
|
209
|
-
|
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
|
269
|
+
root_dir = Autoproj.root_dir
|
270
|
+
Dir.chdir(root_dir)
|
240
271
|
|
241
|
-
#
|
242
|
-
|
243
|
-
#
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
Autobuild
|
253
|
-
|
254
|
-
Autobuild
|
255
|
-
|
272
|
+
# Load user configuration
|
273
|
+
Autoproj.load_config
|
274
|
+
# If we are under rubygems, check that the GEM_HOME is right ...
|
275
|
+
if $LOADED_FEATURES.any? { |l| l =~ /rubygems/ }
|
276
|
+
if ENV['GEM_HOME'] != Autoproj.gem_home
|
277
|
+
raise ConfigError, "RubyGems is already loaded with a different GEM_HOME"
|
278
|
+
end
|
279
|
+
end
|
280
|
+
# Set the initial environment
|
281
|
+
Autoproj.set_initial_env
|
282
|
+
# Set up some important autobuild parameters
|
283
|
+
Autobuild.prefix = Autoproj.build_dir
|
284
|
+
Autobuild.srcdir = root_dir
|
285
|
+
Autobuild.doc_errors = false
|
286
|
+
Autobuild.do_doc = false
|
287
|
+
Autobuild::Reporting << Autoproj::Reporter.new
|
288
|
+
if mail_config[:to]
|
289
|
+
Autobuild::Reporting << MailReporter.new(mail_config)
|
290
|
+
end
|
256
291
|
|
292
|
+
manifest_path = File.join(Autoproj.config_dir, 'manifest')
|
293
|
+
# Load the installation's manifest a first time, to check if we should
|
294
|
+
# update it ... We assume that the OS dependencies for this VCS is already
|
295
|
+
# installed (i.e. that the user did not remove it)
|
296
|
+
manifest = Manifest.load(manifest_path)
|
297
|
+
if manifest.vcs && mode != "bootstrap"
|
298
|
+
Autobuild::Reporting.report do
|
299
|
+
manifest.update_yourself
|
300
|
+
end
|
301
|
+
manifest = Manifest.load(manifest_path)
|
302
|
+
end
|
303
|
+
Autoproj.manifest = manifest
|
257
304
|
|
258
|
-
Dir.chdir(root_dir)
|
259
|
-
begin
|
260
|
-
# Load the installation's manifest
|
261
|
-
manifest = Autoproj.manifest = Manifest.load(File.join('autoproj', 'manifest'))
|
262
305
|
source_os_dependencies = manifest.each_remote_source(false).
|
263
306
|
inject(Set.new) do |set, source|
|
264
307
|
set << source.vcs.type if !source.local?
|
@@ -273,47 +316,23 @@ begin
|
|
273
316
|
|
274
317
|
# Update the remote sources if there are any
|
275
318
|
if manifest.has_remote_sources?
|
276
|
-
STDERR.puts color("autoproj: updating remote
|
319
|
+
STDERR.puts color("autoproj: updating remote definitions of package sets", :bold)
|
277
320
|
Autobuild::Reporting.report do
|
278
321
|
manifest.update_remote_sources
|
279
322
|
end
|
280
323
|
STDERR.puts
|
281
324
|
end
|
282
325
|
|
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
326
|
# Load init.rb files. each_source must not load the source.yml file, as
|
312
327
|
# init.rb may define configuration options that are used there
|
313
328
|
manifest.each_source(false) do |source|
|
314
329
|
init_rb = File.join(source.local_dir, "init.rb")
|
315
330
|
if File.exists?(init_rb)
|
316
|
-
|
331
|
+
begin
|
332
|
+
load init_rb
|
333
|
+
rescue Exception => e
|
334
|
+
Autoproj.filter_load_exception(e, source, init_rb)
|
335
|
+
end
|
317
336
|
end
|
318
337
|
end
|
319
338
|
|
@@ -341,6 +360,41 @@ begin
|
|
341
360
|
end
|
342
361
|
end
|
343
362
|
|
363
|
+
# If in verbose mode, or if we only update sources, list the sources
|
364
|
+
#
|
365
|
+
# Note that we can't have the Manifest class load the source.yml file, as it
|
366
|
+
# cannot resolve all constants. So we need to do it ourselves to get the
|
367
|
+
# name ...
|
368
|
+
if Autoproj.verbose || only_update_sources
|
369
|
+
sources = manifest.each_source(false).to_a
|
370
|
+
|
371
|
+
if sources.empty?
|
372
|
+
STDERR.puts color("autoproj: no package sets defined in autoproj/manifest", :bold, :red)
|
373
|
+
else
|
374
|
+
STDERR.puts color("autoproj: available package sets", :bold)
|
375
|
+
manifest.each_source(false) do |source|
|
376
|
+
source_yml = source.raw_description_file
|
377
|
+
STDERR.puts " #{source_yml['name']}"
|
378
|
+
if source.local?
|
379
|
+
STDERR.puts " local source in #{source.local_dir}"
|
380
|
+
else
|
381
|
+
STDERR.puts " vcs: #{source.vcs}, #{source.vcs.options.inspect}"
|
382
|
+
STDERR.puts " local: #{source.local_dir}"
|
383
|
+
end
|
384
|
+
|
385
|
+
source.each_package.
|
386
|
+
map { |pkg| pkg.name }.
|
387
|
+
sort.
|
388
|
+
each do |name|
|
389
|
+
STDERR.puts " #{name}"
|
390
|
+
end
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
if only_update_sources
|
395
|
+
exit(0)
|
396
|
+
end
|
397
|
+
|
344
398
|
# Create the build target from the manifest if the user did not provide an
|
345
399
|
# explicit one
|
346
400
|
if selected_packages.empty?
|
@@ -446,9 +500,22 @@ begin
|
|
446
500
|
Autobuild.do_update = old_update_flag
|
447
501
|
end
|
448
502
|
|
503
|
+
all_env_sh << name
|
449
504
|
Autoproj.export_env_sh(name)
|
450
505
|
end
|
451
506
|
|
507
|
+
STDERR.puts <<EOTEXT
|
508
|
+
|
509
|
+
|
510
|
+
add the following lines at the bottom of your .bashrc:
|
511
|
+
#{all_env_sh.map { |name| "source #{Dir.pwd}#{name}env.sh" }.join("\n ")}
|
512
|
+
|
513
|
+
WARNING: autoproj will not work until your restart all
|
514
|
+
your consoles, or run the following in them:
|
515
|
+
#{all_env_sh.map { |name| "$ source #{Dir.pwd}#{name}env.sh" }.join("\n ")}
|
516
|
+
|
517
|
+
EOTEXT
|
518
|
+
|
452
519
|
rescue ConfigError => e
|
453
520
|
STDERR.puts
|
454
521
|
STDERR.puts color(e.message, :red, :bold)
|
@@ -1,5 +1,14 @@
|
|
1
1
|
#! /usr/bin/ruby
|
2
2
|
|
3
|
+
ENV['GEM_HOME'] = "#{Dir.pwd}/.gems"
|
4
|
+
ENV['PATH'] = "#{ENV['GEM_HOME']}/bin:#{ENV['PATH']}"
|
5
|
+
if $LOADED_FEATURES.find { |str| str =~ /bygems/ }
|
6
|
+
ENV['RUBYOPT'] = ""
|
7
|
+
exec "ruby", __FILE__
|
8
|
+
end
|
9
|
+
|
10
|
+
ENV['RUBYOPT'] = "-rubygems"
|
11
|
+
|
3
12
|
require 'yaml'
|
4
13
|
require 'set'
|
5
14
|
require 'rubygems'
|
@@ -134,8 +143,11 @@ module Autoproj
|
|
134
143
|
File.open('osdeps.sh', 'w') do |file|
|
135
144
|
file.write shell_script
|
136
145
|
end
|
137
|
-
|
138
|
-
|
146
|
+
begin
|
147
|
+
Autobuild::Subprocess.run 'autoproj', 'osdeps', 'bash', './osdeps.sh'
|
148
|
+
ensure
|
149
|
+
FileUtils.rm_f 'osdeps.sh'
|
150
|
+
end
|
139
151
|
|
140
152
|
# Don't install gems that are already there ...
|
141
153
|
gems.delete_if do |name|
|
@@ -190,16 +202,13 @@ STDERR.puts "autoproj: installing autoproj and its dependencies (this can take a
|
|
190
202
|
osdeps_management.install(packages)
|
191
203
|
|
192
204
|
if ARGV.first != "dev"
|
193
|
-
ENV['RUBYOPT'] = "-rubygems"
|
194
|
-
ENV['GEM_HOME'] = "#{Dir.pwd}/autoproj/gems"
|
195
|
-
ENV['PATH'] = "#{ENV['GEM_HOME']}/bin:$PATH"
|
196
205
|
Autobuild::Subprocess.run('bootstrap', 'post', 'autoproj', 'bootstrap')
|
197
206
|
end
|
198
207
|
|
199
208
|
File.open('env.sh', 'w') do |io|
|
200
209
|
io.write <<-EOSHELL
|
201
210
|
export RUBYOPT=-rubygems
|
202
|
-
export GEM_HOME=#{Dir.pwd}
|
211
|
+
export GEM_HOME=#{Dir.pwd}/.gems
|
203
212
|
export PATH=$GEM_HOME/bin:$PATH
|
204
213
|
EOSHELL
|
205
214
|
end
|
@@ -14,7 +14,7 @@ autoproj-related configuration is saved. The contained files are as follows:
|
|
14
14
|
|
15
15
|
* autoproj/manifest: list of available package sets, layout of the
|
16
16
|
installation. See "Management" below.
|
17
|
-
*
|
17
|
+
* .remotes/\*: package sets that are imported from a remote version
|
18
18
|
control system
|
19
19
|
* autoproj/\*/: local sets, i.e. sets that have not been imported from a remote
|
20
20
|
version control system.
|
@@ -100,7 +100,7 @@ autoproj will still have to checkout new packages, though:
|
|
100
100
|
autoproj build --no-update
|
101
101
|
{.commandline}
|
102
102
|
|
103
|
-
If, on the other hand, you only want to update the
|
103
|
+
If, on the other hand, you only want to update the source code, do
|
104
104
|
|
105
105
|
autoproj update
|
106
106
|
{.commandline}
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -44,11 +44,27 @@ module Autoproj
|
|
44
44
|
end
|
45
45
|
|
46
46
|
@loaded_autobuild_files = Set.new
|
47
|
+
def self.filter_load_exception(error, source, path)
|
48
|
+
raise error if Autoproj.verbose
|
49
|
+
rx_path = Regexp.quote(path)
|
50
|
+
error_line = error.backtrace.find { |l| l =~ /#{rx_path}/ }
|
51
|
+
line_number = Integer(/#{rx_path}:(\d+)/.match(error_line)[1])
|
52
|
+
if source.local?
|
53
|
+
raise ConfigError, "#{path}:#{line_number}: #{error.message}", error.backtrace
|
54
|
+
else
|
55
|
+
raise ConfigError, "#{File.basename(path)}(source=#{source.name}):#{line_number}: #{error.message}", error.backtrace
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
47
59
|
def self.import_autobuild_file(source, path)
|
48
60
|
return if @loaded_autobuild_files.include?(path)
|
49
61
|
|
50
62
|
@file_stack.push([source, File.basename(path)])
|
51
|
-
|
63
|
+
begin
|
64
|
+
load path
|
65
|
+
rescue Exception => e
|
66
|
+
filter_load_exception(e, source, path)
|
67
|
+
end
|
52
68
|
@loaded_autobuild_files << path
|
53
69
|
|
54
70
|
ensure
|
@@ -119,7 +135,7 @@ def ruby_common(pkg)
|
|
119
135
|
end
|
120
136
|
|
121
137
|
pkg.post_install do
|
122
|
-
Autobuild.progress "
|
138
|
+
Autobuild.progress "setting up Ruby package #{pkg.name}"
|
123
139
|
Autobuild.update_environment pkg.srcdir
|
124
140
|
if File.file?('Rakefile')
|
125
141
|
if File.directory?('ext')
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -144,7 +144,7 @@ module Autoproj
|
|
144
144
|
# dependencies that are provided by the operating system (.osdeps file).
|
145
145
|
class Source
|
146
146
|
# The VCSDefinition object that defines the version control holding
|
147
|
-
# information for this source. Local
|
147
|
+
# information for this source. Local package sets (i.e. the ones that are not
|
148
148
|
# under version control) use the 'local' version control name. For them,
|
149
149
|
# local? returns true.
|
150
150
|
attr_accessor :vcs
|
@@ -166,7 +166,7 @@ module Autoproj
|
|
166
166
|
if local?
|
167
167
|
vcs.url
|
168
168
|
else
|
169
|
-
File.join(Autoproj.
|
169
|
+
File.join(Autoproj.remotes_dir, automatic_name)
|
170
170
|
end
|
171
171
|
end
|
172
172
|
|
@@ -179,6 +179,8 @@ module Autoproj
|
|
179
179
|
def name
|
180
180
|
if @source_definition then
|
181
181
|
@source_definition['name'] || automatic_name
|
182
|
+
elsif @name
|
183
|
+
@name
|
182
184
|
else
|
183
185
|
automatic_name
|
184
186
|
end
|
@@ -207,6 +209,12 @@ module Autoproj
|
|
207
209
|
source_definition
|
208
210
|
end
|
209
211
|
|
212
|
+
def load_name
|
213
|
+
definition = raw_description_file
|
214
|
+
@name = definition['name']
|
215
|
+
rescue InternalError
|
216
|
+
end
|
217
|
+
|
210
218
|
# Load the source.yml file that describes this source, and resolve the
|
211
219
|
# $BLABLA values that are in there. Use #raw_description_file to avoid
|
212
220
|
# resolving those values
|
@@ -242,7 +250,7 @@ module Autoproj
|
|
242
250
|
end
|
243
251
|
|
244
252
|
rescue ConfigError => e
|
245
|
-
raise ConfigError, "#{
|
253
|
+
raise ConfigError, "#{File.join(local_dir, "source.yml")}: #{e.message}", e.backtrace
|
246
254
|
end
|
247
255
|
end
|
248
256
|
|
@@ -314,6 +322,18 @@ module Autoproj
|
|
314
322
|
rescue ConfigError => e
|
315
323
|
raise ConfigError, "#{e.message} in the source.yml file of #{name} (#{File.join(local_dir, "source.yml")})", e.backtrace
|
316
324
|
end
|
325
|
+
|
326
|
+
def each_package
|
327
|
+
if !block_given?
|
328
|
+
return enum_for(:each_package)
|
329
|
+
end
|
330
|
+
|
331
|
+
Autoproj.manifest.packages.each do |pkg_name, (pkg, source, file)|
|
332
|
+
if source.name == name
|
333
|
+
yield(pkg)
|
334
|
+
end
|
335
|
+
end
|
336
|
+
end
|
317
337
|
end
|
318
338
|
|
319
339
|
class Manifest
|
@@ -321,6 +341,8 @@ module Autoproj
|
|
321
341
|
def self.load(file)
|
322
342
|
begin
|
323
343
|
data = YAML.load(File.read(file))
|
344
|
+
rescue Errno::ENOENT
|
345
|
+
raise ConfigError, "expected an autoproj configuration in #{File.expand_path(File.dirname(file))}, but #{file} does not exist"
|
324
346
|
rescue ArgumentError => e
|
325
347
|
raise ConfigError, "error in #{file}: #{e.message}"
|
326
348
|
end
|
@@ -344,20 +366,23 @@ module Autoproj
|
|
344
366
|
@data = data
|
345
367
|
@packages = Hash.new
|
346
368
|
@package_manifests = Hash.new
|
369
|
+
|
370
|
+
if Autoproj.has_config_key?('manifest_source')
|
371
|
+
@vcs = Autoproj.normalize_vcs_definition(Autoproj.user_config('manifest_source'))
|
372
|
+
end
|
347
373
|
end
|
348
374
|
|
349
|
-
# Lists the autobuild files that are
|
350
|
-
# manifest
|
375
|
+
# Lists the autobuild files that are in the package sets we know of
|
351
376
|
def each_autobuild_file(source_name = nil, &block)
|
352
377
|
if !block_given?
|
353
378
|
return enum_for(:each_source_file, source_name)
|
354
379
|
end
|
355
380
|
|
356
|
-
# This looks very inefficient, but it is because source names
|
357
|
-
#
|
358
|
-
#
|
381
|
+
# This looks very inefficient, but it is because source names are
|
382
|
+
# contained in source.yml and we must therefore load that file to
|
383
|
+
# check the package set name ...
|
359
384
|
#
|
360
|
-
# And honestly I don't think someone will have 20 000
|
385
|
+
# And honestly I don't think someone will have 20 000 package sets
|
361
386
|
done_something = false
|
362
387
|
each_source do |source|
|
363
388
|
next if source_name && source.name != source_name
|
@@ -389,7 +414,7 @@ module Autoproj
|
|
389
414
|
each_remote_source(false).any? { true }
|
390
415
|
end
|
391
416
|
|
392
|
-
# Like #each_source, but filters out local
|
417
|
+
# Like #each_source, but filters out local package sets
|
393
418
|
def each_remote_source(load_description = true)
|
394
419
|
if !block_given?
|
395
420
|
enum_for(:each_remote_source, load_description)
|
@@ -405,16 +430,16 @@ module Autoproj
|
|
405
430
|
# call-seq:
|
406
431
|
# each_source { |source_description| ... }
|
407
432
|
#
|
408
|
-
# Lists all
|
409
|
-
# object that describes
|
433
|
+
# Lists all package sets defined in this manifest, by yielding a Source
|
434
|
+
# object that describes it.
|
410
435
|
def each_source(load_description = true)
|
411
436
|
if !block_given?
|
412
|
-
return enum_for(:each_source)
|
437
|
+
return enum_for(:each_source, load_description)
|
413
438
|
end
|
414
439
|
|
415
|
-
return if !data['
|
440
|
+
return if !data['package_sets']
|
416
441
|
|
417
|
-
data['
|
442
|
+
data['package_sets'].each do |spec|
|
418
443
|
# Look up for short notation (i.e. not an explicit hash). It is
|
419
444
|
# either vcs_type:url or just url. In the latter case, we expect
|
420
445
|
# 'url' to be a path to a local directory
|
@@ -427,6 +452,9 @@ module Autoproj
|
|
427
452
|
source = Source.new(vcs_def)
|
428
453
|
if source.present? && load_description
|
429
454
|
source.load_description_file
|
455
|
+
else
|
456
|
+
# Try to load just the name from the source.yml file
|
457
|
+
source.load_name
|
430
458
|
end
|
431
459
|
|
432
460
|
yield(source)
|
@@ -458,6 +486,21 @@ module Autoproj
|
|
458
486
|
fake_package = FakePackage.new(source.automatic_name, source.local_dir)
|
459
487
|
|
460
488
|
importer.import(fake_package)
|
489
|
+
rescue Autobuild::ConfigException => e
|
490
|
+
raise ConfigError, e.message, e.backtrace
|
491
|
+
end
|
492
|
+
|
493
|
+
attr_reader :vcs
|
494
|
+
def self.import_whole_installation(vcs, into)
|
495
|
+
importer = vcs.create_autobuild_importer
|
496
|
+
fake_package = FakePackage.new('autoproj main configuration', into)
|
497
|
+
importer.import(fake_package)
|
498
|
+
rescue Autobuild::ConfigException => e
|
499
|
+
raise ConfigError, "cannot import autoproj configuration: #{e.message}", e.backtrace
|
500
|
+
end
|
501
|
+
|
502
|
+
def update_yourself
|
503
|
+
Manifest.import_whole_installation(vcs, Autoproj.config_dir)
|
461
504
|
end
|
462
505
|
|
463
506
|
def update_remote_sources
|
@@ -471,10 +514,10 @@ module Autoproj
|
|
471
514
|
# Sets up the package importers based on the information listed in
|
472
515
|
# the source's source.yml
|
473
516
|
#
|
474
|
-
# The priority logic is that we take the
|
475
|
-
# listed in the autoproj main manifest, and first come first used.
|
517
|
+
# The priority logic is that we take the package sets one by one in the
|
518
|
+
# order listed in the autoproj main manifest, and first come first used.
|
476
519
|
#
|
477
|
-
# A
|
520
|
+
# A set that defines a particular package in its autobuild file
|
478
521
|
# *must* provide the corresponding VCS line in its source.yml file.
|
479
522
|
# However, it is possible for a source that does *not* define a package
|
480
523
|
# to override the VCS
|
data/lib/autoproj/options.rb
CHANGED
@@ -23,8 +23,8 @@ module Autoproj
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def ask(current_value)
|
26
|
-
default_value = if current_value then current_value
|
27
|
-
else options[:default]
|
26
|
+
default_value = if current_value then current_value.to_s
|
27
|
+
else options[:default].to_str
|
28
28
|
end
|
29
29
|
|
30
30
|
STDERR.print " #{doc} [#{default_value}] "
|
@@ -82,7 +82,7 @@ module Autoproj
|
|
82
82
|
if value.nil? || (!seen && Autoproj.reconfigure?)
|
83
83
|
value = configure(key)
|
84
84
|
else
|
85
|
-
if !seen
|
85
|
+
if !seen && @declared_options[key]
|
86
86
|
STDERR.puts " #{@declared_options[key].doc}: #{value}"
|
87
87
|
@user_config[key] = [value, true]
|
88
88
|
end
|
@@ -119,6 +119,10 @@ module Autoproj
|
|
119
119
|
end
|
120
120
|
end
|
121
121
|
|
122
|
+
def self.has_config_key?(name)
|
123
|
+
@user_config.has_key?(name)
|
124
|
+
end
|
125
|
+
|
122
126
|
def self.load_config
|
123
127
|
config_file = File.join(Autoproj.config_dir, "config.yml")
|
124
128
|
if File.exists?(config_file)
|
data/lib/autoproj/osdeps.rb
CHANGED
@@ -110,8 +110,11 @@ module Autoproj
|
|
110
110
|
File.open('osdeps.sh', 'w') do |file|
|
111
111
|
file.write shell_script
|
112
112
|
end
|
113
|
-
|
114
|
-
|
113
|
+
begin
|
114
|
+
Autobuild::Subprocess.run 'autoproj', 'osdeps', 'bash', './osdeps.sh'
|
115
|
+
ensure
|
116
|
+
FileUtils.rm_f 'osdeps.sh'
|
117
|
+
end
|
115
118
|
|
116
119
|
# Don't install gems that are already there ...
|
117
120
|
gems.delete_if do |name|
|
data/lib/autoproj/system.rb
CHANGED
@@ -37,11 +37,17 @@ module Autoproj
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
+
def self.remotes_dir
|
41
|
+
File.join(root_dir, ".remotes")
|
42
|
+
end
|
43
|
+
def self.gem_home
|
44
|
+
File.join(root_dir, ".gems")
|
45
|
+
end
|
46
|
+
|
40
47
|
def self.set_initial_env
|
41
|
-
gem_home = File.join(Autoproj.config_dir, "gems")
|
42
48
|
Autoproj.env_set 'RUBYOPT', "-rubygems"
|
43
|
-
Autoproj.env_set 'GEM_HOME', gem_home
|
44
|
-
Autoproj.env_set_path 'PATH', "#{gem_home}/bin", "/usr/local/bin", "/usr/bin", "/bin"
|
49
|
+
Autoproj.env_set 'GEM_HOME', Autoproj.gem_home
|
50
|
+
Autoproj.env_set_path 'PATH', "#{Autoproj.gem_home}/bin", "/usr/local/bin", "/usr/bin", "/bin"
|
45
51
|
Autoproj.env_set 'PKG_CONFIG_PATH'
|
46
52
|
Autoproj.env_set 'RUBYLIB'
|
47
53
|
Autoproj.env_inherit 'PATH', 'PKG_CONFIG_PATH', 'RUBYLIB'
|
data/lib/autoproj/version.rb
CHANGED
data/samples/manifest
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
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-10-
|
12
|
+
date: 2009-10-15 00:00:00 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -166,7 +166,7 @@ files:
|
|
166
166
|
- test/test_debian.rb
|
167
167
|
- test/test_manifest.rb
|
168
168
|
has_rdoc: true
|
169
|
-
homepage:
|
169
|
+
homepage: http://doudou.github.com/autoproj
|
170
170
|
licenses: []
|
171
171
|
|
172
172
|
post_install_message:
|