autoproj 2.5.1 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/autoproj/cli/watch.rb +4 -3
- data/lib/autoproj/configuration.rb +12 -0
- data/lib/autoproj/manifest.rb +16 -10
- data/lib/autoproj/ops/configuration.rb +1 -1
- data/lib/autoproj/package_manifest.rb +47 -4
- data/lib/autoproj/package_set.rb +37 -18
- data/lib/autoproj/version.rb +1 -1
- data/lib/autoproj/workspace.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f873ef54ef817b4d8c0a029092ed0be7d645ee12
|
4
|
+
data.tar.gz: 38cfd4ae602a9c92b2a611eade91692060e6ef18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dce1888ec2edf6cd54a9c1e0fa158431be3b52d30c777a58781fb684cdb9f0580ddcf12488b323f425a5cfe3fd22f1a1661f30e5b402d060cd9703fbb8660d7f
|
7
|
+
data.tar.gz: 0b1702cd8ba4c0950f6e4023df314a804c05f00ef0f10295981aac6d1c495bce3b00af1e90e137d75ec3766ed338107bcf9cb3faed9ff400dea248505c80a143
|
data/lib/autoproj/cli/watch.rb
CHANGED
@@ -79,11 +79,12 @@ def create_dir_watcher(dir, included_paths: [], excluded_paths: [], inotify_flag
|
|
79
79
|
def create_src_pkg_watchers
|
80
80
|
@source_packages_dirs.each do |pkg_srcdir|
|
81
81
|
next unless File.exist? pkg_srcdir
|
82
|
-
create_dir_watcher(pkg_srcdir, included_paths: ["manifest.xml"])
|
82
|
+
create_dir_watcher(pkg_srcdir, included_paths: ["manifest.xml", "package.xml"])
|
83
83
|
|
84
84
|
manifest_file = File.join(pkg_srcdir, 'manifest.xml')
|
85
|
-
|
86
|
-
|
85
|
+
create_file_watcher(manifest_file) if File.exist? manifest_file
|
86
|
+
ros_manifest_file = File.join(pkg_srcdir, 'package.xml')
|
87
|
+
create_file_watcher(ros_manifest_file) if File.exist? ros_manifest_file
|
87
88
|
end
|
88
89
|
end
|
89
90
|
|
@@ -381,6 +381,18 @@ def build_dir
|
|
381
381
|
get('build', 'build')
|
382
382
|
end
|
383
383
|
|
384
|
+
# Defines a folder to which source packages will be layed out relative to
|
385
|
+
#
|
386
|
+
# If nil, packages will be layed out relative to root_dir
|
387
|
+
# Only relative paths are allowed
|
388
|
+
#
|
389
|
+
# The default is nil
|
390
|
+
#
|
391
|
+
# @return [String,nil]
|
392
|
+
def source_dir
|
393
|
+
get('source', nil)
|
394
|
+
end
|
395
|
+
|
384
396
|
# Returns true if there should be one prefix per package
|
385
397
|
#
|
386
398
|
# The default is false (disabled)
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'utilrb/kernel/options'
|
4
4
|
require 'set'
|
5
5
|
|
6
|
-
require 'win32/dir' if RbConfig::CONFIG["host_os"] =~%r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
|
6
|
+
require 'win32/dir' if RbConfig::CONFIG["host_os"] =~%r!(msdos|mswin|djgpp|mingw|[Ww]indows)!
|
7
7
|
|
8
8
|
module Autoproj
|
9
9
|
# The Manifest class represents the information included in the main
|
@@ -132,7 +132,7 @@ def add_constant_definition(key, value)
|
|
132
132
|
# The manifest data as a Hash
|
133
133
|
attr_reader :data
|
134
134
|
|
135
|
-
# The set of packages defined so far as a mapping from package name to
|
135
|
+
# The set of packages defined so far as a mapping from package name to
|
136
136
|
# [Autobuild::Package, package_set, file] tuple
|
137
137
|
attr_reader :packages
|
138
138
|
|
@@ -273,7 +273,7 @@ def cache_ignored_package_names
|
|
273
273
|
|
274
274
|
@ignored_package_names = each_package_definition.find_all do |pkg|
|
275
275
|
ignored_packages.any? do |l|
|
276
|
-
(pkg.name == l) ||
|
276
|
+
(pkg.name == l) ||
|
277
277
|
((pkg_set = metapackages[l]) && pkg_set.include?(pkg))
|
278
278
|
end
|
279
279
|
end.map(&:name).to_set
|
@@ -573,7 +573,7 @@ def importer_definition_for(package, _package_set = nil, mainline: nil, require_
|
|
573
573
|
end
|
574
574
|
|
575
575
|
# Sets up the package importers based on the information listed in
|
576
|
-
# the source's source.yml
|
576
|
+
# the source's source.yml
|
577
577
|
#
|
578
578
|
# The priority logic is that we take the package sets one by one in the
|
579
579
|
# order listed in the autoproj main manifest, and first come first used.
|
@@ -841,7 +841,7 @@ def layout_packages(validate = true)
|
|
841
841
|
end
|
842
842
|
end
|
843
843
|
end
|
844
|
-
|
844
|
+
|
845
845
|
begin
|
846
846
|
result.filter_excluded_and_ignored_packages(self)
|
847
847
|
rescue ExcludedSelection => e
|
@@ -866,10 +866,10 @@ def all_package_names
|
|
866
866
|
# Returns true if +name+ is a valid package and is included in the build
|
867
867
|
#
|
868
868
|
# If +validate+ is true, the method will raise ArgumentError if the
|
869
|
-
# package does not exists.
|
869
|
+
# package does not exists.
|
870
870
|
#
|
871
871
|
# If it is false, the method will simply return false on non-defined
|
872
|
-
# packages
|
872
|
+
# packages
|
873
873
|
def package_enabled?(name, validate = true)
|
874
874
|
Autoproj.warn_deprecated "#package_enabled? and #package_selected? were broken in autoproj v1, and there are usually other ways to get the same effect (as e.g. splitting package sets). Feel free to contact the autoproj developers if you have a use case that demands this functionality. For now, this method returns true for backward compatibility reasons."
|
875
875
|
true
|
@@ -879,10 +879,10 @@ def package_enabled?(name, validate = true)
|
|
879
879
|
# the build, nor ignored from the build
|
880
880
|
#
|
881
881
|
# If +validate+ is true, the method will raise ArgumentError if the
|
882
|
-
# package does not exists.
|
882
|
+
# package does not exists.
|
883
883
|
#
|
884
884
|
# If it is false, the method will simply return false on non-defined
|
885
|
-
# packages
|
885
|
+
# packages
|
886
886
|
def package_selected?(name, validate = true)
|
887
887
|
Autoproj.warn_deprecated "#package_enabled? and #package_selected? were broken in autoproj v1, and there are usually other ways to get the same effect (as e.g. splitting package sets). Feel free to contact the autoproj developers if you have a use case that demands this functionality. For now, this method returns true for backward compatibility reasons."
|
888
888
|
true
|
@@ -1002,8 +1002,14 @@ def load_package_manifest(pkg)
|
|
1002
1002
|
File.file?(path)
|
1003
1003
|
end
|
1004
1004
|
|
1005
|
+
# Alternatively, use a ROS manifest file
|
1006
|
+
ros_manifest_path = File.join(package.srcdir, 'package.xml')
|
1007
|
+
ros_manifest_path = nil unless File.file?(ros_manifest_path)
|
1008
|
+
|
1005
1009
|
if manifest_path
|
1006
1010
|
pkg.autobuild.description = PackageManifest.load(package, manifest_path)
|
1011
|
+
elsif ros_manifest_path
|
1012
|
+
pkg.autobuild.description = PackageManifest.load(package, ros_manifest_path, ros_manifest: true)
|
1007
1013
|
elsif pkg.autobuild.description.null?
|
1008
1014
|
Autoproj.warn "#{package.name} from #{package_set.name} does not have a manifest"
|
1009
1015
|
end
|
@@ -1174,7 +1180,7 @@ def move_package(package_name, new_dir)
|
|
1174
1180
|
# Compute the reverse dependencies of all the packages
|
1175
1181
|
#
|
1176
1182
|
# The return value is a hash of the form
|
1177
|
-
#
|
1183
|
+
#
|
1178
1184
|
# package_name => [list_of_packages_that_depend_on_package_name]
|
1179
1185
|
#
|
1180
1186
|
# Where the list is given as a list of package names as well
|
@@ -510,7 +510,7 @@ def auto_add_packages_from_layout
|
|
510
510
|
explicit.each do |pkg_or_set, layout_level|
|
511
511
|
next if manifest.find_autobuild_package(pkg_or_set)
|
512
512
|
next if manifest.has_package_set?(pkg_or_set)
|
513
|
-
full_path = File.expand_path(File.join(ws.
|
513
|
+
full_path = File.expand_path(File.join(ws.source_dir, layout_level, pkg_or_set))
|
514
514
|
next if !File.directory?(full_path)
|
515
515
|
|
516
516
|
if handler = auto_add_package(pkg_or_set, full_path)
|
@@ -13,10 +13,12 @@ def self.null(package)
|
|
13
13
|
#
|
14
14
|
# @param [PackageDescription] the package we're loading it for
|
15
15
|
# @param [String] file the path to the manifest.xml file
|
16
|
+
# @param [Boolean] ros_manifest whether the file follows the ROS format
|
16
17
|
# @return [PackageManifest]
|
17
18
|
# @see parse
|
18
|
-
def self.load(package, file)
|
19
|
-
|
19
|
+
def self.load(package, file, ros_manifest: false)
|
20
|
+
loader_class = ros_manifest ? RosLoader : Loader
|
21
|
+
parse(package, File.read(file), path: file, loader_class: loader_class)
|
20
22
|
end
|
21
23
|
|
22
24
|
# Create a PackageManifest object from the XML content provided as a
|
@@ -25,11 +27,12 @@ def self.load(package, file)
|
|
25
27
|
# @param [PackageDescription] the package we're loading it for
|
26
28
|
# @param [String] contents the manifest.xml contents as a string
|
27
29
|
# @param [String] path the file path, used for error reporting
|
30
|
+
# @param [Boolean] ros_manifest whether the file follows the ROS format
|
28
31
|
# @return [PackageManifest]
|
29
32
|
# @see load
|
30
|
-
def self.parse(package, contents, path: '<loaded from string>')
|
33
|
+
def self.parse(package, contents, path: '<loaded from string>', loader_class: Loader)
|
31
34
|
manifest = PackageManifest.new(package)
|
32
|
-
loader =
|
35
|
+
loader = loader_class.new(path, manifest)
|
33
36
|
begin
|
34
37
|
REXML::Document.parse_stream(contents, loader)
|
35
38
|
rescue REXML::ParseException => e
|
@@ -216,5 +219,45 @@ def tag_end(name)
|
|
216
219
|
@tag_text = nil
|
217
220
|
end
|
218
221
|
end
|
222
|
+
|
223
|
+
# @api private
|
224
|
+
#
|
225
|
+
# REXML stream parser object used to load the XML contents into a
|
226
|
+
# {PackageManifest} object
|
227
|
+
class RosLoader < Loader
|
228
|
+
DEPEND_TAGS = Set['depend', 'build_depend', 'build_export_depend',
|
229
|
+
'buildtool_depend', 'buildtool_export_depend',
|
230
|
+
'exec_depend', 'test_depend', 'run_depend']
|
231
|
+
|
232
|
+
def tag_start(name, attributes)
|
233
|
+
if DEPEND_TAGS.include?(name)
|
234
|
+
@tag_text = ''
|
235
|
+
elsif TEXT_FIELDS.include?(name)
|
236
|
+
@tag_text = ''
|
237
|
+
elsif AUTHOR_FIELDS.include?(name)
|
238
|
+
@author_email = attributes['email']
|
239
|
+
@tag_text = ''
|
240
|
+
else
|
241
|
+
@tag_text = nil
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def tag_end(name)
|
246
|
+
if DEPEND_TAGS.include?(name)
|
247
|
+
raise InvalidPackageManifest, "found '#{name}' tag in #{path} without content" if @tag_text.strip.empty?
|
248
|
+
manifest.add_dependency(@tag_text)
|
249
|
+
elsif AUTHOR_FIELDS.include?(name)
|
250
|
+
author_name = @tag_text.strip
|
251
|
+
email = @author_email ? @author_email.strip : nil
|
252
|
+
email = nil if email && email.empty?
|
253
|
+
contact = ContactInfo.new(author_name, email)
|
254
|
+
manifest.send("#{name}s").concat([contact])
|
255
|
+
elsif TEXT_FIELDS.include?(name)
|
256
|
+
field = @tag_text.strip
|
257
|
+
manifest.send("#{name}=", field) unless field.empty?
|
258
|
+
end
|
259
|
+
@tag_text = nil
|
260
|
+
end
|
261
|
+
end
|
219
262
|
end
|
220
263
|
end
|
data/lib/autoproj/package_set.rb
CHANGED
@@ -252,16 +252,25 @@ def self.raw_local_dir_of(ws, vcs)
|
|
252
252
|
end
|
253
253
|
end
|
254
254
|
|
255
|
+
def self.default_expansions(ws)
|
256
|
+
ws.config.to_hash.
|
257
|
+
merge(ws.manifest.constant_definitions).
|
258
|
+
merge("AUTOPROJ_ROOT" => ws.root_dir,
|
259
|
+
"AUTOPROJ_CONFIG" => ws.config_dir)
|
260
|
+
end
|
261
|
+
|
255
262
|
# Resolve the VCS information for a package set
|
256
263
|
#
|
257
264
|
# This parses the information stored in the package_sets section of
|
258
|
-
# autoproj/manifest,
|
265
|
+
# autoproj/manifest, r the imports section of the source.yml files and
|
259
266
|
# returns the corresponding VCSDefinition object
|
260
|
-
def self.resolve_definition(ws, raw_spec, from: nil, raw: Array.new
|
267
|
+
def self.resolve_definition(ws, raw_spec, from: nil, raw: Array.new,
|
268
|
+
vars: default_expansions(ws))
|
269
|
+
|
261
270
|
spec = VCSDefinition.normalize_vcs_hash(raw_spec, base_dir: ws.config_dir)
|
262
271
|
options, vcs_spec = Kernel.filter_options spec, auto_imports: true
|
263
272
|
|
264
|
-
vcs_spec = Autoproj.expand(vcs_spec,
|
273
|
+
vcs_spec = Autoproj.expand(vcs_spec, vars)
|
265
274
|
return VCSDefinition.from_raw(vcs_spec, from: from, raw: raw), options
|
266
275
|
end
|
267
276
|
|
@@ -464,36 +473,46 @@ def load_overrides(source_definition)
|
|
464
473
|
|
465
474
|
def parse_source_definition(source_definition)
|
466
475
|
@name = source_definition['name'] || self.name
|
467
|
-
@required_autoproj_version = source_definition.fetch(
|
476
|
+
@required_autoproj_version = source_definition.fetch(
|
477
|
+
'required_autoproj_version', self.required_autoproj_version)
|
478
|
+
|
479
|
+
# Compute the definition of constants
|
480
|
+
if new_constants = source_definition['constants']
|
481
|
+
Autoproj.in_file(source_file) do
|
482
|
+
variables = inject_constants_and_config_for_expansion(Hash.new)
|
483
|
+
@constants_definitions = Autoproj.resolve_constant_definitions(
|
484
|
+
new_constants, variables)
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
468
488
|
if new_imports = source_definition['imports']
|
489
|
+
variables = inject_constants_and_config_for_expansion(Hash.new)
|
469
490
|
@imports_vcs = Array(new_imports).map do |set_def|
|
470
491
|
if !set_def.kind_of?(Hash) && !set_def.respond_to?(:to_str)
|
471
|
-
raise ConfigError.new(source_file),
|
472
|
-
"
|
492
|
+
raise ConfigError.new(source_file), "in #{source_file}: "\
|
493
|
+
"wrong format for 'imports' section. Expected an array of "\
|
494
|
+
"maps or strings (e.g. - github: my/url)."
|
473
495
|
end
|
474
496
|
|
475
497
|
Autoproj.in_file(source_file) do
|
476
|
-
PackageSet.resolve_definition(ws, set_def, from: self,
|
498
|
+
PackageSet.resolve_definition(ws, set_def, from: self,
|
499
|
+
vars: variables,
|
500
|
+
raw: [VCSDefinition::RawEntry.new(self, source_file, set_def)])
|
477
501
|
end
|
478
502
|
end
|
479
503
|
end
|
480
504
|
|
481
|
-
# Compute the definition of constants
|
482
|
-
if new_constants = source_definition['constants']
|
483
|
-
Autoproj.in_file(source_file) do
|
484
|
-
variables = inject_constants_and_config_for_expansion(Hash.new)
|
485
|
-
@constants_definitions = Autoproj.resolve_constant_definitions(new_constants, variables)
|
486
|
-
end
|
487
|
-
end
|
488
|
-
|
489
505
|
if new_version_control = source_definition['version_control']
|
490
506
|
invalidate_importer_definitions_cache
|
491
|
-
@version_control = normalize_vcs_list('version_control', source_file,
|
507
|
+
@version_control = normalize_vcs_list('version_control', source_file,
|
508
|
+
new_version_control)
|
492
509
|
|
493
510
|
Autoproj.in_file(source_file) do
|
494
|
-
default_vcs_spec, raw = version_control_field(
|
511
|
+
default_vcs_spec, raw = version_control_field(
|
512
|
+
'default', version_control, file: source_file)
|
495
513
|
if default_vcs_spec
|
496
|
-
@default_importer = VCSDefinition.from_raw(default_vcs_spec,
|
514
|
+
@default_importer = VCSDefinition.from_raw(default_vcs_spec,
|
515
|
+
raw: raw, from: self)
|
497
516
|
end
|
498
517
|
end
|
499
518
|
end
|
data/lib/autoproj/version.rb
CHANGED
data/lib/autoproj/workspace.rb
CHANGED
@@ -191,6 +191,20 @@ def build_dir=(path)
|
|
191
191
|
config.set 'build', path, true
|
192
192
|
end
|
193
193
|
|
194
|
+
# (see Configuration#source_dir)
|
195
|
+
def source_dir
|
196
|
+
if config.source_dir
|
197
|
+
File.expand_path(config.source_dir, root_dir)
|
198
|
+
else
|
199
|
+
root_dir
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
# Change {#source_dir}
|
204
|
+
def source_dir=(path)
|
205
|
+
config.set 'source', path, true
|
206
|
+
end
|
207
|
+
|
194
208
|
def log_dir
|
195
209
|
File.join(prefix_dir, 'log')
|
196
210
|
end
|
@@ -214,6 +228,11 @@ def load_config(reconfigure = false)
|
|
214
228
|
manifest.vcs = VCSDefinition.from_raw(
|
215
229
|
type: 'local', url: config_dir)
|
216
230
|
end
|
231
|
+
|
232
|
+
if config.source_dir && Pathname.new(config.source_dir).absolute?
|
233
|
+
raise ConfigError, 'source dir path configuration must be relative'
|
234
|
+
end
|
235
|
+
|
217
236
|
os_package_resolver.prefer_indep_over_os_packages = config.prefer_indep_over_os_packages?
|
218
237
|
os_package_resolver.operating_system ||= config.get('operating_system', nil)
|
219
238
|
end
|
@@ -287,7 +306,7 @@ def setup
|
|
287
306
|
io.puts "workspace: \"#{root_dir}\""
|
288
307
|
end
|
289
308
|
|
290
|
-
Autobuild.srcdir =
|
309
|
+
Autobuild.srcdir = source_dir
|
291
310
|
Autobuild.logdir = log_dir
|
292
311
|
if cache_dir = config.importer_cache_dir
|
293
312
|
Autobuild::Importer.default_cache_dirs = cache_dir
|
@@ -533,7 +552,7 @@ def setup_package_directories(pkg)
|
|
533
552
|
end
|
534
553
|
|
535
554
|
pkg = manifest.find_autobuild_package(pkg_name)
|
536
|
-
pkg.srcdir = File.join(
|
555
|
+
pkg.srcdir = File.join(source_dir, srcdir)
|
537
556
|
if pkg.respond_to?(:builddir)
|
538
557
|
pkg.builddir = compute_builddir(pkg)
|
539
558
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autoproj
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sylvain Joyeux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|