autoproj 2.11.0 → 2.14.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +5 -8
  3. data/.travis.yml +5 -3
  4. data/autoproj.gemspec +6 -6
  5. data/bin/alog +1 -0
  6. data/bin/autoproj +1 -1
  7. data/bin/autoproj_bootstrap +130 -67
  8. data/bin/autoproj_bootstrap.in +9 -7
  9. data/bin/autoproj_install +129 -63
  10. data/bin/autoproj_install.in +8 -3
  11. data/lib/autoproj/autobuild_extensions/dsl.rb +27 -12
  12. data/lib/autoproj/base.rb +18 -0
  13. data/lib/autoproj/cli/base.rb +1 -1
  14. data/lib/autoproj/cli/build.rb +8 -3
  15. data/lib/autoproj/cli/cache.rb +79 -7
  16. data/lib/autoproj/cli/inspection_tool.rb +5 -6
  17. data/lib/autoproj/cli/main.rb +33 -9
  18. data/lib/autoproj/cli/show.rb +12 -18
  19. data/lib/autoproj/cli/status.rb +15 -9
  20. data/lib/autoproj/cli/test.rb +1 -1
  21. data/lib/autoproj/cli/update.rb +72 -17
  22. data/lib/autoproj/cli/utility.rb +25 -28
  23. data/lib/autoproj/configuration.rb +15 -4
  24. data/lib/autoproj/default.osdeps +29 -3
  25. data/lib/autoproj/environment.rb +17 -13
  26. data/lib/autoproj/installation_manifest.rb +7 -5
  27. data/lib/autoproj/manifest.rb +14 -6
  28. data/lib/autoproj/ops/build.rb +23 -21
  29. data/lib/autoproj/ops/cache.rb +151 -33
  30. data/lib/autoproj/ops/cached_env.rb +2 -2
  31. data/lib/autoproj/ops/import.rb +23 -4
  32. data/lib/autoproj/ops/install.rb +121 -60
  33. data/lib/autoproj/ops/phase_reporting.rb +49 -0
  34. data/lib/autoproj/ops/snapshot.rb +2 -1
  35. data/lib/autoproj/ops/tools.rb +2 -2
  36. data/lib/autoproj/os_package_installer.rb +19 -11
  37. data/lib/autoproj/package_definition.rb +1 -1
  38. data/lib/autoproj/package_managers/apt_dpkg_manager.rb +49 -28
  39. data/lib/autoproj/package_managers/bundler_manager.rb +102 -19
  40. data/lib/autoproj/package_managers/homebrew_manager.rb +2 -2
  41. data/lib/autoproj/package_managers/pip_manager.rb +34 -22
  42. data/lib/autoproj/package_managers/shell_script_manager.rb +44 -24
  43. data/lib/autoproj/package_manifest.rb +43 -31
  44. data/lib/autoproj/package_set.rb +2 -2
  45. data/lib/autoproj/python.rb +285 -0
  46. data/lib/autoproj/test.rb +26 -10
  47. data/lib/autoproj/variable_expansion.rb +3 -1
  48. data/lib/autoproj/vcs_definition.rb +25 -12
  49. data/lib/autoproj/version.rb +1 -1
  50. data/lib/autoproj/workspace.rb +60 -16
  51. data/lib/autoproj.rb +3 -0
  52. metadata +17 -28
