summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorMatt Wrock <matt@mattwrock.com>2016-05-25 16:43:58 -0700
committerMatt Wrock <matt@mattwrock.com>2016-05-25 16:43:58 -0700
commit5d37fc2168b30d8ad51cc6b1d127528768bde3de (patch)
tree7207230ce7cbc0e3adb736797bd2cd3ec202df47 /tasks
parent7e3a0aa1ed3559dd599b95cfb90599e2aeedbe6f (diff)
downloadchef-5d37fc2168b30d8ad51cc6b1d127528768bde3de.tar.gz
fix bundle locking on bundler 1.12 and enforce version we wantbun_1_11
Diffstat (limited to 'tasks')
-rwxr-xr-xtasks/bin/bundle-platform8
-rw-r--r--tasks/bundle_util.rb20
2 files changed, 24 insertions, 4 deletions
diff --git a/tasks/bin/bundle-platform b/tasks/bin/bundle-platform
index 7c77393cb1..10d9bb2b3d 100755
--- a/tasks/bin/bundle-platform
+++ b/tasks/bin/bundle-platform
@@ -1,10 +1,14 @@
#!/usr/bin/env ruby
platforms = ARGV.shift
+platforms = platforms.split(" ").map { |p| Gem::Platform.new(p) }
+Gem::Platform.instance_eval { @local = platforms.last }
old_platforms = Gem.platforms
-Gem.platforms = platforms.split(" ").map { |p| Gem::Platform.new(p) }
+Gem.platforms = platforms
puts "bundle-platform set Gem.platforms to #{Gem.platforms.map { |p| p.to_s }} (was #{old_platforms.map { |p| p.to_s } })"
+desired_version = ARGV.shift.delete("_", "")
+
# The rest of this is a normal bundler binstub
require "pathname"
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile",
@@ -12,4 +16,4 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile",
require "rubygems"
-load Gem.bin_path("bundler", "bundle")
+load Gem.bin_path("bundler", "bundle", desired_version)
diff --git a/tasks/bundle_util.rb b/tasks/bundle_util.rb
index a057db858a..67647dd4f0 100644
--- a/tasks/bundle_util.rb
+++ b/tasks/bundle_util.rb
@@ -57,7 +57,14 @@ module BundleUtil
# Run the bundle command
ruby_platforms = platform ? PLATFORMS[platform].join(" ") : "ruby"
- cmd = Shellwords.join([Gem.ruby, "-S", bundle_platform, ruby_platforms, *args])
+ cmd = Shellwords.join([
+ Gem.ruby,
+ "-S",
+ bundle_platform,
+ ruby_platforms,
+ "_#{desired_bundler_version}_",
+ *args,
+ ])
puts "#{prefix}#{Shellwords.join(["bundle", *args])}#{platform ? " for #{platform} platform" : ""}:"
with_gemfile(gemfile) do
puts "#{prefix}BUNDLE_GEMFILE=#{gemfile}"
@@ -65,7 +72,7 @@ module BundleUtil
if extract_output
`#{cmd}`
else
- unless system(bundle_platform, ruby_platforms, *args)
+ unless system(bundle_platform, ruby_platforms, "_#{desired_bundler_version}_", *args)
raise "#{bundle_platform} failed: exit code #{$?}"
end
end
@@ -91,4 +98,13 @@ module BundleUtil
def platforms
PLATFORMS.keys
end
+
+ def desired_bundler_version
+ @desired_bundler_version ||= begin
+ omnibus_overrides = File.join(project_root, "omnibus_overrides.rb")
+ File.readlines(omnibus_overrides).each do |line|
+ return $1 if line =~ /^override :bundler, version: "(.+)"$/
+ end
+ end
+ end
end