From 8a51dd30d857e4db06c456ffbe2db94104e180b8 Mon Sep 17 00:00:00 2001 From: Gabriel Arjones Date: Sat, 30 May 2026 20:34:51 -0300 Subject: [PATCH] fix: make sure BUNDLE_GEMFILE and BUNDLE_LOCKFILE are consistent when invoking bundler --- lib/autoproj/package_managers/bundler_manager.rb | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/autoproj/package_managers/bundler_manager.rb b/lib/autoproj/package_managers/bundler_manager.rb index 001a644e..ab6820d2 100644 --- a/lib/autoproj/package_managers/bundler_manager.rb +++ b/lib/autoproj/package_managers/bundler_manager.rb @@ -60,11 +60,9 @@ def initialize_environment end gemfile_path = File.join(ws.prefix_dir, "gems", "Gemfile") - env.set("BUNDLE_GEMFILE", gemfile_path) if File.file?(gemfile_path) - - gemfile_lock_path = "#{gemfile_path}.lock" - if File.file?(gemfile_lock_path) - env.set("BUNDLE_LOCKFILE", gemfile_lock_path) + if File.file?(gemfile_path) + env.set("BUNDLE_GEMFILE", gemfile_path) + env.set("BUNDLE_LOCKFILE", "#{gemfile_path}.lock") end if cache_dir && File.exist?(cache_dir) @@ -374,7 +372,7 @@ def self.run_bundler(ws, *commandline, target_env = Hash[ "GEM_HOME" => gem_home, "GEM_PATH" => nil, - "BUNDLE_GEMFILE" => gemfile, + "BUNDLE_GEMFILE" => gemfile, "BUNDLE_LOCKFILE" => "#{gemfile}.lock", "RUBYOPT" => nil, "RUBYLIB" => rubylib_for_bundler, ].merge(bundler_version_env) @@ -646,8 +644,8 @@ def discover_bundle_rubylib(silent_errors: false) Tempfile.open "autoproj-rubylib" do |io| result = Autoproj.bundler_unbundled_system( Hash["GEM_HOME" => env["GEM_HOME"], "GEM_PATH" => env["GEM_PATH"], - "BUNDLE_GEMFILE" => gemfile, "RUBYOPT" => nil, - "RUBYLIB" => self.class.rubylib_for_bundler], + "BUNDLE_GEMFILE" => gemfile, "BUNDLE_LOCKFILE" => "#{gemfile}.lock", + "RUBYOPT" => nil, "RUBYLIB" => self.class.rubylib_for_bundler], Autobuild.tool("ruby"), "-rbundler/setup", "-e", "puts $LOAD_PATH", out: io, **silent_redirect