autoproj 2.18.0 → 2.18.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e19c3ca78afb4d42f58b65effbed3ff1aed2fe83210e6fa2ee0d46ed12793430
4
- data.tar.gz: 2b1a0802811156df47ac64a869f9ccf1de2ba5734d6d0316d2f857a5b18fa638
3
+ metadata.gz: f4c228e4f98b8c247f2d74a03df462fcea6692ff2b4d5a27bf066675bb6cfe20
4
+ data.tar.gz: ee3eaf3c0fcdb93b748f3e3a0885fd728284a097a2004e58acef278b2af167dd
5
5
  SHA512:
6
- metadata.gz: b46ab523d1b83ef75128c8707d65899b8eb770706b391252bb1826578acc6505ad67169964ef9e9c1c7653962d8ed50ff5e20a6b48d765a2298afbcdf5c973c1
7
- data.tar.gz: 21cc35037beb50b30ee0879c680b9c68ef401c07c394270b8d1e81ae678f8e9c931b53b35bc205b877224b440e745674cd48e49cf566aef575332324a309516c
6
+ metadata.gz: 79ab87db2b465d8e128bceef8d00da1286f68dd13978207bf812a1aa1e599b81b456abdf80f2d2deed5e627475a955c55e12ea5e6a5358d1183ae8184c4500cd
7
+ data.tar.gz: 544195c982e911442c4475e07a7ebc7edc533e866ea386fd141d80d29b1a5ae6a092e79992be22f2e10f70c89027f787ec14c24e88cbdc267ed08ba199a33680
@@ -8,8 +8,8 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: ["2.7", "2.6", "2.5"]
12
-
11
+ ruby-version: ["3.2", "3.1", "2.7"]
12
+ continue-on-error: true
13
13
  steps:
14
14
  - uses: actions/checkout@v2
15
15
  - name: Set up Ruby ${{ matrix.ruby-version }}
@@ -8,8 +8,8 @@ jobs:
8
8
 
9
9
  strategy:
10
10
  matrix:
11
- ruby-version: ["2.7", "2.6", "2.5"]
12
-
11
+ ruby-version: ["3.2", "3.1", "2.7"]
12
+ continue-on-error: true
13
13
  steps:
14
14
  - uses: actions/checkout@v2
15
15
  - name: Set up Ruby ${{ matrix.ruby-version }}
data/.gitignore CHANGED
@@ -9,3 +9,5 @@ pkg/
9
9
  /.yardoc/
10
10
  test/gem_home
11
11
  tmp/
12
+
13
+ Gemfile.lock
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "https://rubygems.org"
2
2
 
3
3
  gem "autobuild", git: "https://github.com/rock-core/autobuild", branch: "master"
4
+ gem "rubygems-server" unless RUBY_VERSION < "3"
4
5
 
5
6
  group :dev do
6
7
  gem "rubocop", "~> 1.28.0"
@@ -14,4 +15,5 @@ group :vscode do
14
15
  gem "ruby-debug-ide", ">= 0.6.0"
15
16
  gem "solargraph"
16
17
  end
18
+
17
19
  gemspec
data/README.md CHANGED
@@ -245,12 +245,9 @@ work with it on an existing workspace.
245
245
  Run
246
246
 
247
247
  ~~~
248
- bundle install --path=vendor
248
+ bundle install
249
249
  ~~~
250
250
 
251
- Note that Autoproj's own test suite assumes that Bundler is setup with
252
- `--path=vendor`. Keep it that way
253
-
254
251
  To run the test suite,
255
252
 
256
253
  ~~~
data/autoproj.gemspec CHANGED
@@ -36,10 +36,10 @@ Gem::Specification.new do |s|
36
36
  s.add_runtime_dependency "tty-color", "~> 0.5.0"
37
37
  s.add_runtime_dependency "tty-prompt", "~> 0.21.0"
38
38
  s.add_runtime_dependency "tty-spinner", "~> 0.9.0"
39
- s.add_runtime_dependency "utilrb", "~> 3.0.0", ">= 3.0.0"
39
+ s.add_runtime_dependency "utilrb", "~> 3.0", ">= 3.0"
40
40
  s.add_runtime_dependency "xdg", "= 2.2.5"
41
41
  s.add_development_dependency "aruba", "~> 2.1.0"
42
- s.add_development_dependency "flexmock", "~> 2.0", ">= 2.0.0"
42
+ s.add_development_dependency "flexmock"
43
43
  s.add_development_dependency "minitest", "~> 5.0", ">= 5.0"
44
44
  s.add_development_dependency "simplecov"
45
45
  s.add_development_dependency "timecop"
@@ -85,7 +85,9 @@ module Autoproj
85
85
  env["RUBYLIB"] = []
86
86
  env["PATH"] = self.class.sanitize_env(ENV["PATH"] || "")
87
87
  env["BUNDLE_GEMFILE"] = []
88
-
88
+ env["BUNDLER_VERSION"] = []
89
+ env["BUNDLER_SETUP"] = []
90
+ env["BUNDLE_BIN_PATH"] = []
89
91
  load_config
90
92
 
91
93
  if config["ruby_executable"] != Gem.ruby
@@ -264,7 +266,7 @@ module Autoproj
264
266
  # @param [String] autoproj_version a constraint on the autoproj version
