bundle exec omnibus build omnibus-toolchain fails with an exception because the delegation methods in chef-cleanroom do not handle the ruby-3.0 keyword argument change.
sudo mkdir /opt/omnibus-toolchain /var/cache/omnibus
sudo chown vagrant /opt/omnibus-toolchain /var/cache/omnibus
wget https://github.com/chef/omnibus-toolchain/archive/refs/tags/2.1.24.tar.gz
tar -xzf 2.1.24.tar.gz
cd omnibus-toolchain-2.1.24/
bundle install --without development --path vendor/bundle
bundle exec omnibus build omnibus-toolchain
Expected Result:
Build should succeed.
Actual Result:
Build fails during usage of update_config_guess via lib/cleanroom.rb.
[vagrant@localhost omnibus-toolchain-2.1.24]$ bundle exec omnibus build omnibus-toolchain [CLI] I | 2022-03-18T17:40:30+00:00 | Using config from 'omnibus.rb'
bundler: failed to load command: omnibus (/home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bin/omnibus)
/home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/builder.rb:771:in `update_config_guess': wrong number of arguments (given 1, expected 0) (ArgumentError)
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:130:in `public_send'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:130:in `block (3 levels) in cleanroom'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-software-2551807dcebf/config/software/libtool.rb:40:in `block in evaluate'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:70:in `instance_eval'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:70:in `evaluate'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:184:in `evaluate'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:645:in `build'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:130:in `public_send'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:130:in `block (3 levels) in cleanroom'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-software-2551807dcebf/config/software/libtool.rb:36:in `evaluate'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:70:in `instance_eval'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:70:in `evaluate'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:56:in `evaluate_file'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb:173:in `evaluate_file'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:45:in `load'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:868:in `block in load_dependencies'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:867:in `each'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:867:in `load_dependencies'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/software.rb:46:in `load'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/project.rb:822:in `block in load_dependencies'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/project.rb:821:in `each'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/project.rb:821:in `load_dependencies'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/project.rb:47:in `load'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/cli.rb:85:in `build'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/cli/base.rb:33:in `dispatch'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/lib/omnibus/cli.rb:42:in `execute!'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bundler/gems/omnibus-124d5960ab2d/bin/omnibus:16:in `<top (required)>'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bin/omnibus:23:in `load'
from /home/vagrant/omnibus-toolchain-2.1.24/vendor/bundle/ruby/3.0.0/bin/omnibus:23:in `<top (required)>'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:63:in `load'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:63:in `kernel_load'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli/exec.rb:28:in `run'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli.rb:474:in `exec'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli.rb:30:in `dispatch'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/cli.rb:24:in `start'
from /usr/share/gems/gems/bundler-2.2.22/libexec/bundle:49:in `block in <top (required)>'
from /usr/share/gems/gems/bundler-2.2.22/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
from /usr/share/gems/gems/bundler-2.2.22/libexec/bundle:37:in `<top (required)>'
from /usr/bin/bundle:23:in `load'
from /usr/bin/bundle:23:in `<main>'
The exception is misleading. The actual method takes keyword arguments and the invocation of the method in config/software/libtool.rb is using keywords. The actual cause of this exception is the use of lib/cleanroom.rb--specifically that its delegation methods have not been updated for the keyword argument change in Ruby 3.0.
I resolved this locally by adding **kwargs to the delegators arguments:
[vagrant@localhost omnibus-toolchain-2.1.24]$ diff -wu vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb.orig vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb
--- vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb.orig 2022-03-18 17:41:25.392298721 +0000
+++ vendor/bundle/ruby/3.0.0/gems/chef-cleanroom-1.0.4/lib/cleanroom.rb 2022-03-18 17:41:27.342308743 +0000
@@ -66,8 +66,8 @@
# @param [Proc] block
# the block to +instance_eval+
#
- def evaluate(instance, *args, &block)
- cleanroom.new(instance).instance_eval(*args, &block)
+ def evaluate(instance, *args, **kwargs, &block)
+ cleanroom.new(instance).instance_eval(*args, **kwargs, &block)
end
#
@@ -126,8 +126,8 @@
end
exposed.each do |exposed_method|
- define_method(exposed_method) do |*args, &block|
- __instance__.public_send(exposed_method, *args, &block)
+ define_method(exposed_method) do |*args, **kwargs, &block|
+ __instance__.public_send(exposed_method, *args, **kwargs, &block)
end
end
@@ -180,8 +180,8 @@
# @param (see Cleanroom.evaluate_file)
# @return [self]
#
- def evaluate(*args, &block)
- self.class.evaluate(self, *args, &block)
+ def evaluate(*args, **kwargs, &block)
+ self.class.evaluate(self, *args, **kwargs, &block)
self
end
end
Version:
2.1.24
Environment:
Centos 8 on x86_64 via Vagrant box
bento/centos-stream-8
using ruby-3.0.Scenario:
bundle exec omnibus build omnibus-toolchain
fails with an exception because the delegation methods inchef-cleanroom
do not handle the ruby-3.0 keyword argument change.https://www.ruby-lang.org/en/news/2019/12/12/separation-of-positional-and-keyword-arguments-in-ruby-3-0/
Steps to Reproduce:
This occurs on any system trying to build using ruby-3.0. My examples are on Centos 8 under Vagrant.
Ruby-3.0 can be installed on Centos8 by doing:
Standard build tools needed can be installed by doing:
And then the build is initiated by doing:
Expected Result:
Build should succeed.
Actual Result:
Build fails during usage of
update_config_guess
vialib/cleanroom.rb
.The exception is misleading. The actual method takes keyword arguments and the invocation of the method in
config/software/libtool.rb
is using keywords. The actual cause of this exception is the use oflib/cleanroom.rb
--specifically that its delegation methods have not been updated for the keyword argument change in Ruby 3.0.I resolved this locally by adding
**kwargs
to the delegators arguments:I realize that this issue is in the gem
chef-cleanroom
, however that gem (https://rubygems.org/gems/chef-cleanroom/versions/1.0.4)'s homepage no longer exists: https://github.com/chef/cleanroom as a Chef-maintained project even though it's a Chef-owned gem and an omnibus dependency.