@@ -0,0 +1,49 @@
1
+ module Autoproj
2
+ module Ops
3
+ # Common logic to generate build/import/utility reports
4
+ class PhaseReporting
5
+ def initialize(name, path, metadata_get)
6
+ @name = name
7
+ @path = path
8
+ @metadata_get = metadata_get
9
+ end
10
+
11
+ def create_report(autobuild_packages)
12
+ info = autobuild_packages.each_with_object({}) do |p, map|
13
+ map[p.name] = @metadata_get.call(p)
14
+ end
15
+
16
+ dump = JSON.dump(
17
+ "#{@name}_report" => {
18
+ 'timestamp' => Time.now,
19
+ 'packages' => info
20
+ }
21
+ )
22
+
23
+ FileUtils.mkdir_p File.dirname(@path)
24
+ File.open(@path, 'w') do |io|
25
+ io.write dump
26
+ end
27
+ end
28
+
29
+ def initialize_incremental_report
30
+ FileUtils.mkdir_p File.dirname(@path)
31
+ @incremental_report = ""
32
+ end
33
+
34
+ def report_incremental(autobuild_package)
35
+ new_metadata = @metadata_get.call(autobuild_package)
36
+ prefix = @incremental_report.empty? ? "\n" : ",\n"
37
+ @incremental_report.concat(
38
+ "#{prefix}\"#{autobuild_package.name}\": #{JSON.dump(new_metadata)}"
39
+ )
40
+ File.open(@path, 'w') do |io|
41
+ io.write "{ \"#{@name}_report\": "\
42
+ "{\"timestamp\": #{JSON.dump(Time.now)}, \"packages\": {"
43
+ io.write(@incremental_report)
44
+ io.write "}}}"
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -119,6 +119,7 @@ module Autoproj
119
119
 
120
120
  def snapshot_packages(packages, target_dir = nil, only_local: true, fingerprint: false)
121
121
  result = Array.new
122
+ fingerprint_memo = Hash.new
122
123
  packages.each do |package_name|
123
124
  package = manifest.find_package_definition(package_name)
124
125
  if !package
@@ -141,7 +142,7 @@ module Autoproj
141
142
  end
142
143
 
143
144
  if fingerprint
144
- vcs_info['fingerprint'] = package.autobuild.fingerprint
145
+ vcs_info['fingerprint'] = package.autobuild.fingerprint(memo: fingerprint_memo)
145
146
  end
146
147
 
147
148
  if vcs_info
@@ -24,8 +24,8 @@ module Autoproj
24
24
  @@packages.delete(text_name)
25
25
  end
26
26
 
27
- def import(options = Hash.new)
28
- importer.import(self, options)
27
+ def import(**options)
28
+ importer.import(self, **options)
29
29
  end
30
30
 
31
31
  def add_stat(*args)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'autoproj/package_managers/manager'
2
4
  require 'autoproj/package_managers/unknown_os_manager'
3
5
  require 'autoproj/package_managers/shell_script_manager'
@@ -37,7 +39,9 @@ module Autoproj
37
39
  attr_reader :installed_resolved_packages
38
40
 
39
41
  attr_writer :silent
40
- def silent?; @silent end
42
+ def silent?
43
+ @silent
44
+ end
41
45
 
42
46
  class << self
43
47
  attr_accessor :force_osdeps
@@ -60,12 +64,12 @@ module Autoproj
60
64
 
61
65
  # Returns the package manager object for the current OS
62
66
  def os_package_manager
63
- if !@os_package_manager
67
+ unless @os_package_manager
64
68
  name = os_package_resolver.os_package_manager
65
69
  @os_package_manager = package_managers[name] ||
66
- PackageManagers::UnknownOSManager.new(ws)
70
+ PackageManagers::UnknownOSManager.new(ws)
67
71
  end
68
- return @os_package_manager
72
+ @os_package_manager
69
73
  end
70
74
 
71
75
  # Returns the set of package managers
@@ -75,13 +79,17 @@ module Autoproj
75
79
  package_managers.each_value(&block)
76
80
  end
77
81
 
82
+ def each_manager_with_name(&block)
83
+ package_managers.each(&block)
84
+ end
85
+
78
86
  HANDLE_ALL = 'all'
79
87
  HANDLE_RUBY = 'ruby'
80
88
  HANDLE_OS = 'os'
81
89
  HANDLE_NONE = 'none'
82
90
 
83
91
  def osdeps_mode_option_unsupported_os(config)
84
- long_doc =<<-EOT
92
+ long_doc = <<-EOT
85
93
  The software packages that autoproj will have to build may require other
