autoproj 2.16.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +3 -1
- data/.github/workflows/test.yml +2 -0
- data/Gemfile +5 -2
- data/Rakefile +1 -0
- data/autoproj.gemspec +1 -1
- data/bin/autoproj_bootstrap +39 -33
- data/bin/autoproj_install +39 -33
- data/lib/autoproj/autobuild_extensions/package.rb +2 -0
- data/lib/autoproj/configuration.rb +0 -5
- data/lib/autoproj/default.osdeps +5 -2
- data/lib/autoproj/manifest.rb +4 -2
- data/lib/autoproj/ops/atomic_write.rb +63 -26
- data/lib/autoproj/ops/install.rb +39 -33
- data/lib/autoproj/os_package_installer.rb +2 -1
- data/lib/autoproj/package_manifest.rb +57 -7
- data/lib/autoproj/ros_condition_parser.rb +3 -5
- data/lib/autoproj/ros_package_manifest.rb +6 -3
- data/lib/autoproj/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99a2de5ee91090c29e14337e48e9adbf9673a719e79e2d6610bb037ea4bb0d02
|
4
|
+
data.tar.gz: fb693ef03ade583a5bf4d1e0d8c3cb24a0b909e66a640d471d2b2ec14c414ebb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35e62e7f4719c7ee187b492b1042e520595167ca2f7183380f505460e40ea878dcb1549b36d85fef60a319789f267dc090e88eb12bd32a06023d60644ab61a72
|
7
|
+
data.tar.gz: 3e8c66e8e46236041fd11a808f2249357c88f65d98daf863b4edf92a718d3e949d89dc3372e0149182c045683dc6f5f0432c25efa47c6d2b801768fc05a67d45
|
data/.github/workflows/lint.yml
CHANGED
@@ -19,7 +19,9 @@ jobs:
|
|
19
19
|
uses: ruby/setup-ruby@v1
|
20
20
|
with:
|
21
21
|
ruby-version: ${{ matrix.ruby-version }}
|
22
|
+
- name: Configure bundler without 'vscode'
|
23
|
+
run: bundle config set --local without vscode
|
22
24
|
- name: Install dependencies
|
23
25
|
run: bundle install
|
24
26
|
- name: Run rubocop
|
25
|
-
run: bundle exec rubocop
|
27
|
+
run: bundle exec rubocop
|
data/.github/workflows/test.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,12 +2,15 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gem "autobuild", git: "https://github.com/rock-core/autobuild", branch: "master"
|
4
4
|
|
5
|
+
group :dev do
|
6
|
+
gem "rubocop", "~> 1.28.0"
|
7
|
+
gem "rubocop-rock"
|
8
|
+
end
|
9
|
+
|
5
10
|
group :vscode do
|
6
11
|
gem "debase", ">= 0.2.2.beta10"
|
7
12
|
gem "pry"
|
8
13
|
gem "pry-byebug"
|
9
|
-
gem "rubocop", ">= 0.6.0"
|
10
|
-
gem "rubocop-rock"
|
11
14
|
gem "ruby-debug-ide", ">= 0.6.0"
|
12
15
|
gem "solargraph"
|
13
16
|
end
|
data/Rakefile
CHANGED
@@ -20,6 +20,7 @@ task "bootstrap" do
|
|
20
20
|
%w[bootstrap install].each do |install_script|
|
21
21
|
bootstrap_code = File.read(File.join(Dir.pwd, "bin", "autoproj_#{install_script}.in"))
|
22
22
|
.gsub("require 'autoproj/ops/install'", autoproj_ops_install)
|
23
|
+
.gsub('#{Autoproj::VERSION}', Autoproj::VERSION) # rubocop:disable Lint/InterpolationCheck
|
23
24
|
File.open(File.join(Dir.pwd, "bin", "autoproj_#{install_script}"), "w") do |io|
|
24
25
|
io.write bootstrap_code
|
25
26
|
end
|
data/autoproj.gemspec
CHANGED
@@ -38,7 +38,7 @@ Gem::Specification.new do |s|
|
|
38
38
|
s.add_runtime_dependency "tty-spinner", "~> 0.9.0"
|
39
39
|
s.add_runtime_dependency "utilrb", "~> 3.0.0", ">= 3.0.0"
|
40
40
|
s.add_runtime_dependency "xdg", "= 2.2.5"
|
41
|
-
s.add_development_dependency "aruba"
|
41
|
+
s.add_development_dependency "aruba", "~> 2.1.0"
|
42
42
|
s.add_development_dependency "flexmock", "~> 2.0", ">= 2.0.0"
|
43
43
|
s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
|
44
44
|
s.add_development_dependency "simplecov"
|
data/bin/autoproj_bootstrap
CHANGED
@@ -97,7 +97,9 @@ module Autoproj
|
|
97
97
|
@ruby_executable = config["ruby_executable"]
|
98
98
|
@local = false
|
99
99
|
|
100
|
-
|
100
|
+
@gems_install_path ||= default_gems_install_path
|
101
|
+
@gems_install_path = File.expand_path(@gems_install_path)
|
102
|
+
|
101
103
|
env["GEM_HOME"] = [gems_gem_home]
|
102
104
|
env["GEM_PATH"] = [gems_gem_home]
|
103
105
|
end
|
@@ -171,24 +173,17 @@ module Autoproj
|
|
171
173
|
# (see #local?)
|
172
174
|
attr_writer :local
|
173
175
|
|
174
|
-
# The
|
175
|
-
def self.dot_gem_dir
|
176
|
-
if Gem.respond_to?(:data_home) # Debian 11+
|
177
|
-
File.join(Gem.data_home, "gem")
|
178
|
-
else
|
179
|
-
File.join(Gem.user_home, ".gem")
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# The version and platform-specific suffix under {#dot_gem_dir}
|
176
|
+
# The version and platform-specific suffix
|
184
177
|
#
|
185
178
|
# This is also the suffix used by bundler to install gems
|
186
179
|
def self.gems_path_suffix
|
187
|
-
@gems_path_suffix
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
180
|
+
return @gems_path_suffix if @gem_path_suffix
|
181
|
+
|
182
|
+
parts = [Gem.ruby_engine]
|
183
|
+
unless RbConfig::CONFIG["ruby_version"].empty?
|
184
|
+
parts << RbConfig::CONFIG["ruby_version"]
|
185
|
+
end
|
186
|
+
@gems_path_suffix = File.join parts
|
192
187
|
end
|
193
188
|
|
194
189
|
# The path into which the workspace's gems should be installed
|
@@ -219,21 +214,21 @@ module Autoproj
|
|
219
214
|
end
|
220
215
|
end
|
221
216
|
|
222
|
-
#
|
223
|
-
def
|
217
|
+
# Get autoproj's default path for installing gems
|
218
|
+
def default_gems_install_path
|
224
219
|
xdg_default_gem_path = xdg_var("XDG_DATA_HOME",
|
225
220
|
File.join(Dir.home, ".local", "share", "autoproj", "gems"))
|
226
221
|
default_gem_path = File.join(
|
227
222
|
Dir.home, ".autoproj", "gems"
|
228
223
|
)
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
224
|
+
|
225
|
+
if File.directory?(xdg_default_gem_path)
|
226
|
+
xdg_default_gem_path
|
227
|
+
elsif File.directory?(default_gem_path)
|
228
|
+
default_gem_path
|
229
|
+
else
|
230
|
+
xdg_default_gem_path
|
231
|
+
end
|
237
232
|
end
|
238
233
|
|
239
234
|
# Whether autoproj should prefer OS-independent packages over their
|
@@ -269,11 +264,10 @@ module Autoproj
|
|
269
264
|
# @param [String] autoproj_version a constraint on the autoproj version
|
270
265
|
# that should be used
|
271
266
|
# @return [String]
|
272
|
-
def default_gemfile_contents(autoproj_version = ">= 2.
|
267
|
+
def default_gemfile_contents(autoproj_version = ">= 2.16.0")
|
273
268
|
["source \"#{gem_source}\"",
|
274
269
|
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
|
275
|
-
"gem \"autoproj\", \"#{autoproj_version}\""
|
276
|
-
"gem \"utilrb\", \">= 3.0.1\""].join("\n")
|
270
|
+
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
|
277
271
|
end
|
278
272
|
|
279
273
|
def add_seed_config(path)
|
@@ -297,11 +291,12 @@ module Autoproj
|
|
297
291
|
@gem_source = url
|
298
292
|
end
|
299
293
|
opt.on "--gems-path=PATH", "install gems under this path instead "\
|
300
|
-
"of
|
301
|
-
|
294
|
+
"of #{default_gems_install_path} (do not use with --public-gems)" do |path|
|
295
|
+
@gems_install_path = path
|
302
296
|
end
|
303
|
-
opt.on "--public-gems", "install gems in the default gem location"
|
304
|
-
|
297
|
+
opt.on "--public-gems", "install gems in the default gem location: #{default_gems_install_path}"\
|
298
|
+
" (do not use with --gems-path)" do
|
299
|
+
@gems_install_path = default_gems_install_path
|
305
300
|
end
|
306
301
|
opt.on "--bundler-version=VERSION_CONSTRAINT", String, "use the provided "\
|
307
302
|
"string as a version constraint for bundler" do |version|
|
@@ -323,6 +318,7 @@ module Autoproj
|
|
323
318
|
"when reinstalling an existing autoproj workspace, do not "\
|
324
319
|
"use the config in .autoproj/ as seed" do
|
325
320
|
@config.clear
|
321
|
+
@config["bundler_version"] = Install.default_bundler_version
|
326
322
|
end
|
327
323
|
opt.on "--seed-config=PATH", String, "path to a seed file that "\
|
328
324
|
"should be used to initialize the configuration" do |path|
|
@@ -756,11 +752,21 @@ require 'bundler/setup'
|
|
756
752
|
end
|
757
753
|
|
758
754
|
@config = config
|
755
|
+
@config["bundler_version"] ||= self.class.default_bundler_version
|
756
|
+
|
759
757
|
%w[gems_install_path prefer_indep_over_os_packages].each do |flag|
|
760
758
|
instance_variable_set "@#{flag}", config.fetch(flag, false)
|
761
759
|
end
|
762
760
|
end
|
763
761
|
|
762
|
+
def self.default_bundler_version
|
763
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6.0")
|
764
|
+
"2.3.6"
|
765
|
+
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
|
766
|
+
"2.4.22"
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
764
770
|
def save_config
|
765
771
|
config["gems_install_path"] = gems_install_path
|
766
772
|
config["prefer_indep_over_os_packages"] = prefer_indep_over_os_packages?
|
data/bin/autoproj_install
CHANGED
@@ -97,7 +97,9 @@ module Autoproj
|
|
97
97
|
@ruby_executable = config["ruby_executable"]
|
98
98
|
@local = false
|
99
99
|
|
100
|
-
|
100
|
+
@gems_install_path ||= default_gems_install_path
|
101
|
+
@gems_install_path = File.expand_path(@gems_install_path)
|
102
|
+
|
101
103
|
env["GEM_HOME"] = [gems_gem_home]
|
102
104
|
env["GEM_PATH"] = [gems_gem_home]
|
103
105
|
end
|
@@ -171,24 +173,17 @@ module Autoproj
|
|
171
173
|
# (see #local?)
|
172
174
|
attr_writer :local
|
173
175
|
|
174
|
-
# The
|
175
|
-
def self.dot_gem_dir
|
176
|
-
if Gem.respond_to?(:data_home) # Debian 11+
|
177
|
-
File.join(Gem.data_home, "gem")
|
178
|
-
else
|
179
|
-
File.join(Gem.user_home, ".gem")
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
# The version and platform-specific suffix under {#dot_gem_dir}
|
176
|
+
# The version and platform-specific suffix
|
184
177
|
#
|
185
178
|
# This is also the suffix used by bundler to install gems
|
186
179
|
def self.gems_path_suffix
|
187
|
-
@gems_path_suffix
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
180
|
+
return @gems_path_suffix if @gem_path_suffix
|
181
|
+
|
182
|
+
parts = [Gem.ruby_engine]
|
183
|
+
unless RbConfig::CONFIG["ruby_version"].empty?
|
184
|
+
parts << RbConfig::CONFIG["ruby_version"]
|
185
|
+
end
|
186
|
+
@gems_path_suffix = File.join parts
|
192
187
|
end
|
193
188
|
|
194
189
|
# The path into which the workspace's gems should be installed
|
@@ -219,21 +214,21 @@ module Autoproj
|
|
219
214
|
end
|
220
215
|
end
|
221
216
|
|
222
|
-
#
|
223
|
-
def
|
217
|
+
# Get autoproj's default path for installing gems
|
218
|
+
def default_gems_install_path
|
224
219
|
xdg_default_gem_path = xdg_var("XDG_DATA_HOME",
|
225
220
|
File.join(Dir.home, ".local", "share", "autoproj", "gems"))
|
226
221
|
default_gem_path = File.join(
|
227
222
|
Dir.home, ".autoproj", "gems"
|
228
223
|
)
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
224
|
+
|
225
|
+
if File.directory?(xdg_default_gem_path)
|
226
|
+
xdg_default_gem_path
|
227
|
+
elsif File.directory?(default_gem_path)
|
228
|
+
default_gem_path
|
229
|
+
else
|
230
|
+
xdg_default_gem_path
|
231
|
+
end
|
237
232
|
end
|
238
233
|
|
239
234
|
# Whether autoproj should prefer OS-independent packages over their
|
@@ -269,11 +264,10 @@ module Autoproj
|
|
269
264
|
# @param [String] autoproj_version a constraint on the autoproj version
|
270
265
|
# that should be used
|
271
266
|
# @return [String]
|
272
|
-
def default_gemfile_contents(autoproj_version = ">= 2.
|
267
|
+
def default_gemfile_contents(autoproj_version = ">= 2.16.0")
|
273
268
|
["source \"#{gem_source}\"",
|
274
269
|
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
|
275
|
-
"gem \"autoproj\", \"#{autoproj_version}\""
|
276
|
-
"gem \"utilrb\", \">= 3.0.1\""].join("\n")
|
270
|
+
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
|
277
271
|
end
|
278
272
|
|
279
273
|
def add_seed_config(path)
|
@@ -297,11 +291,12 @@ module Autoproj
|
|
297
291
|
@gem_source = url
|
298
292
|
end
|
299
293
|
opt.on "--gems-path=PATH", "install gems under this path instead "\
|
300
|
-
"of
|
301
|
-
|
294
|
+
"of #{default_gems_install_path} (do not use with --public-gems)" do |path|
|
295
|
+
@gems_install_path = path
|
302
296
|
end
|
303
|
-
opt.on "--public-gems", "install gems in the default gem location"
|
304
|
-
|
297
|
+
opt.on "--public-gems", "install gems in the default gem location: #{default_gems_install_path}"\
|
298
|
+
" (do not use with --gems-path)" do
|
299
|
+
@gems_install_path = default_gems_install_path
|
305
300
|
end
|
306
301
|
opt.on "--bundler-version=VERSION_CONSTRAINT", String, "use the provided "\
|
307
302
|
"string as a version constraint for bundler" do |version|
|
@@ -323,6 +318,7 @@ module Autoproj
|
|
323
318
|
"when reinstalling an existing autoproj workspace, do not "\
|
324
319
|
"use the config in .autoproj/ as seed" do
|
325
320
|
@config.clear
|
321
|
+
@config["bundler_version"] = Install.default_bundler_version
|
326
322
|
end
|
327
323
|
opt.on "--seed-config=PATH", String, "path to a seed file that "\
|
328
324
|
"should be used to initialize the configuration" do |path|
|
@@ -756,11 +752,21 @@ require 'bundler/setup'
|
|
756
752
|
end
|
757
753
|
|
758
754
|
@config = config
|
755
|
+
@config["bundler_version"] ||= self.class.default_bundler_version
|
756
|
+
|
759
757
|
%w[gems_install_path prefer_indep_over_os_packages].each do |flag|
|
760
758
|
instance_variable_set "@#{flag}", config.fetch(flag, false)
|
761
759
|
end
|
762
760
|
end
|
763
761
|
|
762
|
+
def self.default_bundler_version
|
763
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6.0")
|
764
|
+
"2.3.6"
|
765
|
+
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
|
766
|
+
"2.4.22"
|
767
|
+
end
|
768
|
+
end
|
769
|
+
|
764
770
|
def save_config
|
765
771
|
config["gems_install_path"] = gems_install_path
|
766
772
|
config["prefer_indep_over_os_packages"] = prefer_indep_over_os_packages?
|
@@ -268,11 +268,6 @@ module Autoproj
|
|
268
268
|
set("parallel_import_level", level)
|
269
269
|
end
|
270
270
|
|
271
|
-
# The user-wide place where RubyGems installs gems
|
272
|
-
def self.dot_gem_dir
|
273
|
-
Ops::Install.dot_gem_dir
|
274
|
-
end
|
275
|
-
|
276
271
|
# The Ruby platform and version-specific subdirectory used by bundler and rubygem
|
277
272
|
def self.gems_path_suffix
|
278
273
|
Ops::Install.gems_path_suffix
|
data/lib/autoproj/default.osdeps
CHANGED
@@ -93,10 +93,13 @@ ruby25:
|
|
93
93
|
default: ignore # we assume that if the user has a ruby 2.5 runtime, it is usable
|
94
94
|
|
95
95
|
ruby26:
|
96
|
-
default: ignore # we assume that if the user has a ruby 2.
|
96
|
+
default: ignore # we assume that if the user has a ruby 2.6 runtime, it is usable
|
97
97
|
|
98
98
|
ruby27:
|
99
|
-
default: ignore # we assume that if the user has a ruby 2.
|
99
|
+
default: ignore # we assume that if the user has a ruby 2.7 runtime, it is usable
|
100
|
+
|
101
|
+
ruby30:
|
102
|
+
default: ignore # we assume that if the user has a ruby 3.0 runtime, it is usable
|
100
103
|
|
101
104
|
build-essential:
|
102
105
|
debian,ubuntu: build-essential
|
data/lib/autoproj/manifest.rb
CHANGED
@@ -1015,7 +1015,8 @@ module Autoproj
|
|
1015
1015
|
"no package.xml file" unless File.file?(manifest_path)
|
1016
1016
|
|
1017
1017
|
manifest = PackageManifest.load(package, manifest_path,
|
1018
|
-
ros_manifest: true
|
1018
|
+
ros_manifest: true,
|
1019
|
+
condition_context: @ws.env)
|
1019
1020
|
else
|
1020
1021
|
manifest_paths = [File.join(package.srcdir, "manifest.xml")]
|
1021
1022
|
if package_set.local_dir
|
@@ -1028,7 +1029,8 @@ module Autoproj
|
|
1028
1029
|
end
|
1029
1030
|
if manifest_path
|
1030
1031
|
manifest = PackageManifest.load(package, manifest_path,
|
1031
|
-
ros_manifest: false
|
1032
|
+
ros_manifest: false,
|
1033
|
+
condition_context: @ws.config)
|
1032
1034
|
end
|
1033
1035
|
end
|
1034
1036
|
|
@@ -1,37 +1,74 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "tempfile"
|
4
|
+
require "fileutils"
|
5
|
+
|
1
6
|
module Autoproj
|
2
7
|
module Ops
|
8
|
+
# Write to a file atomically. Useful for situations where you don't
|
9
|
+
# want other processes or threads to see half-written files.
|
10
|
+
#
|
11
|
+
# File.atomic_write('important.file') do |file|
|
12
|
+
# file.write('hello')
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# This method needs to create a temporary file. By default it will create it
|
16
|
+
# in the same directory as the destination file. If you don't like this
|
17
|
+
# behavior you can provide a different directory but it must be on the
|
18
|
+
# same physical filesystem as the file you're trying to write.
|
19
|
+
#
|
20
|
+
# File.atomic_write('/data/something.important', '/data/tmp') do |file|
|
21
|
+
# file.write('hello')
|
22
|
+
# end
|
23
|
+
#
|
3
24
|
# Shamelessly stolen from ActiveSupport
|
4
|
-
def self.atomic_write(file_name, temp_dir =
|
5
|
-
|
6
|
-
|
25
|
+
def self.atomic_write(file_name, temp_dir = File.dirname(file_name))
|
26
|
+
Tempfile.open(".#{File.basename(file_name)}", temp_dir) do |temp_file|
|
27
|
+
temp_file.binmode
|
28
|
+
yield temp_file
|
29
|
+
temp_file.close
|
7
30
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
31
|
+
old_stat = begin
|
32
|
+
# Get original file permissions
|
33
|
+
File.stat(file_name)
|
34
|
+
rescue Errno::ENOENT
|
35
|
+
# If not possible, probe which are the default permissions in the
|
36
|
+
# destination directory.
|
37
|
+
probe_stat_in(File.dirname(file_name))
|
38
|
+
end
|
15
39
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
40
|
+
if old_stat
|
41
|
+
# Set correct permissions on new file
|
42
|
+
begin
|
43
|
+
File.chown(old_stat.uid, old_stat.gid, temp_file.path)
|
44
|
+
# This operation will affect filesystem ACL's
|
45
|
+
File.chmod(old_stat.mode, temp_file.path)
|
46
|
+
rescue Errno::EPERM, Errno::EACCES
|
47
|
+
# Changing file ownership failed, moving on.
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Overwrite original file with temp file
|
52
|
+
File.rename(temp_file.path, file_name)
|
27
53
|
end
|
54
|
+
end
|
28
55
|
|
29
|
-
|
30
|
-
|
56
|
+
# Private utility method.
|
57
|
+
def self.probe_stat_in(dir) # :nodoc:
|
58
|
+
basename = [
|
59
|
+
".permissions_check",
|
60
|
+
Thread.current.object_id,
|
61
|
+
Process.pid,
|
62
|
+
rand(1000000)
|
63
|
+
].join(".")
|
31
64
|
|
32
|
-
|
33
|
-
|
34
|
-
File.
|
65
|
+
file_name = File.join(dir, basename)
|
66
|
+
FileUtils.touch(file_name)
|
67
|
+
File.stat(file_name)
|
68
|
+
rescue Errno::ENOENT
|
69
|
+
file_name = nil
|
70
|
+
ensure
|
71
|
+
FileUtils.rm_f(file_name) if file_name
|
35
72
|
end
|
36
73
|
end
|
37
74
|
end
|
data/lib/autoproj/ops/install.rb
CHANGED
@@ -87,7 +87,9 @@ module Autoproj
|
|
87
87
|
@ruby_executable = config["ruby_executable"]
|
88
88
|
@local = false
|
89
89
|
|
90
|
-
|
90
|
+
@gems_install_path ||= default_gems_install_path
|
91
|
+
@gems_install_path = File.expand_path(@gems_install_path)
|
92
|
+
|
91
93
|
env["GEM_HOME"] = [gems_gem_home]
|
92
94
|
env["GEM_PATH"] = [gems_gem_home]
|
93
95
|
end
|
@@ -161,24 +163,17 @@ module Autoproj
|
|
161
163
|
# (see #local?)
|
162
164
|
attr_writer :local
|
163
165
|
|
164
|
-
# The
|
165
|
-
def self.dot_gem_dir
|
166
|
-
if Gem.respond_to?(:data_home) # Debian 11+
|
167
|
-
File.join(Gem.data_home, "gem")
|
168
|
-
else
|
169
|
-
File.join(Gem.user_home, ".gem")
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
# The version and platform-specific suffix under {#dot_gem_dir}
|
166
|
+
# The version and platform-specific suffix
|
174
167
|
#
|
175
168
|
# This is also the suffix used by bundler to install gems
|
176
169
|
def self.gems_path_suffix
|
177
|
-
@gems_path_suffix
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
170
|
+
return @gems_path_suffix if @gem_path_suffix
|
171
|
+
|
172
|
+
parts = [Gem.ruby_engine]
|
173
|
+
unless RbConfig::CONFIG["ruby_version"].empty?
|
174
|
+
parts << RbConfig::CONFIG["ruby_version"]
|
175
|
+
end
|
176
|
+
@gems_path_suffix = File.join parts
|
182
177
|
end
|
183
178
|
|
184
179
|
# The path into which the workspace's gems should be installed
|
@@ -209,21 +204,21 @@ module Autoproj
|
|
209
204
|
end
|
210
205
|
end
|
211
206
|
|
212
|
-
#
|
213
|
-
def
|
207
|
+
# Get autoproj's default path for installing gems
|
208
|
+
def default_gems_install_path
|
214
209
|
xdg_default_gem_path = xdg_var("XDG_DATA_HOME",
|
215
210
|
File.join(Dir.home, ".local", "share", "autoproj", "gems"))
|
216
211
|
default_gem_path = File.join(
|
217
212
|
Dir.home, ".autoproj", "gems"
|
218
213
|
)
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
214
|
+
|
215
|
+
if File.directory?(xdg_default_gem_path)
|
216
|
+
xdg_default_gem_path
|
217
|
+
elsif File.directory?(default_gem_path)
|
218
|
+
default_gem_path
|
219
|
+
else
|
220
|
+
xdg_default_gem_path
|
221
|
+
end
|
227
222
|
end
|
228
223
|
|
229
224
|
# Whether autoproj should prefer OS-independent packages over their
|
@@ -259,11 +254,10 @@ module Autoproj
|
|
259
254
|
# @param [String] autoproj_version a constraint on the autoproj version
|
260
255
|
# that should be used
|
261
256
|
# @return [String]
|
262
|
-
def default_gemfile_contents(autoproj_version = ">=
|
257
|
+
def default_gemfile_contents(autoproj_version = ">= #{Autoproj::VERSION}")
|
263
258
|
["source \"#{gem_source}\"",
|
264
259
|
"ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
|
265
|
-
"gem \"autoproj\", \"#{autoproj_version}\""
|
266
|
-
"gem \"utilrb\", \">= 3.0.1\""].join("\n")
|
260
|
+
"gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
|
267
261
|
end
|
268
262
|
|
269
263
|
def add_seed_config(path)
|
@@ -287,11 +281,12 @@ module Autoproj
|
|
287
281
|
@gem_source = url
|
288
282
|
end
|
289
283
|
opt.on "--gems-path=PATH", "install gems under this path instead "\
|
290
|
-
"of
|
291
|
-
|
284
|
+
"of #{default_gems_install_path} (do not use with --public-gems)" do |path|
|
285
|
+
@gems_install_path = path
|
292
286
|
end
|
293
|
-
opt.on "--public-gems", "install gems in the default gem location"
|
294
|
-
|
287
|
+
opt.on "--public-gems", "install gems in the default gem location: #{default_gems_install_path}"\
|
288
|
+
" (do not use with --gems-path)" do
|
289
|
+
@gems_install_path = default_gems_install_path
|
295
290
|
end
|
296
291
|
opt.on "--bundler-version=VERSION_CONSTRAINT", String, "use the provided "\
|
297
292
|
"string as a version constraint for bundler" do |version|
|
@@ -313,6 +308,7 @@ module Autoproj
|
|
313
308
|
"when reinstalling an existing autoproj workspace, do not "\
|
314
309
|
"use the config in .autoproj/ as seed" do
|
315
310
|
@config.clear
|
311
|
+
@config["bundler_version"] = Install.default_bundler_version
|
316
312
|
end
|
317
313
|
opt.on "--seed-config=PATH", String, "path to a seed file that "\
|
318
314
|
"should be used to initialize the configuration" do |path|
|
@@ -746,11 +742,21 @@ require 'bundler/setup'
|
|
746
742
|
end
|
747
743
|
|
748
744
|
@config = config
|
745
|
+
@config["bundler_version"] ||= self.class.default_bundler_version
|
746
|
+
|
749
747
|
%w[gems_install_path prefer_indep_over_os_packages].each do |flag|
|
750
748
|
instance_variable_set "@#{flag}", config.fetch(flag, false)
|
751
749
|
end
|
752
750
|
end
|
753
751
|
|
752
|
+
def self.default_bundler_version
|
753
|
+
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.6.0")
|
754
|
+
"2.3.6"
|
755
|
+
elsif Gem::Version.new(RUBY_VERSION) < Gem::Version.new("3.0.0")
|
756
|
+
"2.4.22"
|
757
|
+
end
|
758
|
+
end
|
759
|
+
|
754
760
|
def save_config
|
755
761
|
config["gems_install_path"] = gems_install_path
|
756
762
|
config["prefer_indep_over_os_packages"] = prefer_indep_over_os_packages?
|
@@ -185,7 +185,8 @@ So, what do you want ? (all, none or a comma-separated list of: os gem pip)
|
|
185
185
|
when "gem" then modes << "gem"
|
186
186
|
when "pip" then modes << "pip"
|
187
187
|
when "os" then modes << "os"
|
188
|
-
when "none" then
|
188
|
+
when "none" then
|
189
|
+
# noop
|
189
190
|
else
|
190
191
|
if package_managers.key?(str)
|
191
192
|
modes << str
|
@@ -16,9 +16,10 @@ module Autoproj
|
|
16
16
|
# @param [Boolean] ros_manifest whether the file follows the ROS format
|
17
17
|
# @return [PackageManifest]
|
18
18
|
# @see parse
|
19
|
-
def self.load(package, file, ros_manifest: false)
|
19
|
+
def self.load(package, file, ros_manifest: false, condition_context: nil)
|
20
20
|
loader_class = ros_manifest ? RosPackageManifest::Loader : Loader
|
21
|
-
parse(package, File.read(file), path: file, loader_class: loader_class
|
21
|
+
parse(package, File.read(file), path: file, loader_class: loader_class,
|
22
|
+
condition_context: condition_context)
|
22
23
|
end
|
23
24
|
|
24
25
|
# Create a PackageManifest object from the XML content provided as a
|
@@ -30,15 +31,22 @@ module Autoproj
|
|
30
31
|
# @param [Boolean] ros_manifest whether the file follows the ROS format
|
31
32
|
# @return [PackageManifest]
|
32
33
|
# @see load
|
33
|
-
def self.parse(
|
34
|
-
|
34
|
+
def self.parse(
|
35
|
+
package, contents,
|
36
|
+
path: "<loaded from string>", loader_class: Loader,
|
37
|
+
condition_context: nil
|
38
|
+
)
|
35
39
|
manifest = loader_class::MANIFEST_CLASS.new(package, path)
|
36
|
-
loader = loader_class.new(path, manifest
|
40
|
+
loader = loader_class.new(path, manifest,
|
41
|
+
condition_context: condition_context)
|
37
42
|
begin
|
38
43
|
REXML::Document.parse_stream(contents, loader)
|
39
44
|
rescue REXML::ParseException => e
|
40
45
|
raise Autobuild::PackageException.new(package.name, "prepare"),
|
41
|
-
"invalid #{
|
46
|
+
"invalid #{path}: #{e.message}"
|
47
|
+
rescue Autoproj::ConfigError => e
|
48
|
+
raise Autobuild::PackageException.new(package.name, "prepare"),
|
49
|
+
"invalid #{path}: #{e.message}"
|
42
50
|
end
|
43
51
|
manifest
|
44
52
|
end
|
@@ -181,10 +189,50 @@ module Autoproj
|
|
181
189
|
|
182
190
|
MANIFEST_CLASS = PackageManifest
|
183
191
|
|
184
|
-
def
|
192
|
+
def self.expand_configuration_variable(var, config)
|
193
|
+
prefix = var[0, 1]
|
194
|
+
var = var[1..-1] if prefix == "$"
|
195
|
+
|
196
|
+
if var.start_with?("operating_system_name_")
|
197
|
+
os = config.get("operating_system", nil)
|
198
|
+
return "" if os.nil?
|
199
|
+
|
200
|
+
os_names, = os
|
201
|
+
return "" unless os_names.any? do |name|
|
202
|
+
var == "operating_system_name_#{name}"
|
203
|
+
end
|
204
|
+
|
205
|
+
return "true"
|
206
|
+
end
|
207
|
+
|
208
|
+
if var.start_with?("operating_system_version_")
|
209
|
+
os = config.get("operating_system", nil)
|
210
|
+
return "" if os.nil?
|
211
|
+
|
212
|
+
_, os_versions = os
|
213
|
+
return "" unless os_versions.any? do |ver|
|
214
|
+
var == "operating_system_version_#{ver.gsub(/[.,+-]/, '_')}"
|
215
|
+
end
|
216
|
+
|
217
|
+
return "true"
|
218
|
+
end
|
219
|
+
|
220
|
+
config.get(var)
|
221
|
+
end
|
222
|
+
|
223
|
+
def initialize(path, manifest, condition_context: Configuration.new)
|
185
224
|
super()
|
186
225
|
@path = path
|
187
226
|
@manifest = manifest
|
227
|
+
@condition_parser = RosConditionParser.new do |var|
|
228
|
+
Loader.expand_configuration_variable(var, condition_context)
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
def handle_condition(expr)
|
233
|
+
return true unless expr && !expr.empty?
|
234
|
+
|
235
|
+
@condition_parser.evaluate(expr)
|
188
236
|
end
|
189
237
|
|
190
238
|
def parse_depend_tag(tag_name, attributes, modes: [], optional: false)
|
@@ -195,6 +243,8 @@ module Autoproj
|
|
195
243
|
"without a 'package' attribute"
|
196
244
|
end
|
197
245
|
|
246
|
+
return unless handle_condition(attributes["condition"])
|
247
|
+
|
198
248
|
if (tag_modes = attributes["modes"])
|
199
249
|
modes += tag_modes.split(",")
|
200
250
|
end
|
@@ -8,15 +8,13 @@ module Autoproj
|
|
8
8
|
# Parses a conditional expression
|
9
9
|
# Syntax and rules as defined in https://www.ros.org/reps/rep-0149.html#id20
|
10
10
|
class RosConditionParser < Parslet::Parser
|
11
|
-
def initialize(
|
12
|
-
@
|
11
|
+
def initialize(&expander)
|
12
|
+
@expander = expander
|
13
13
|
super()
|
14
14
|
end
|
15
15
|
|
16
16
|
def expand(var)
|
17
|
-
|
18
|
-
rescue StandardError
|
19
|
-
""
|
17
|
+
@expander.call(var)
|
20
18
|
end
|
21
19
|
|
22
20
|
# Evaluates the Abstract Syntax Tree generated by the parser
|
@@ -23,10 +23,13 @@ module Autoproj
|
|
23
23
|
buildtool_depend buildtool_export_depend
|
24
24
|
exec_depend test_depend run_depend doc_depend].to_set.freeze
|
25
25
|
|
26
|
-
def initialize(path, manifest)
|
26
|
+
def initialize(path, manifest, condition_context: {})
|
27
27
|
super
|
28
|
-
@
|
29
|
-
|
28
|
+
@condition_parser = RosConditionParser.new do |var|
|
29
|
+
Autoproj.expand(var, condition_context)
|
30
|
+
rescue StandardError
|
31
|
+
""
|
32
|
+
end
|
30
33
|
end
|
31
34
|
|
32
35
|
def tag_start(name, attributes)
|
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
|
-
version: 2.
|
4
|
+
version: 2.17.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:
|
11
|
+
date: 2024-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: autobuild
|
@@ -202,16 +202,16 @@ dependencies:
|
|
202
202
|
name: aruba
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
|
-
- - "
|
205
|
+
- - "~>"
|
206
206
|
- !ruby/object:Gem::Version
|
207
|
-
version:
|
207
|
+
version: 2.1.0
|
208
208
|
type: :development
|
209
209
|
prerelease: false
|
210
210
|
version_requirements: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
|
-
- - "
|
212
|
+
- - "~>"
|
213
213
|
- !ruby/object:Gem::Version
|
214
|
-
version:
|
214
|
+
version: 2.1.0
|
215
215
|
- !ruby/object:Gem::Dependency
|
216
216
|
name: flexmock
|
217
217
|
requirement: !ruby/object:Gem::Requirement
|