autoproj 1.7.0.b3 → 1.7.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -1
- data/bin/autoproj +60 -9
- data/lib/autoproj/autobuild.rb +27 -10
- data/lib/autoproj/cmdline.rb +43 -1
- data/lib/autoproj/manifest.rb +42 -35
- data/lib/autoproj/version.rb +1 -1
- metadata +4 -4
data/History.txt
CHANGED
@@ -17,7 +17,12 @@
|
|
17
17
|
in a separate non-trivial subfolder, and install it in a separate folder as
|
18
18
|
well. This is meant to test the definition and handling of dependencies
|
19
19
|
between the different packages.
|
20
|
-
* added the autolocate tool, which returns the full path to a certain package
|
20
|
+
* added the autolocate tool, which returns the full path to a certain package.
|
21
|
+
The shell function "acd", akin to rosbuild's roscd, it provided in shell/
|
22
|
+
* added an easier way to add a local checked-out package to a build without
|
23
|
+
going through editing 20 files. Packages are automatically detected and added
|
24
|
+
as soon as they are explicitely added to autoproj/manifest.
|
25
|
+
* added the --stats option that displays timing statistics about the build
|
21
26
|
|
22
27
|
= Version 1.6.2
|
23
28
|
* overhauled osdeps fine-grained configuration. See
|
data/bin/autoproj
CHANGED
@@ -18,7 +18,7 @@ def color(*args)
|
|
18
18
|
Autoproj.console.color(*args)
|
19
19
|
end
|
20
20
|
|
21
|
-
def report
|
21
|
+
def report
|
22
22
|
Autobuild::Reporting.report do
|
23
23
|
yield
|
24
24
|
end
|
@@ -34,13 +34,13 @@ rescue ConfigError => e
|
|
34
34
|
STDERR.puts color(" in #{path}", :red, :bold)
|
35
35
|
end
|
36
36
|
end
|
37
|
-
if debug then raise
|
37
|
+
if Autobuild.debug then raise
|
38
38
|
else exit 1
|
39
39
|
end
|
40
40
|
rescue Interrupt
|
41
41
|
STDERR.puts
|
42
42
|
STDERR.puts color("Interrupted by user", :red, :bold)
|
43
|
-
if debug then raise
|
43
|
+
if Autobuild.debug then raise
|
44
44
|
else exit 1
|
45
45
|
end
|
46
46
|
end
|
@@ -48,7 +48,7 @@ end
|
|
48
48
|
Autoproj::OSDependencies.autodetect_ruby
|
49
49
|
|
50
50
|
# Find the autoproj root dir
|
51
|
-
report
|
51
|
+
report do
|
52
52
|
selected_packages =
|
53
53
|
begin Autoproj::CmdLine.parse_arguments(ARGV.dup)
|
54
54
|
rescue RuntimeError => e
|
@@ -103,8 +103,14 @@ EOTEXT
|
|
103
103
|
Autobuild.do_update = Autoproj.auto_update?
|
104
104
|
end
|
105
105
|
|
106
|
-
|
107
|
-
|
106
|
+
resolved_selected_packages = Autoproj::CmdLine.resolve_user_selection(selected_packages)
|
107
|
+
if !selected_packages.empty?
|
108
|
+
command_line_selection = resolved_selected_packages.dup
|
109
|
+
else
|
110
|
+
command_line_selection = Array.new
|
111
|
+
end
|
112
|
+
Autoproj.manifest.explicit_selection = resolved_selected_packages
|
113
|
+
selected_packages = resolved_selected_packages
|
108
114
|
Autoproj::CmdLine.initial_package_setup
|
109
115
|
|
110
116
|
# If in verbose mode, or if we only update sources, list the sources
|
@@ -192,9 +198,9 @@ EOTEXT
|
|
192
198
|
if all_enabled_packages.empty?
|
193
199
|
STDERR.puts color("autoproj: nothing to do", :bold)
|
194
200
|
elsif Autoproj::CmdLine.doc?
|
195
|
-
Autoproj::CmdLine.build_packages(
|
201
|
+
Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages)
|
196
202
|
elsif Autoproj::CmdLine.build?
|
197
|
-
Autoproj::CmdLine.build_packages(
|
203
|
+
Autoproj::CmdLine.build_packages(command_line_selection, all_enabled_packages)
|
198
204
|
|
199
205
|
# Now, do some sanity checks on the result
|
200
206
|
prefixes = all_enabled_packages.inject(Set.new) do |set, pkg_name|
|
@@ -213,7 +219,52 @@ EOTEXT
|
|
213
219
|
|
214
220
|
if Autoproj::CmdLine.update_envsh?
|
215
221
|
Autoproj.export_env_sh
|
216
|
-
|
222
|
+
Autoproj.progress "autoproj: updated #{Autoproj.root_dir}/env.sh", :green
|
223
|
+
end
|
224
|
+
|
225
|
+
if Autoproj::CmdLine.show_statistics?
|
226
|
+
per_phase = Hash.new
|
227
|
+
per_type = Hash.new
|
228
|
+
|
229
|
+
Autoproj.progress
|
230
|
+
Autoproj.progress "statistics about the build", :bold
|
231
|
+
|
232
|
+
Autoproj.manifest.each_package.sort_by(&:name).each do |pkg|
|
233
|
+
next if pkg.statistics.empty?
|
234
|
+
|
235
|
+
if per_phase.empty?
|
236
|
+
Autoproj.progress "detailed per package"
|
237
|
+
end
|
238
|
+
|
239
|
+
puts " #{pkg.name}: %.1fs" % [pkg.statistics.values.inject(&:+)]
|
240
|
+
pkg.statistics.each_key.sort.each do |phase|
|
241
|
+
per_phase[phase] ||= 0
|
242
|
+
per_phase[phase] += pkg.statistics[phase]
|
243
|
+
per_type[pkg.class] ||= Hash.new
|
244
|
+
per_type[pkg.class][phase] ||= 0
|
245
|
+
per_type[pkg.class][phase] += pkg.statistics[phase]
|
246
|
+
puts " #{phase}: %.1fs" % [pkg.statistics[phase]]
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
if !per_type.empty?
|
251
|
+
Autoproj.progress
|
252
|
+
Autoproj.progress "detailed per package type"
|
253
|
+
per_type.each do |pkg_type, phases|
|
254
|
+
Autoproj.progress " #{pkg_type.name}: %.1fs" % [phases.values.inject(&:+)]
|
255
|
+
phases.each_key.sort.each do |phase_name|
|
256
|
+
Autoproj.progress " #{phase_name}: %.1fs" % [phases[phase_name]]
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
260
|
+
|
261
|
+
if !per_phase.empty?
|
262
|
+
Autoproj.progress
|
263
|
+
Autoproj.progress "summary per phase"
|
264
|
+
per_phase.keys.sort.each do |phase_name|
|
265
|
+
Autoproj.progress " #{phase_name}: %.1fs" % [per_phase[phase_name]]
|
266
|
+
end
|
267
|
+
end
|
217
268
|
end
|
218
269
|
end
|
219
270
|
|
data/lib/autoproj/autobuild.rb
CHANGED
@@ -163,21 +163,38 @@ module Autoproj
|
|
163
163
|
end
|
164
164
|
end
|
165
165
|
|
166
|
+
def self.in_package_set(source, path)
|
167
|
+
@file_stack.push([source, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')])
|
168
|
+
yield
|
169
|
+
ensure
|
170
|
+
@file_stack.pop
|
171
|
+
end
|
172
|
+
|
166
173
|
def self.import_autobuild_file(source, path)
|
167
174
|
return if @loaded_autobuild_files.include?(path)
|
168
175
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
+
in_package_set(source, File.expand_path(path).gsub(/^#{Regexp.quote(Autoproj.root_dir)}\//, '')) do
|
177
|
+
begin
|
178
|
+
Kernel.load path
|
179
|
+
rescue ConfigError => e
|
180
|
+
raise
|
181
|
+
rescue Exception => e
|
182
|
+
filter_load_exception(e, source, path)
|
183
|
+
end
|
184
|
+
@loaded_autobuild_files << path
|
176
185
|
end
|
177
|
-
|
186
|
+
end
|
178
187
|
|
179
|
-
|
180
|
-
|
188
|
+
# Tries to find a handler automatically for 'full_path'
|
189
|
+
def self.package_handler_for(full_path)
|
190
|
+
if !Dir.enum_for(:glob, File.join(full_path, "*.orogen")).to_a.empty?
|
191
|
+
"orogen_package"
|
192
|
+
elsif File.file?(File.join(full_path, "CMakeLists.txt"))
|
193
|
+
"cmake_package"
|
194
|
+
elsif File.directory?(File.join(full_path, "lib")) &&
|
195
|
+
!Dir.enum_for(:glob, File.join(full_path, "*.rb")).to_a.empty?
|
196
|
+
"ruby_package"
|
197
|
+
end
|
181
198
|
end
|
182
199
|
end
|
183
200
|
|
data/lib/autoproj/cmdline.rb
CHANGED
@@ -166,6 +166,29 @@ module Autoproj
|
|
166
166
|
# source.yml files)
|
167
167
|
manifest.load_importers
|
168
168
|
|
169
|
+
# Auto-add packages that are
|
170
|
+
# * present on disk
|
171
|
+
# * listed in the layout part of the manifest
|
172
|
+
# * but have no definition
|
173
|
+
explicit = manifest.normalized_layout
|
174
|
+
explicit.each do |pkg_or_set, layout_level|
|
175
|
+
next if Autobuild::Package[pkg_or_set]
|
176
|
+
next if manifest.has_package_set?(pkg_or_set)
|
177
|
+
|
178
|
+
# This is not known. Check if we can auto-add it
|
179
|
+
full_path = File.expand_path(File.join(Autoproj.root_dir, layout_level, pkg_or_set))
|
180
|
+
next if !File.directory?(full_path)
|
181
|
+
|
182
|
+
if handler = Autoproj.package_handler_for(full_path)
|
183
|
+
Autoproj.progress " auto-adding #{pkg_or_set} #{"in #{layout_level} " if layout_level != "/"}using the #{handler.gsub(/_package/, '')} package handler"
|
184
|
+
Autoproj.in_package_set(manifest.local_package_set, manifest.file) do
|
185
|
+
send(handler, pkg_or_set)
|
186
|
+
end
|
187
|
+
else
|
188
|
+
Autoproj.warn "cannot auto-add #{pkg_or_set}: unknown package type"
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
169
192
|
# We finished loading the configuration files. Not all configuration
|
170
193
|
# is done (since we need to process the package setup blocks), but
|
171
194
|
# save the current state of the configuration anyway.
|
@@ -335,6 +358,8 @@ module Autoproj
|
|
335
358
|
Autoproj.progress " defines: #{set_packages.map(&:name).join(", ")}"
|
336
359
|
end
|
337
360
|
|
361
|
+
packages_not_present = []
|
362
|
+
|
338
363
|
Autoproj.progress
|
339
364
|
Autoproj.progress("autoproj: packages", :bold)
|
340
365
|
all_packages.to_a.sort_by(&:first).map(&:last).each do |pkg, pkg_set|
|
@@ -355,6 +380,7 @@ module Autoproj
|
|
355
380
|
Autoproj.progress " #{vcs_def.to_s}"
|
356
381
|
|
357
382
|
if !File.directory?(pkg.srcdir)
|
383
|
+
packages_not_present << pkg.name
|
358
384
|
Autoproj.progress " NOT checked out yet, reported dependencies will be partial"
|
359
385
|
end
|
360
386
|
|
@@ -373,6 +399,15 @@ module Autoproj
|
|
373
399
|
Autoproj.progress " disabled opt deps: #{opt_deps.join(", ")}"
|
374
400
|
end
|
375
401
|
end
|
402
|
+
|
403
|
+
if !packages_not_present.empty?
|
404
|
+
Autoproj.progress
|
405
|
+
Autoproj.warn "the following packages are not yet checked out:"
|
406
|
+
packages_not_present.each_slice(4) do |*packages|
|
407
|
+
Autoproj.warn " #{packages.join(", ")}"
|
408
|
+
end
|
409
|
+
Autoproj.warn "therefore, the package list above and the listed dependencies are probably not complete"
|
410
|
+
end
|
376
411
|
end
|
377
412
|
|
378
413
|
# Returns the set of packages that are actually selected based on what
|
@@ -607,6 +642,8 @@ module Autoproj
|
|
607
642
|
def self.doc?; @mode == "doc" end
|
608
643
|
def self.snapshot?; @mode == "snapshot" end
|
609
644
|
|
645
|
+
def self.show_statistics?; !!@show_statistics end
|
646
|
+
|
610
647
|
def self.osdeps?; @mode == "osdeps" end
|
611
648
|
def self.show_osdeps?; @mode == "osdeps" && @show_osdeps end
|
612
649
|
def self.revshow_osdeps?; @mode == "osdeps" && @revshow_osdeps end
|
@@ -723,6 +760,9 @@ where 'mode' is one of:
|
|
723
760
|
end
|
724
761
|
exit 0
|
725
762
|
end
|
763
|
+
opts.on('--stats', 'displays statistics about each of the phases in the package building process') do
|
764
|
+
@show_statistics = true
|
765
|
+
end
|
726
766
|
|
727
767
|
opts.on("--with-depends", "apply rebuild and force-build to both packages selected on the command line and their dependencies") do
|
728
768
|
force_re_build_with_depends = true
|
@@ -936,7 +976,9 @@ where 'mode' is one of:
|
|
936
976
|
else pkg.autoproj_name
|
937
977
|
end
|
938
978
|
|
939
|
-
if !pkg.importer
|
979
|
+
if !pkg.importer
|
980
|
+
lines << Autoproj.color(" is a local-only package (no VCS)", :bold, :red)
|
981
|
+
elsif !pkg.importer.respond_to?(:status)
|
940
982
|
lines << Autoproj.color(" the #{pkg.importer.class.name.gsub(/.*::/, '')} importer does not support status display", :bold, :red)
|
941
983
|
elsif !File.directory?(pkg.srcdir)
|
942
984
|
lines << Autoproj.color(" is not imported yet", :magenta)
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -777,6 +777,8 @@ module Autoproj
|
|
777
777
|
@disabled_imports = Set.new
|
778
778
|
@moved_packages = Hash.new
|
779
779
|
|
780
|
+
@explicit_selection = Set.new
|
781
|
+
|
780
782
|
@constant_definitions = Hash.new
|
781
783
|
if Autoproj.has_config_key?('manifest_source')
|
782
784
|
@vcs = Autoproj.normalize_vcs_definition(Autoproj.user_config('manifest_source'))
|
@@ -995,6 +997,10 @@ module Autoproj
|
|
995
997
|
each_package_set(*args, &block)
|
996
998
|
end
|
997
999
|
|
1000
|
+
def local_package_set
|
1001
|
+
each_package_set.find { |s| s.kind_of?(LocalPackageSet) }
|
1002
|
+
end
|
1003
|
+
|
998
1004
|
# Save the currently known package sets. After this call,
|
999
1005
|
# #each_package_set will always return the same set regardless of
|
1000
1006
|
# changes on the manifest's data structures
|
@@ -1224,6 +1230,12 @@ module Autoproj
|
|
1224
1230
|
end
|
1225
1231
|
end
|
1226
1232
|
|
1233
|
+
# Returns true if +name+ is the name of a package set known to this
|
1234
|
+
# autoproj installation
|
1235
|
+
def has_package_set?(name)
|
1236
|
+
each_package_set(false).find { |set| set.name == name }
|
1237
|
+
end
|
1238
|
+
|
1227
1239
|
# +name+ can either be the name of a source or the name of a package. In
|
1228
1240
|
# the first case, we return all packages defined by that source. In the
|
1229
1241
|
# latter case, we return the singleton array [name]
|
@@ -1246,28 +1258,17 @@ module Autoproj
|
|
1246
1258
|
#
|
1247
1259
|
# If recursive is false, yields only the packages at this level.
|
1248
1260
|
# Otherwise, return all packages.
|
1249
|
-
def layout_packages(result,
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
result << p
|
1256
|
-
Autobuild::Package[p].all_dependencies(result)
|
1257
|
-
end
|
1258
|
-
|
1259
|
-
rescue ConfigError
|
1260
|
-
raise if validate
|
1261
|
+
def layout_packages(result, validate)
|
1262
|
+
normalized_layout.each_key do |pkg_or_set|
|
1263
|
+
begin
|
1264
|
+
resolve_package_set(pkg_or_set).each do |pkg_name|
|
1265
|
+
result << pkg_name
|
1266
|
+
Autobuild::Package[pkg_name].all_dependencies(result)
|
1261
1267
|
end
|
1268
|
+
rescue ConfigError
|
1269
|
+
raise if validate
|
1262
1270
|
end
|
1263
1271
|
end
|
1264
|
-
|
1265
|
-
if recursive
|
1266
|
-
each_sublayout(layout_def) do |sublayout_name, sublayout_def|
|
1267
|
-
layout_packages(result, sublayout_def, true)
|
1268
|
-
end
|
1269
|
-
end
|
1270
|
-
|
1271
1272
|
result
|
1272
1273
|
end
|
1273
1274
|
|
@@ -1331,11 +1332,20 @@ module Autoproj
|
|
1331
1332
|
end
|
1332
1333
|
end
|
1333
1334
|
|
1335
|
+
# Returns the set of packages that are selected by the layout
|
1336
|
+
def all_selected_packages
|
1337
|
+
result = default_packages.to_set
|
1338
|
+
result.each do |pkg_name|
|
1339
|
+
Autobuild::Package[pkg_name].all_dependencies(result)
|
1340
|
+
end
|
1341
|
+
result
|
1342
|
+
end
|
1343
|
+
|
1334
1344
|
# Returns the set of packages that should be built if the user does not
|
1335
1345
|
# specify any on the command line
|
1336
1346
|
def default_packages(validate = true)
|
1337
1347
|
names = if layout = data['layout']
|
1338
|
-
layout_packages(Set.new,
|
1348
|
+
layout_packages(Set.new, validate)
|
1339
1349
|
else
|
1340
1350
|
# No layout, all packages are selected
|
1341
1351
|
all_packages
|
@@ -1345,27 +1355,24 @@ module Autoproj
|
|
1345
1355
|
names.to_set
|
1346
1356
|
end
|
1347
1357
|
|
1348
|
-
def
|
1358
|
+
def normalized_layout(result = Hash.new { '/' }, layout_level = '/', layout_data = (data['layout'] || Hash.new))
|
1349
1359
|
layout_data.each do |value|
|
1350
1360
|
if value.kind_of?(Hash)
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
end
|
1356
|
-
|
1357
|
-
elsif names.include?(value)
|
1358
|
-
return layout_level
|
1361
|
+
subname, subdef = value.find { true }
|
1362
|
+
normalized_layout(result, "#{layout_level}#{subname}/", subdef)
|
1363
|
+
else
|
1364
|
+
result[value] = layout_level
|
1359
1365
|
end
|
1360
1366
|
end
|
1361
|
-
|
1367
|
+
result
|
1362
1368
|
end
|
1363
1369
|
|
1364
1370
|
# Returns the package directory for the given package name
|
1365
1371
|
def whereis(package_name)
|
1366
1372
|
Autoproj.in_file(self.file) do
|
1367
1373
|
set_name = definition_source(package_name).name
|
1368
|
-
|
1374
|
+
actual_layout = normalized_layout
|
1375
|
+
return actual_layout[package_name] || actual_layout[set_name]
|
1369
1376
|
end
|
1370
1377
|
end
|
1371
1378
|
|
@@ -1464,17 +1471,17 @@ module Autoproj
|
|
1464
1471
|
# * as a package name
|
1465
1472
|
#
|
1466
1473
|
# This method converts the first two directories into the third one
|
1467
|
-
def expand_package_selection(
|
1474
|
+
def expand_package_selection(selection)
|
1468
1475
|
base_dir = Autoproj.root_dir
|
1469
1476
|
|
1470
1477
|
# The expanded selection
|
1471
1478
|
expanded_packages = Set.new
|
1472
1479
|
# All the packages that are available on this installation
|
1473
|
-
all_layout_packages = self.
|
1480
|
+
all_layout_packages = self.all_selected_packages
|
1474
1481
|
|
1475
1482
|
# First, remove packages that are directly referenced by name or by
|
1476
1483
|
# package set names
|
1477
|
-
|
1484
|
+
selection.each do |sel|
|
1478
1485
|
sel = Regexp.new(Regexp.quote(sel))
|
1479
1486
|
|
1480
1487
|
packages = all_layout_packages.
|
@@ -1493,7 +1500,7 @@ module Autoproj
|
|
1493
1500
|
|
1494
1501
|
# Finally, check for package source directories
|
1495
1502
|
all_packages = self.all_package_names
|
1496
|
-
|
1503
|
+
selection.each do |sel|
|
1497
1504
|
match_pkg_name = Regexp.new(Regexp.quote(sel))
|
1498
1505
|
all_packages.each do |pkg_name|
|
1499
1506
|
pkg = Autobuild::Package[pkg_name]
|
data/lib/autoproj/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 977940582
|
5
5
|
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 7
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 1.7.0.
|
10
|
+
- rc1
|
11
|
+
version: 1.7.0.rc1
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Sylvain Joyeux
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-11-
|
19
|
+
date: 2010-11-26 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|