86
94
  prepackaged softwares (a.k.a. OS dependencies) to be installed (RubyGems
87
95
  packages, packages from your operating system/distribution, ...). Autoproj is
@@ -153,9 +161,9 @@ So, what do you want ? (all, none or a comma-separated list of: os gem pip)
153
161
  message = [ "Which prepackaged software (a.k.a. 'osdeps') should autoproj install automatically (all, none or a comma-separated list of: os gem pip) ?", long_doc.strip ]
154
162
 
155
163
  config.declare 'osdeps_mode', 'string',
156
- default: 'all',
157
- doc: message,
158
- lowercase: true
164
+ default: 'all',
165
+ doc: message,
166
+ lowercase: true
159
167
  end
160
168
 
161
169
  def define_osdeps_mode_option
@@ -171,14 +179,14 @@ So, what do you want ? (all, none or a comma-separated list of: os gem pip)
171
179
  modes = []
172
180
  user_modes.each do |str|
173
181
  case str
174
- when 'all' then modes.concat(['os', 'gem', 'pip'])
182
+ when 'all' then modes.concat(%w[os gem pip])
175
183
  when 'ruby' then modes << 'gem'
176
184
  when 'gem' then modes << 'gem'
177
185
  when 'pip' then modes << 'pip'
178
186
  when 'os' then modes << 'os'
179
187
  when 'none' then
180
188
  else
181
- if package_managers.has_key?(str)
189
+ if package_managers.key?(str)
182
190
  modes << str
183
191
  else
184
192
  raise ArgumentError, "#{str} is not a known package handler, known handlers are #{package_managers.keys.sort.join(", ")}"
@@ -442,5 +450,5 @@ So, what do you want ? (all, none or a comma-separated list of: os gem pip)
442
450
  end
443
451
  end
444
452
  end
445
- end
453
+ end
446
454
 
@@ -90,7 +90,7 @@ module Autoproj
90
90
  autobuild.depends_on name
91
91
  end
92
92
  rescue ConfigError => e
93
- raise ConfigError.new(manifest.path),
93
+ raise PackageNotFound.new(manifest.path),
94
94
  "manifest #{manifest.path} of #{self.name} from "\
95
95
  "#{package_set.name} lists '#{name}' as dependency, "\
96
96
  'but it is neither a normal package nor an osdeps '\
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'autoproj/package_managers/debian_version'
2
4
 
3
5
  module Autoproj
@@ -12,15 +14,17 @@ module Autoproj
12
14
  @installed_packages = nil
13
15
  @installed_versions = nil
14
16
  super(ws, true,
15
- %w{apt-get install},
16
- %w{DEBIAN_FRONTEND=noninteractive apt-get install -y})
17
+ %w[apt-get install],
18
+ %w[DEBIAN_FRONTEND=noninteractive apt-get install -y])
17
19
  end
18
20
 
19
21
  def configure_manager
20
22
  super
21
- ws.config.declare 'apt_dpkg_update', 'boolean',
23
+ ws.config.declare(
24
+ 'apt_dpkg_update', 'boolean',
22
25
  default: 'yes',
23
26
  doc: ['Would you like autoproj to keep apt packages up-to-date?']
27
+ )
24
28
  keep_uptodate?
25
29
  end
26
30
 
@@ -32,7 +36,9 @@ module Autoproj
32
36
  ws.config.set('apt_dpkg_update', flag, true)
33
37
  end
34
38
 
35
- def self.parse_package_status(installed_packages, installed_versions, paragraph)
39
+ def self.parse_package_status(
40
+ installed_packages, installed_versions, paragraph, virtual: true
41
+ )
36
42
  if paragraph =~ /^Status: install ok installed$/
37
43
  if paragraph =~ /^Package: (.*)$/
38
44
  package_name = $1
@@ -41,38 +47,40 @@ module Autoproj
41
47
  installed_versions[package_name] = DebianVersion.new($1)
42
48
  end
43
49
  end