265
267
  # that should be used
266
268
  # @return [String]
267
- def default_gemfile_contents(autoproj_version = ">= 2.17.0")
269
+ def default_gemfile_contents(autoproj_version = ">= 2.18.0")
268
270
  ["source \"#{gem_source}\"",
269
271
  "ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
270
272
  "gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
@@ -444,25 +446,46 @@ module Autoproj
444
446
  end
445
447
  end
446
448
 
449
+ def write_bundle_shim(bundle_shim_path)
450
+ contents = <<~BUNDLERSHIM
451
+ #!#{Gem.ruby}
452
+ ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
453
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
454
+ ENV['GEM_HOME'] = '#{gems_gem_home}'
455
+ ENV.delete('GEM_PATH')
456
+ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
457
+ exec "#{File.join(gems_gem_home, 'bin', 'bundle')}", *ARGV
458
+ BUNDLERSHIM
459
+
460
+ File.write(bundle_shim_path, contents)
461
+ FileUtils.chmod 0755, bundle_shim_path
462
+ end
463
+
447
464
  def install_autoproj(bundler, bundler_version: self.bundler_version)
448
465
  # Force bundler to update. If the user does not want this, let
449
466
  # him specify a Gemfile with tighter version constraints
450
467
  lockfile = File.join(dot_autoproj, "Gemfile.lock")
468
+ shims_path = File.join(dot_autoproj, "bin")
451
469
  FileUtils.rm lockfile if File.exist?(lockfile)
452
470
 
453
471
  run_bundler(bundler, "config", "set", "--local", "path", gems_install_path,
454
472
  bundler_version: bundler_version)
455
473
  run_bundler(bundler, "config", "set", "--local", "shebang", Gem.ruby,
456
474
  bundler_version: bundler_version)
475
+ run_bundler(bundler, "config", "set", "--local", "bin", shims_path,
476
+ bundler_version: bundler_version)
457
477
 
458
478
  install_args = ["--gemfile=#{autoproj_gemfile_path}"]
459
479
  install_args << "--local" if local?
460
480
  run_bundler(bundler, "install", *install_args,
461
481
  bundler_version: bundler_version)
462
482
 
463
- shims_path = File.join(dot_autoproj, "bin")
464
- run_bundler(bundler, "binstubs", "--all", "--force", "--path", shims_path,
483
+ run_bundler(bundler, "binstubs", "--all", "--force",
465
484
  bundler_version: bundler_version)
485
+
486
+ bundle_shim_path = File.join(shims_path, "bundle")
487
+ write_bundle_shim(bundle_shim_path) unless File.exist?(bundle_shim_path)
488
+
466
489
  self.class.rewrite_shims(
467
490
  shims_path, ruby_executable, root_dir,
468
491
  autoproj_gemfile_path, gems_gem_home
@@ -551,6 +574,7 @@ module Autoproj
551
574
  # Autoproj generated preamble
552
575
  #{WITHOUT_BUNDLER}
553
576
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
577
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
554
578
  ENV['GEM_HOME'] = '#{gems_gem_home}'
555
579
  ENV.delete('GEM_PATH')
556
580
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -563,6 +587,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
563
587
 
564
588
  #{WITHOUT_BUNDLER}
565
589
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
590
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
566
591
  ENV['GEM_HOME'] = '#{gems_gem_home}'
567
592
  ENV.delete('GEM_PATH')
568
593
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -588,6 +613,7 @@ load Gem.bin_path('bundler', 'bundler')"
588
613
  # Autoproj generated preamble, v1
589
614
  #{RUBYLIB_REINIT}
590
615
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
616
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
591
617
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
592
618
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
593
619
  AUTOPROJ_PREAMBLE
@@ -600,6 +626,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
600
626
 
601
627
  #{RUBYLIB_REINIT}
602
628
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
629
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
603
630
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
604
631
  require 'rubygems'
605
632
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
data/bin/autoproj_install CHANGED
@@ -85,7 +85,9 @@ module Autoproj
85
85
  env["RUBYLIB"] = []
86
86
  env["PATH"] = self.class.sanitize_env(ENV["PATH"] || "")
87
87
  env["BUNDLE_GEMFILE"] = []
88
-
88
+ env["BUNDLER_VERSION"] = []
89
+ env["BUNDLER_SETUP"] = []
90
+ env["BUNDLE_BIN_PATH"] = []
89
91
  load_config
90
92
 
91
93
  if config["ruby_executable"] != Gem.ruby
@@ -264,7 +266,7 @@ module Autoproj
264
266
  # @param [String] autoproj_version a constraint on the autoproj version
265
267
  # that should be used
266
268
  # @return [String]
267
- def default_gemfile_contents(autoproj_version = ">= 2.17.0")
269
+ def default_gemfile_contents(autoproj_version = ">= 2.18.0")
268
270
  ["source \"#{gem_source}\"",
269
271
  "ruby \"#{RUBY_VERSION}\" if respond_to?(:ruby)",
270
272
  "gem \"autoproj\", \"#{autoproj_version}\""].join("\n")
@@ -444,25 +446,46 @@ module Autoproj
444
446
  end
445
447
  end
446
448
 
449
+ def write_bundle_shim(bundle_shim_path)
450
+ contents = <<~BUNDLERSHIM
451
+ #!#{Gem.ruby}
452
+ ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
453
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
454
+ ENV['GEM_HOME'] = '#{gems_gem_home}'
455
+ ENV.delete('GEM_PATH')
456
+ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
457
+ exec "#{File.join(gems_gem_home, 'bin', 'bundle')}", *ARGV
458
+ BUNDLERSHIM
459
+
460
+ File.write(bundle_shim_path, contents)
461
+ FileUtils.chmod 0755, bundle_shim_path
462
+ end
463
+
447
464
  def install_autoproj(bundler, bundler_version: self.bundler_version)
448
465
  # Force bundler to update. If the user does not want this, let
449
466
  # him specify a Gemfile with tighter version constraints
450
467
  lockfile = File.join(dot_autoproj, "Gemfile.lock")
468
+ shims_path = File.join(dot_autoproj, "bin")
451
469
  FileUtils.rm lockfile if File.exist?(lockfile)
452
470
 
453
471
  run_bundler(bundler, "config", "set", "--local", "path", gems_install_path,
454
472
  bundler_version: bundler_version)
455
473
  run_bundler(bundler, "config", "set", "--local", "shebang", Gem.ruby,
456
474
  bundler_version: bundler_version)
475
+ run_bundler(bundler, "config", "set", "--local", "bin", shims_path,
476
+ bundler_version: bundler_version)
457
477
 
458
478
  install_args = ["--gemfile=#{autoproj_gemfile_path}"]
459
479
  install_args << "--local" if local?
460
480
  run_bundler(bundler, "install", *install_args,
461
481
  bundler_version: bundler_version)
462
482
 
463
- shims_path = File.join(dot_autoproj, "bin")
464
- run_bundler(bundler, "binstubs", "--all", "--force", "--path", shims_path,
483
+ run_bundler(bundler, "binstubs", "--all", "--force",
465
484
  bundler_version: bundler_version)
485
+
486
+ bundle_shim_path = File.join(shims_path, "bundle")
487
+ write_bundle_shim(bundle_shim_path) unless File.exist?(bundle_shim_path)
488
+
466
489
  self.class.rewrite_shims(
467
490
  shims_path, ruby_executable, root_dir,
468
491
  autoproj_gemfile_path, gems_gem_home
@@ -551,6 +574,7 @@ module Autoproj
551
574
  # Autoproj generated preamble
552
575
  #{WITHOUT_BUNDLER}
553
576
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
577
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
554
578
  ENV['GEM_HOME'] = '#{gems_gem_home}'
555
579
  ENV.delete('GEM_PATH')
556
580
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -563,6 +587,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
563
587
 
564
588
  #{WITHOUT_BUNDLER}
565
589
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
590
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
566
591
  ENV['GEM_HOME'] = '#{gems_gem_home}'
567
592
  ENV.delete('GEM_PATH')
568
593
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -588,6 +613,7 @@ load Gem.bin_path('bundler', 'bundler')"
588
613
  # Autoproj generated preamble, v1
589
614
  #{RUBYLIB_REINIT}
590
615
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
616
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
591
617
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
592
618
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
593
619
  AUTOPROJ_PREAMBLE
@@ -600,6 +626,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
600
626
 
601
627
  #{RUBYLIB_REINIT}
602
628
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
629
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
603
630
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
604
631
  require 'rubygems'
605
632
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -28,10 +28,11 @@ module Autoproj
28
28
  desc: "controls whether the dependencies of the packages given on the command line should be enabled as well (the default is not)"
29
29
  def enable(*packages)
30
30
  require "autoproj/cli/doc"
31
+ options = self.options.merge(parent_options)
31
32
  report(silent: true) do
32
33
  cli = Doc.new
33
- args = cli.validate_options(packages, options)
34
- cli.enable(*args)
34
+ *args, options = cli.validate_options(packages, options)
35
+ cli.enable(*args, **options)
35
36
  end
36
37
  end
37
38
 
@@ -40,10 +41,11 @@ module Autoproj
40
41
  desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
41
42
  def disable(*packages)
42
43
  require "autoproj/cli/doc"
44
+ options = self.options.merge(parent_options)
43
45
  report(silent: true) do
44
46
  cli = Doc.new
45
- args = cli.validate_options(packages, options)
46
- cli.disable(*args)
47
+ *args, options = cli.validate_options(packages, options)
48
+ cli.disable(*args, **options)
47
49
  end
48
50
  end
49
51
 
@@ -52,10 +54,11 @@ module Autoproj
52
54
  desc: "controls whether the dependencies of the packages given on the command line should be disabled as well (the default is not)"
53
55
  def list(*packages)
54
56
  require "autoproj/cli/doc"
57
+ options = self.options.merge(parent_options)
55
58
  report(silent: true) do
56
59
  cli = Doc.new
57
- args = cli.validate_options(packages, options)
58
- cli.list(*args)
60
+ *args, options = cli.validate_options(packages, options)
61
+ cli.list(*args, **options)
59
62
  end
60
63
  end
61
64
 
@@ -78,8 +81,8 @@ module Autoproj
78
81
  report do |extra_options|
79
82
  cli = Doc.new
80
83
  options.delete(:tool)
81
- args = cli.validate_options(packages, options.merge(extra_options))
82
- cli.run(*args)
84
+ *args, options = cli.validate_options(packages, options.merge(extra_options))
85
+ cli.run(*args, **options)
83
86
  end
84
87
  end
85
88
  end
@@ -45,8 +45,9 @@ module Autoproj
45
45
  require "autoproj/cli/test"
46
46
  report(silent: true) do
47
47
  cli = Test.new
48
- args = cli.validate_options(packages, options)
49
- cli.enable(*args)
48
+ options = self.options.merge(parent_options)
49
+ *args, options = cli.validate_options(packages, options)
50
+ cli.enable(*args, **options)
50
51
  end
51
52
  end
52
53
 
@@ -57,8 +58,9 @@ module Autoproj
57
58
  require "autoproj/cli/test"
58
59
  report(silent: true) do
59
60
  cli = Test.new
60
- args = cli.validate_options(packages, options)
61
- cli.disable(*args)
61
+ options = self.options.merge(parent_options)
62
+ *args, options = cli.validate_options(packages, options)
63
+ cli.disable(*args, **options)
62
64
  end
63
65
  end
64
66
 
@@ -69,8 +71,9 @@ module Autoproj
69
71
  require "autoproj/cli/test"
70
72
  report(silent: true) do
71
73
  cli = Test.new
72
- args = cli.validate_options(packages, options)
73
- cli.list(*args)
74
+ options = self.options.merge(parent_options)
75
+ *args, options = cli.validate_options(packages, options)
76
+ cli.list(*args, **options)
74
77
  end
75
78
  end
76
79
 
@@ -101,8 +104,8 @@ module Autoproj
101
104
  Autobuild.ignore_errors = options.delete(:keep_going)
102
105
  Autobuild::TestUtility.coverage_enabled = options.delete(:coverage)
103
106
  options.delete(:tool)
104
- args = cli.validate_options(packages, options.merge(extra_options))
105
- cli.run(*args)
107
+ *args, options = cli.validate_options(packages, options.merge(extra_options))
108
+ cli.run(*args, **options)
106
109
  end
107
110
  end
108
111
  end
@@ -17,7 +17,7 @@ module Autoproj
17
17
  ws.config.save
18
18
  end
19
19
 
20
- def enable(user_selection, options = {})
20
+ def enable(user_selection, **options)
21
21
  if user_selection.empty?
22
22
  ws.load_config
23
23
  ws.config.utility_enable_all(utility_name)
@@ -33,7 +33,7 @@ module Autoproj
33
33
  ws.config.save
34
34
  end
35
35
 
36
- def disable(user_selection, options = {})
36
+ def disable(user_selection, **options)
37
37
  if user_selection.empty?
38
38
  ws.load_config
39
39
  ws.config.utility_disable_all(utility_name)
@@ -49,7 +49,7 @@ module Autoproj
49
49
  ws.config.save
50
50
  end
51
51
 
52
- def list(user_selection, options = {})
52
+ def list(user_selection, **options)
53
53
  initialize_and_load
54
54
  resolved_selection, = finalize_setup(
55
55
  user_selection,
@@ -75,7 +75,7 @@ module Autoproj
75
75
  end
76
76
  end
77
77
 
78
- def run(user_selection, options = {})
78
+ def run(user_selection, **options)
79
79
  options[:parallel] ||= ws.config.parallel_build_level
80
80
  initialize_and_load
81
81
 
@@ -436,6 +436,22 @@ module Autoproj
436
436
  set("separate_prefixes", flag, true)
437
437
  end
438
438
 
439
+ # Returns true if Ruby shims should be installed in a separate prefix
440
+ #
441
+ # The default is false (disabled)
442
+ #
443
+ # @return [Boolean]
444
+ def isolate_ruby_shims?
445
+ get("isolate_ruby_shims", false)
446
+ end
447
+
448
+ # Controls whether Ruby shims should be in a separate prefix
449
+ #
450
+ # @see isolate_shims?
451
+ def isolate_ruby_shims=(flag)
452
+ set("isolate_ruby_shims", flag, true)
453
+ end
454
+
439
455
  # Returns true if packages and prefixes should be auto-generated, based
440
456
  # on the SHA of the package names. This is meant to be used for build
441
457
  # services that want to check that dependencies are properly set
@@ -2,9 +2,21 @@ module Autoproj
2
2
  # Manifest of installed packages imported from another autoproj installation
3
3
  class InstallationManifest
4
4
  Package = Struct.new :name, :type, :vcs, :srcdir, :importdir,
5
- :prefix, :builddir, :logdir, :dependencies
5
+ :prefix, :builddir, :logdir, :dependencies, :manifest
6
6
  PackageSet = Struct.new :name, :vcs, :raw_local_dir, :user_local_dir
7
7
 
8
+ Manifest = Struct.new(
9
+ :description, :brief_description, :url, :license, :version,
10
+ :authors, :maintainers, :rock_maintainers, :dependencies, :tags,
11
+ keyword_init: true
12
+ )
13
+
14
+ # Copied from PackageManifest, must keep the same interface
15
+ ContactInfo = Struct.new :name, :email, keyword_init: true
16
+
17
+ # Copied from PackageManifest, must keep the same interface
18
+ Dependency = Struct.new :name, :optional, :modes, keyword_init: true
19
+
8
20
  attr_reader :path
9
21
  attr_reader :packages
10
22
  attr_reader :package_sets
@@ -27,18 +39,27 @@ module Autoproj
27
39
  case pkg
28
40
  when PackageDefinition
29
41
  v = pkg.autobuild
42
+ manifest = convert_manifest(v.description)
30
43
  Package.new(
31
44
  v.name, v.class.name, pkg.vcs.to_hash, v.srcdir,
32
45
  (v.importdir if v.respond_to?(:importdir)),
33
46
  v.prefix,
34
47
  (v.builddir if v.respond_to?(:builddir)),
35
- v.logdir, v.dependencies
48
+ v.logdir, v.dependencies,
49
+ manifest
36
50
  )
37
51
  else
38
52
  pkg
39
53
  end
40
54
  end
41
55
 
56
+ def convert_manifest(manifest)
57
+ fields = Manifest.members.each_with_object({}) do |k, h|
58
+ h[k] = manifest.send(k)
59
+ end
60
+ Manifest.new(**fields)
61
+ end
62
+
42
63
  # Add a {Autoproj::PackageSet} to this manifest
43
64
  #
44
65
  # @return [PackageSet] the package set in the installation manifest format
@@ -95,9 +116,11 @@ module Autoproj
95
116
  )
96
117
  package_sets[pkg_set.name] = pkg_set
97
118
  else
119
+ manifest = load_manifest(entry["manifest"])
98
120
  pkg = Package.new(
99
121
  entry["name"], entry["type"], entry["vcs"], entry["srcdir"], entry["importdir"],
100
- entry["prefix"], entry["builddir"], entry["logdir"], entry["dependencies"]
122
+ entry["prefix"], entry["builddir"], entry["logdir"], entry["dependencies"],
123
+ manifest
101
124
  )
102
125
  packages[pkg.name] = pkg
103
126
  end
@@ -105,21 +128,62 @@ module Autoproj
105
128
  end
106
129
  end
107
130
 
131
+ def load_manifest(entry)
132
+ entry = entry.dup
133
+ %w[authors maintainers rock_maintainers].each do |field|
134
+ entry[field] = load_contact_list(entry[field])
135
+ end
136
+ entry["dependencies"] = load_manifest_dependencies(entry["dependencies"])
137
+
138
+ Manifest.new(**entry.transform_keys(&:to_sym))
139
+ end
140
+
141
+ def load_contact_list(list)
142
+ list.map { |fields| ContactInfo.new(**fields.transform_keys(&:to_sym)) }
143
+ end
144
+
145
+ def load_manifest_dependencies(list)
146
+ list.map { |fields| Dependency.new(**fields.transform_keys(&:to_sym)) }
147
+ end
148
+
108
149
  # Save the installation manifest
109
150
  def save(path = @path)
110
151
  Ops.atomic_write(path) do |io|
111
152
  marshalled_package_sets = each_package_set.map do |pkg_set|
112
- set = pkg_set.to_h.transform_keys(&:to_s)
153
+ set = struct_to_yaml(pkg_set)
113
154
  set["package_set"] = set["name"]
114
155
  set
115
156
  end
116
157
  marshalled_packages = each_package.map do |pkg|
117
- pkg.to_h.transform_keys(&:to_s)
158
+ struct_to_yaml(pkg)
118
159
  end
119
160
  io.write YAML.dump(marshalled_package_sets + marshalled_packages)
120
161
  end
121
162
  end
122
163
 
164
+ def object_to_yaml(obj)
165
+ case obj
166
+ when Struct
167
+ struct_to_yaml(obj)
168
+ when Array
169
+ obj.map { |el| object_to_yaml(el) }
170
+ when Hash
171
+ hash_to_yaml(obj)
172
+ else
173
+ obj
174
+ end
175
+ end
176
+
177
+ def struct_to_yaml(obj)
178
+ obj.to_h
179
+ .transform_keys(&:to_s)
180
+ .transform_values { |el| object_to_yaml(el) }
181
+ end
182
+
183
+ def hash_to_yaml(obj)
184
+ obj.transform_values { |el| object_to_yaml(el) }
185
+ end
186
+
123
187
  # Returns the default Autoproj installation manifest path for a given
124
188
  # autoproj workspace root
125
189
  #
@@ -133,7 +197,9 @@ module Autoproj
133
197
  path = path_for_workspace_root(root_dir)
134
198
  manifest = InstallationManifest.new(path)
135
199
  unless manifest.exist?
136
- raise ConfigError.new, "no #{path} file found. You should probably rerun autoproj envsh in that folder first"
200
+ raise ConfigError.new,
201
+ "no #{path} file found. You should probably rerun " \
202
+ "autoproj envsh in that folder first"
137
203
  end
138
204
 
139
205
  manifest.load
@@ -164,8 +164,10 @@ module Autoproj
164
164
 
165
165
  platform_suffix = "-#{Gem::Platform.local}.gem"
166
166
  failed = []
167
- compile.each do |gem_name, artifacts: []|
167
+ compile.each do |gem_name, options = {}|
168
+ artifacts = options[:artifacts] || []
168
169
  Dir.glob(File.join(cache_dir, "#{gem_name}*.gem")) do |gem|
170
+ next unless /^#{gem_name}-\d/.match?(File.basename(gem))
169
171
  next if gem.end_with?(platform_suffix)
170
172
 
171
173
  gem_basename = File.basename(gem, ".gem")
@@ -75,7 +75,9 @@ module Autoproj
75
75
  env["RUBYLIB"] = []
76
76
  env["PATH"] = self.class.sanitize_env(ENV["PATH"] || "")
77
77
  env["BUNDLE_GEMFILE"] = []
78
-
78
+ env["BUNDLER_VERSION"] = []
79
+ env["BUNDLER_SETUP"] = []
80
+ env["BUNDLE_BIN_PATH"] = []
79
81
  load_config
80
82
 
81
83
  if config["ruby_executable"] != Gem.ruby
@@ -434,25 +436,46 @@ module Autoproj
434
436
  end
435
437
  end
436
438
 
439
+ def write_bundle_shim(bundle_shim_path)
440
+ contents = <<~BUNDLERSHIM
441
+ #!#{Gem.ruby}
442
+ ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
443
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
444
+ ENV['GEM_HOME'] = '#{gems_gem_home}'
445
+ ENV.delete('GEM_PATH')
446
+ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
447
+ exec "#{File.join(gems_gem_home, 'bin', 'bundle')}", *ARGV
448
+ BUNDLERSHIM
449
+
450
+ File.write(bundle_shim_path, contents)
451
+ FileUtils.chmod 0755, bundle_shim_path
452
+ end
453
+
437
454
  def install_autoproj(bundler, bundler_version: self.bundler_version)
438
455
  # Force bundler to update. If the user does not want this, let
439
456
  # him specify a Gemfile with tighter version constraints
440
457
  lockfile = File.join(dot_autoproj, "Gemfile.lock")
458
+ shims_path = File.join(dot_autoproj, "bin")
441
459
  FileUtils.rm lockfile if File.exist?(lockfile)
442
460
 
443
461
  run_bundler(bundler, "config", "set", "--local", "path", gems_install_path,
444
462
  bundler_version: bundler_version)
445
463
  run_bundler(bundler, "config", "set", "--local", "shebang", Gem.ruby,
446
464
  bundler_version: bundler_version)
465
+ run_bundler(bundler, "config", "set", "--local", "bin", shims_path,
466
+ bundler_version: bundler_version)
447
467
 
448
468
  install_args = ["--gemfile=#{autoproj_gemfile_path}"]
449
469
  install_args << "--local" if local?
450
470
  run_bundler(bundler, "install", *install_args,
451
471
  bundler_version: bundler_version)
452
472
 
453
- shims_path = File.join(dot_autoproj, "bin")
454
- run_bundler(bundler, "binstubs", "--all", "--force", "--path", shims_path,
473
+ run_bundler(bundler, "binstubs", "--all", "--force",
455
474
  bundler_version: bundler_version)
475
+
476
+ bundle_shim_path = File.join(shims_path, "bundle")
477
+ write_bundle_shim(bundle_shim_path) unless File.exist?(bundle_shim_path)
478
+
456
479
  self.class.rewrite_shims(
457
480
  shims_path, ruby_executable, root_dir,
458
481
  autoproj_gemfile_path, gems_gem_home
@@ -541,6 +564,7 @@ module Autoproj
541
564
  # Autoproj generated preamble
542
565
  #{WITHOUT_BUNDLER}
543
566
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
567
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
544
568
  ENV['GEM_HOME'] = '#{gems_gem_home}'
545
569
  ENV.delete('GEM_PATH')
546
570
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -553,6 +577,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
553
577
 
554
578
  #{WITHOUT_BUNDLER}
555
579
  ENV['BUNDLE_GEMFILE'] ||= '#{autoproj_gemfile_path}'
580
+ ENV['BUNDLE_LOCKFILE'] ||= '#{autoproj_gemfile_path}.lock'
556
581
  ENV['GEM_HOME'] = '#{gems_gem_home}'
557
582
  ENV.delete('GEM_PATH')
558
583
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -578,6 +603,7 @@ load Gem.bin_path('bundler', 'bundler')"
578
603
  # Autoproj generated preamble, v1
579
604
  #{RUBYLIB_REINIT}
580
605
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
606
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
581
607
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
582
608
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
583
609
  AUTOPROJ_PREAMBLE
@@ -590,6 +616,7 @@ Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
590
616
 
591
617
  #{RUBYLIB_REINIT}
592
618
  ENV['BUNDLE_GEMFILE'] = '#{autoproj_gemfile_path}'
619
+ ENV['BUNDLE_LOCKFILE'] = '#{autoproj_gemfile_path}.lock'
593
620
  ENV['AUTOPROJ_CURRENT_ROOT'] = '#{root_dir}'
594
621
  require 'rubygems'
595
622
  Gem.paths = Hash['GEM_HOME' => '#{gems_gem_home}', 'GEM_PATH' => '']
@@ -156,8 +156,8 @@ module Autoproj
156
156
  # @api private
157
157
  def do_switch_config(delete_current, type, url, *options)
158
158
  vcs_def = Hash.new
159
- vcs_def[:type] = type
160
- vcs_def[:url] = VCSDefinition.to_absolute_url(url, ws.root_dir)
159
+ vcs_def["type"] = type
160
+ vcs_def["url"] = VCSDefinition.to_absolute_url(url, ws.root_dir)
161
161
  options.each do |opt|
162
162
  name, value = opt.split("=")
163
163
  value = Integer(value) if value =~ /^\d+$/
@@ -60,7 +60,10 @@ module Autoproj
60
60
  end
61
61
 
62
62
  gemfile_path = File.join(ws.prefix_dir, "gems", "Gemfile")
63
- env.set("BUNDLE_GEMFILE", gemfile_path) if File.file?(gemfile_path)
63
+ if File.file?(gemfile_path)
64
+ env.set("BUNDLE_GEMFILE", gemfile_path)
65
+ env.set("BUNDLE_LOCKFILE", "#{gemfile_path}.lock")
66
+ end
64
67
 
65
68
  if cache_dir && File.exist?(cache_dir)
66
69
  vendor_dir = File.join(File.dirname(gemfile_path), "vendor")
@@ -303,9 +306,14 @@ module Autoproj
303
306
  )
304
307
  FileUtils.rm "#{gemfile}.lock" if update && File.file?("#{gemfile}.lock")
305
308
 
306
- options << "--path" << gem_path
307
- options << "--shebang" << Gem.ruby
308
- options << "--binstubs" << binstubs if binstubs
309
+ run_bundler(ws, "config", "set", "--local", "path", gem_path,
310
+ bundler_version: bundler_version)
311
+ run_bundler(ws, "config", "set", "--local", "shebang", Gem.ruby,
312
+ bundler_version: bundler_version)
313
+ if binstubs
314
+ run_bundler(ws, "config", "set", "--local", "bin", binstubs,
315
+ bundler_version: bundler_version)
316
+ end
309
317
 
310
318
  apply_build_config(ws)
311
319
 
@@ -324,6 +332,12 @@ module Autoproj
324
332
  end
325
333
  end
326
334
  end
335
+
336
+ if binstubs
337
+ run_bundler(ws, "binstubs", "--all",
338
+ bundler_version: bundler_version,
339
+ gem_home: gem_home, gemfile: gemfile)
340
+ end
327
341
  end
328
342
 
329
343
  def self.bundle_gem_path(ws, gem_name,
@@ -358,7 +372,7 @@ module Autoproj
358
372
  target_env = Hash[
359
373
  "GEM_HOME" => gem_home,
360
374
  "GEM_PATH" => nil,
361
- "BUNDLE_GEMFILE" => gemfile,
375
+ "BUNDLE_GEMFILE" => gemfile, "BUNDLE_LOCKFILE" => "#{gemfile}.lock",
362
376
  "RUBYOPT" => nil,
363
377
  "RUBYLIB" => rubylib_for_bundler,
364
378
  ].merge(bundler_version_env)
@@ -390,7 +404,7 @@ module Autoproj
390
404
  .gsub(/# from.*/, "")
391
405
  raise ConfigError, cleaned_message
392
406
  end
393
- gems_remotes |= bundler_def.send(:sources).rubygems_remotes.to_set
407
+ gems_remotes |= bundler_def.send(:sources).rubygems_sources.flat_map(&:remotes).to_set
394
408
  bundler_def.dependencies.each do |d|
395
409
  d.groups.each do |group_name|
396
410
  if d.platforms.empty?
@@ -630,8 +644,8 @@ module Autoproj
630
644
  Tempfile.open "autoproj-rubylib" do |io|
631
645
  result = Autoproj.bundler_unbundled_system(
632
646
  Hash["GEM_HOME" => env["GEM_HOME"], "GEM_PATH" => env["GEM_PATH"],
633
- "BUNDLE_GEMFILE" => gemfile, "RUBYOPT" => nil,
634
- "RUBYLIB" => self.class.rubylib_for_bundler],
647
+ "BUNDLE_GEMFILE" => gemfile, "BUNDLE_LOCKFILE" => "#{gemfile}.lock",
648
+ "RUBYOPT" => nil, "RUBYLIB" => self.class.rubylib_for_bundler],
635
649
  Autobuild.tool("ruby"), "-rbundler/setup",
636
650
  "-e", "puts $LOAD_PATH",
637
651
  out: io, **silent_redirect
@@ -217,7 +217,7 @@ module Autoproj
217
217
  return "true"
218
218
  end
219
219
 
220
- config.get(var)
220
+ config.get(var).to_s
221
221
  end
222
222
 
223
223
  def initialize(path, manifest, condition_context: Configuration.new)
@@ -69,13 +69,12 @@ module Autoproj
69
69
  version: ws.config.get("python_version", nil))
70
70
  finders = [
71
71
  -> { Autobuild.programs["python"] },
72
- -> { `which python3`.strip },
73
- -> { `which python`.strip }
72
+ -> { Autobuild.find_in_path("python3") },
73
+ -> { Autobuild.find_in_path("python") }
74
74
  ]
75
75
 
76
76
  finders.each do |finder|
77
- python_bin = finder.call
78
- if python_bin && !python_bin.empty?
77
+ if (python_bin = finder.call)
79
78
  python_version, valid = validate_python_version(python_bin, version)
80
79
  return python_bin, python_version if valid
81
80
  end
data/lib/autoproj/test.rb CHANGED
@@ -247,7 +247,12 @@ module Autoproj
247
247
  "call stop_gem_server before calling start_gem_server again"
248
248
  end
249
249
  @gem_server_pid = spawn(
250
- Hash["RUBYOPT" => nil],
250
+ Hash[
251
+ "RUBYOPT" => nil,
252
+ "GEM_HOME" => path,
253
+ "BUNDLE_GEMFILE" => nil,
254
+ "BUNDLER_SETUP" => nil
255
+ ],
251
256
  Gem.ruby, Ops::Install.guess_gem_program, "server",
252
257
  "--quiet", "--dir", path, out: :close, err: :close
253
258
  )
@@ -342,6 +347,8 @@ module Autoproj
342
347
 
343
348
  # Make a valid (albeit empty) Gemfile
344
349
  File.open(File.join(ws.dot_autoproj_dir, "Gemfile"), "w").close
350
+ # Create the shims folder
351
+ FileUtils.mkdir File.join(ws.dot_autoproj_dir, "bin")
345
352
  ws
346
353
  end
347
354
 
@@ -201,7 +201,8 @@ module Autoproj
201
201
  # @return [VCSDefinition]
202
202
  # @raise ArgumentError if the raw specification does not match an
203
203
  # expected format
204
- def self.from_raw(spec, from: nil, raw: [], history: [])
204
+ def self.from_raw(spec_str = nil, from: nil, raw: [], history: [], **spec_hash)
205
+ spec = spec_str || spec_hash
205
206
  normalized_spec = normalize_vcs_hash(spec)
206
207
  unless (type = normalized_spec.delete(:type))
207
208
  raise ArgumentError,
@@ -1,3 +1,3 @@
1
1
  module Autoproj
2
- VERSION = "2.18.0"
2
+ VERSION = "2.18.1"
3
3
  end
@@ -405,7 +405,14 @@ module Autoproj
405
405
  install_suffix = match[1]
406
406
  end
407
407
 
408
- bindir = File.join(prefix_dir, "bin")
408
+ prefixdir =
409
+ if config.isolate_ruby_shims?
410
+ File.join(prefix_dir, "autoproj")
411
+ else
412
+ prefix_dir
413
+ end
414
+
415
+ bindir = File.join(prefixdir, "bin")
409
416
  FileUtils.mkdir_p bindir
410
417
  env.add "PATH", bindir
411
418
 
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.18.0
4
+ version: 2.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sylvain Joyeux
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-21 00:00:00.000000000 Z
11
+ date: 2026-06-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: autobuild
@@ -170,20 +170,20 @@ dependencies:
170
170
  requirements:
171
171
  - - "~>"
172
172
  - !ruby/object:Gem::Version
173
- version: 3.0.0
173
+ version: '3.0'
174
174
  - - ">="
175
175
  - !ruby/object:Gem::Version
176
- version: 3.0.0
176
+ version: '3.0'
177
177
  type: :runtime
178
178
  prerelease: false
179
179
  version_requirements: !ruby/object:Gem::Requirement
180
180
  requirements:
181
181
  - - "~>"
182
182
  - !ruby/object:Gem::Version
183
- version: 3.0.0
183
+ version: '3.0'
184
184
  - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 3.0.0
186
+ version: '3.0'
187
187
  - !ruby/object:Gem::Dependency
188
188
  name: xdg
189
189
  requirement: !ruby/object:Gem::Requirement
@@ -216,22 +216,16 @@ dependencies:
216
216
  name: flexmock
217
217
  requirement: !ruby/object:Gem::Requirement
218
218
  requirements:
219
- - - "~>"
220
- - !ruby/object:Gem::Version
221
- version: '2.0'
222
219
  - - ">="
223
220
  - !ruby/object:Gem::Version
224
- version: 2.0.0
221
+ version: '0'
225
222
  type: :development
226
223
  prerelease: false
227
224
  version_requirements: !ruby/object:Gem::Requirement
228
225
  requirements:
229
- - - "~>"
230
- - !ruby/object:Gem::Version
231
- version: '2.0'
232
226
  - - ">="
233
227
  - !ruby/object:Gem::Version
234
- version: 2.0.0
228
+ version: '0'
235
229
  - !ruby/object:Gem::Dependency
236
230
  name: minitest
237
231
  requirement: !ruby/object:Gem::Requirement
@@ -473,7 +467,7 @@ homepage: http://rock-robotics.org
473
467
  licenses:
474
468
  - BSD
475
469
  metadata: {}
476
- post_install_message:
470
+ post_install_message:
477
471
  rdoc_options: []
478
472
  require_paths:
479
473
  - lib
@@ -488,8 +482,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
488
482
  - !ruby/object:Gem::Version
489
483
  version: '0'
490
484
  requirements: []
491
- rubygems_version: 3.1.6
492
- signing_key:
485
+ rubygems_version: 3.4.20
486
+ signing_key:
493
487
  specification_version: 4
494
488
  summary: Easy installation and management of sets of software packages
495
489
  test_files: []