44
- if paragraph =~ /^Provides: (.*)$/
50
+ if virtual && paragraph =~ /^Provides: (.*)$/
45
51
  installed_packages.merge($1.split(',').map(&:strip))
46
52
  end
47
53
  end
48
54
  end
49
55
 
50
- def self.parse_dpkg_status(status_file)
56
+ def self.parse_dpkg_status(status_file, virtual: true)
51
57
  installed_packages = Set.new
52
58
  installed_versions = {}
53
59
  dpkg_status = File.read(status_file)
54
60
  dpkg_status << "\n"
55
61
 
56
62
  dpkg_status = StringScanner.new(dpkg_status)
57
- if !dpkg_status.scan(/Package: /)
58
- raise ArgumentError, "expected #{status_file} to have Package: lines but found none"
63
+ unless dpkg_status.scan(/Package: /)
64
+ raise ArgumentError, "expected #{status_file} to have Package: "\
65
+ "lines but found none"
59
66
  end
60
67
 
61
- while paragraph_end = dpkg_status.scan_until(/Package: /)
68
+ while (paragraph_end = dpkg_status.scan_until(/Package: /))
62
69
  paragraph = "Package: #{paragraph_end[0..-10]}"
63
- parse_package_status(installed_packages, installed_versions, paragraph)
70
+ parse_package_status(installed_packages, installed_versions,
71
+ paragraph, virtual: virtual)
64
72
  end
65
- parse_package_status(installed_packages, installed_versions, "Package: #{dpkg_status.rest}")
73
+ parse_package_status(installed_packages, installed_versions,
74
+ "Package: #{dpkg_status.rest}", virtual: virtual)
66
75
  [installed_packages, installed_versions]
67
76
  end
68
77
 
69
78
  def self.parse_apt_cache_paragraph(paragraph)
70
79
  version = '0'
71
- if paragraph =~ /^Package: (.*)$/
72
- package_name = $1
73
- if paragraph =~ /^Version: (.*)$/
74
- version = $1
75
- end
80
+ if (paragraph_m = /^Package: (.*)$/.match(paragraph))
81
+ package_name = paragraph_m[1]
82
+ version_m = /^Version: (.*)$/.match(paragraph)
83
+ version = version_m[1] if version_m
76
84
  end
77
85
  [package_name, version]
78
86
  end
@@ -81,23 +89,24 @@ module Autoproj
81
89
  packages_versions = {}
82
90
  apt_cache_show = `apt-cache show --no-all-versions #{packages.join(' ')}`
83
91
  apt_cache_show = StringScanner.new(apt_cache_show)
84
- if !apt_cache_show.scan(/Package: /)
85
- return packages_versions
86
- end
92
+ return packages_versions unless apt_cache_show.scan(/Package: /)
87
93
 
88
- while paragraph_end = apt_cache_show.scan_until(/Package: /)
94
+ while (paragraph_end = apt_cache_show.scan_until(/Package: /))
89
95
  paragraph = "Package: #{paragraph_end[0..-10]}"
90
96
  package_name, version = parse_apt_cache_paragraph(paragraph)
91
97
  packages_versions[package_name] = DebianVersion.new(version)
92
98
  end
93
- package_name, version = parse_apt_cache_paragraph("Package: #{apt_cache_show.rest}")
99
+ package_name, version = parse_apt_cache_paragraph(
100
+ "Package: #{apt_cache_show.rest}"
101
+ )
94
102
  packages_versions[package_name] = DebianVersion.new(version)
95
103
  packages_versions
96
104
  end
97
105
 
98
106
  def updated?(package, available_version)
99
- # Consider up-to-date if the package is provided by another package (purely virtual)
100
- # Ideally, we should check the version of the package that provides it
107
+ # Consider up-to-date if the package is provided by another
108
+ # package (purely virtual) Ideally, we should check the version
109
+ # of the package that provides it
101
110
  return true unless available_version && @installed_versions[package]
102
111
 
103
112
  (available_version <= @installed_versions[package])
@@ -105,8 +114,13 @@ module Autoproj
105
114
 
106
115
  # On a dpkg-enabled system, checks if the provided package is installed
107
116
  # and returns true if it is the case
108
- def installed?(package_name, filter_uptodate_packages: false, install_only: false)
109
- @installed_packages, @installed_versions = self.class.parse_dpkg_status(status_file) unless @installed_packages && @installed_versions
117
+ def installed?(package_name, filter_uptodate_packages: false,
118
+ install_only: false)
119
+ unless @installed_packages && @installed_versions
120
+ @installed_packages, @installed_versions =
121
+ self.class.parse_dpkg_status(status_file)
122
+ end
123
+
110
124
  if package_name =~ /^(\w[a-z0-9+-.]+)/
111
125
  @installed_packages.include?($1)
112
126
  else
@@ -116,11 +130,18 @@ module Autoproj
116
130
  end
117
131
 
118
132
  def install(packages, filter_uptodate_packages: false, install_only: false)
119
- packages_versions = self.class.parse_packages_versions(packages)
120
133
  if filter_uptodate_packages || install_only
121
- packages = packages.find_all do |package_name|
122
- !installed?(package_name) || (keep_uptodate? && !updated?(package_name, packages_versions[package_name]))
134
+ already_installed, missing = packages.partition do |package_name|
135
+ installed?(package_name)
136
+ end
137
+
138
+ if keep_uptodate? && !install_only
139
+ packages_versions = self.class.parse_packages_versions(already_installed)
140
+ need_update = already_installed.find_all do |package_name|
141
+ !updated?(package_name, packages_versions[package_name])
142
+ end
123
143
  end
144
+ packages = missing + (need_update || [])
124
145
  end
125
146
 
126
147
  if super(packages)
@@ -24,6 +24,14 @@ module Autoproj
24
24
  end
25
25
  end
26
26
 
27
+ # Directory with cached .gem packages
28
+ #
29
+ # The directory must exist, but may be empty.
30
+ # It is initialized with {BundlerManager.cache_dir}
31
+ #
32
+ # @return [String]
33
+ attr_accessor :cache_dir
34
+
27
35
  # (see Manager#call_while_empty?)
28
36
  def call_while_empty?
29
37
  !workspace_configuration_gemfiles.empty?
@@ -45,14 +53,31 @@ module Autoproj
45
53
  env.add_path 'PATH', File.join(ws.dot_autoproj_dir, 'bin')
46
54
  env.set 'GEM_HOME', config.gems_gem_home
47
55
  env.clear 'GEM_PATH'
56
+ if (bundler_version = config.bundler_version)
57
+ env.set 'BUNDLER_VERSION', bundler_version
58
+ else
59
+ env.clear 'BUNDLER_VERSION'
60
+ end
48
61
 
49
62
  gemfile_path = File.join(ws.prefix_dir, 'gems', 'Gemfile')
50
63
  env.set('BUNDLE_GEMFILE', gemfile_path) if File.file?(gemfile_path)
51
64
 
52
- Autobuild.programs['bundler'] = File.join(ws.dot_autoproj_dir,
53
- 'bin', 'bundle')
54
- Autobuild.programs['bundle'] = File.join(ws.dot_autoproj_dir,
55
- 'bin', 'bundle')
65
+ if cache_dir && File.exist?(cache_dir)
66
+ vendor_dir = File.join(File.dirname(gemfile_path), 'vendor')
67
+ FileUtils.mkdir_p vendor_dir
68
+ bundler_cache_dir = File.join(vendor_dir, 'cache')
69
+ if File.writable?(cache_dir)
70
+ create_cache_symlink(cache_dir, bundler_cache_dir)
71
+ else
72
+ Autoproj.warn "BundlerManager: #{cache_dir} is read-only "\
73
+ "copying the cache instead of symlinking it"
74
+ create_cache_copy(cache_dir, bundler_cache_dir)
75
+ end
76
+ end
77
+
78
+ Autobuild.programs['bundler'] =
79
+ Autobuild.programs['bundle'] =
80
+ File.join(ws.dot_autoproj_dir, 'bin', 'bundle')
56
81
 
57
82
  env.init_from_env 'RUBYLIB'
58
83
  env.inherit 'RUBYLIB'
@@ -64,6 +89,7 @@ module Autoproj
64
89
  Bundler.rubygems.gem_path
65
90
  .none? { |gem_p| p.start_with?(gem_p) }
66
91
  end
92
+
67
93
  # And discover the system's rubylib
68
94
  if (system_rubylib = discover_rubylib)
69
95
  # Do not explicitely add the system rubylib to the
@@ -96,6 +122,44 @@ module Autoproj
96
122
  end
97
123
  end
98
124
 
125
+ def create_cache_symlink(cache_dir, bundler_cache_dir)
126
+ if File.exist?(bundler_cache_dir)
127
+ if !File.symlink?(bundler_cache_dir)
128
+ Autoproj.warn "cannot use #{cache_dir} as gem cache as "\
129
+ "#{bundler_cache_dir} already exists"
130
+ return
131
+ elsif File.readlink(bundler_cache_dir) == cache_dir
132
+ return
133
+ end
134
+ end
135
+
136
+ FileUtils.rm_f bundler_cache_dir
137
+ FileUtils.ln_s cache_dir, bundler_cache_dir
138
+ end
139
+
140
+ def create_cache_copy(cache_dir, bundler_cache_dir)
141
+ valid = !File.exist?(bundler_cache_dir) ||
142
+ File.directory?(bundler_cache_dir) ||
143
+ File.symlink?(bundler_cache_dir)
144
+
145
+ unless valid
146
+ Autoproj.warn "cannot use #{cache_dir} as gem cache as "\
147
+ "#{bundler_cache_dir} already exists"
148
+ return
149
+ end
150
+
151
+ # Gracefully upgrade from the symlinks
152
+ FileUtils.rm_f bundler_cache_dir if File.symlink?(bundler_cache_dir)
153
+ FileUtils.mkdir_p bundler_cache_dir
154
+
155
+ Dir.glob(File.join(cache_dir, '*.gem')) do |path_src|
156
+ path_dest = File.join(bundler_cache_dir, File.basename(path_src))
157
+ next if File.exist?(path_dest)
158
+
159
+ FileUtils.cp path_src, path_dest
160
+ end
161
+ end
162
+
99
163
  # Enumerate the per-gem build configurations
100
164
  def self.per_gem_build_config(ws)
101
165
  ws.config.get('bundler.build', {})
@@ -248,10 +312,13 @@ module Autoproj
248
312
  end
249
313
  end
250
314
 
251
- def self.run_bundler_install(ws, gemfile, *options,
252
- update: true, binstubs: nil,
253
- gem_home: ws.config.gems_gem_home,
254
- gem_path: ws.config.gems_install_path)
315
+ def self.run_bundler_install(
316
+ ws, gemfile, *options,
317
+ update: true, binstubs: nil,
318
+ bundler_version: ws.config.bundler_version,
319
+ gem_home: ws.config.gems_gem_home,
320
+ gem_path: ws.config.gems_install_path
321
+ )
255
322
  FileUtils.rm "#{gemfile}.lock" if update && File.file?("#{gemfile}.lock")
256
323
 
257
324
  options << '--path' << gem_path
@@ -262,6 +329,7 @@ module Autoproj
262
329
 
263
330
  connections = Set.new
264
331
  run_bundler(ws, 'install', *options,
332
+ bundler_version: bundler_version,
265
333
  gem_home: gem_home, gemfile: gemfile) do |line|
266
334
  case line
267
335
  when /Installing (.*)/
@@ -276,11 +344,13 @@ module Autoproj
276
344
  end
277
345
  end
278
346
 
279
- def self.bundle_gem_path(ws, gem_name, gem_home: nil, gemfile: nil)
347
+ def self.bundle_gem_path(ws, gem_name,
348
+ bundler_version: ws.config.bundler_version,
349
+ gem_home: nil, gemfile: nil)
280
350
  path = String.new
281
- PackageManagers::BundlerManager.run_bundler(
351
+ run_bundler(
282
352
  ws, 'show', gem_name,
283
- gem_home: gem_home,
353
+ bundler_version: bundler_version, gem_home: gem_home,
284
354
  gemfile: gemfile) { |line| path << line }
285
355
  path.chomp
286
356
  end
@@ -289,17 +359,26 @@ module Autoproj
289
359
  File.join(ws.dot_autoproj_dir, 'bin', 'bundle')
290
360
  end
291
361
 
292
- def self.run_bundler(ws, *commandline, gem_home: nil, gemfile: nil)
362
+ def self.run_bundler(ws, *commandline,
363
+ bundler_version: ws.config.bundler_version,
364
+ gem_home: ws.config.gems_gem_home,
365
+ gemfile: default_gemfile_path(ws))
293
366
  bundle = Autobuild.programs['bundle'] || default_bundler(ws)
294
367
 
295
- Bundler.with_clean_env do
368
+ Autoproj.bundler_with_unbundled_env do
369
+ bundler_version_env =
370
+ if bundler_version
371
+ { 'BUNDLER_VERSION' => bundler_version }
372
+ else
373
+ {}
374
+ end
296
375
  target_env = Hash[
297
376
  'GEM_HOME' => gem_home,
298
377
  'GEM_PATH' => nil,
299
378
  'BUNDLE_GEMFILE' => gemfile,
300
379
  'RUBYOPT' => nil,
301
- 'RUBYLIB' => rubylib_for_bundler
302
- ]
380
+ 'RUBYLIB' => rubylib_for_bundler,
381
+ ].merge(bundler_version_env)
303
382
  ws.run('autoproj', 'osdeps',
304
383
  bundle, *commandline,
305
384
  working_directory: File.dirname(gemfile),
@@ -390,9 +469,13 @@ module Autoproj
390
469
  gemfiles
391
470
  end
392
471
 
472
+ def self.default_gemfile_path(ws)
473
+ File.join(ws.prefix_dir, 'gems', 'Gemfile')
474
+ end
475
+
393
476
  def install(gems, filter_uptodate_packages: false, install_only: false)
394
- root_dir = File.join(ws.prefix_dir, 'gems')
395
- gemfile_path = File.join(root_dir, 'Gemfile')
477
+ gemfile_path = self.class.default_gemfile_path(ws)
478
+ root_dir = File.dirname(gemfile_path)
396
479
  gemfile_lock_path = "#{gemfile_path}.lock"
397
480
  backups = Hash[
398
481
  gemfile_path => "#{gemfile_path}.orig",
@@ -466,7 +549,7 @@ module Autoproj
466
549
  def discover_rubylib
467
550
  require 'bundler'
468
551
  Tempfile.open 'autoproj-rubylib' do |io|
469
- result = Bundler.clean_system(
552
+ result = Autoproj.bundler_unbundled_system(
470
553
  Hash['RUBYLIB' => nil],
471
554
  Autobuild.tool('ruby'), '-e', 'puts $LOAD_PATH',
472
555
  out: io,
@@ -490,7 +573,7 @@ module Autoproj
490
573
  silent_redirect[:err] = :close if silent_errors
491
574
  env = ws.env.resolved_env
492
575
  Tempfile.open 'autoproj-rubylib' do |io|
493
- result = Bundler.clean_system(
576
+ result = Autoproj.bundler_unbundled_system(
494
577
  Hash['GEM_HOME' => env['GEM_HOME'], 'GEM_PATH' => env['GEM_PATH'],
495
578
  'BUNDLE_GEMFILE' => gemfile, 'RUBYOPT' => nil,
496
579
  'RUBYLIB' => self.class.rubylib_for_bundler],