Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating FFI support #1863

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Updating FFI support #1863

wants to merge 10 commits into from

Conversation

johnmccrae
Copy link
Contributor

Description

Ohai hasn't been updated in a bit. It's current dependency on a stale version of ffi is causing errors in Chef-19. We also needed to update the supported Ruby versions

Related Issue

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (non-breaking change that does not add functionality or fix an issue)

Checklist:

  • I have read the CONTRIBUTING document.
  • I have run the pre-merge tests locally and they pass.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • If Gemfile.lock has changed, I have used --conservative to do it and included the full output in the Description above.
  • All new and existing tests passed.
  • All commits have been signed-off for the Developer Certificate of Origin.

Sorry, something went wrong.

John McCrae added 2 commits February 6, 2025 09:37
Signed-off-by: John McCrae <mccrae@progress.com>
Signed-off-by: John McCrae <mccrae@progress.com>
@johnmccrae johnmccrae requested review from a team as code owners February 6, 2025 17:42
John McCrae added 5 commits February 6, 2025 13:17
Signed-off-by: John McCrae <mccrae@progress.com>
Signed-off-by: John McCrae <mccrae@progress.com>
Signed-off-by: John McCrae <mccrae@progress.com>
Signed-off-by: John McCrae <mccrae@progress.com>
Signed-off-by: John McCrae <mccrae@progress.com>
@tpowell-progress
Copy link
Contributor

@johnmccrae looks like you still have the cookstyle load error due to racc/parser not being available.

Copy link
Contributor

@tpowell-progress tpowell-progress left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install_if racc if >= 3.3 ruby version.

@johnmccrae johnmccrae closed this Feb 24, 2025
@johnmccrae johnmccrae reopened this Feb 24, 2025
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>
Signed-off-by: John McCrae <john.mccrae@progress.com>

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

rescue LoadError
puts "cookstyle gem is not installed. bundle install first to make sure all dependencies are installed."
rescue LoadError => e
puts e.message
Copy link
Contributor

@tpowell-progress tpowell-progress Feb 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was changed because other dependencies can break. In this case, racc

gem "base64"
end
install_if -> { Gem::Version.new("3.3").to_s >= (RUBY_VERSION).to_s } do
gem "racc", "~> 1.8.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnmccrae this conflicts with the above racc specification for 3.4. The install_if ultimately acts as though the gem command were evaluated at the top or group level for the purpose of recording the Gemfile.lock.

Also the version should be the following (the .to_s is unnecessary and breaks the comparison logic in certain scenarios such as (because string comparison instead of version comparison)

irb(main):011> Gem::Version.new("3.3").to_s >= "3.3.0".to_s
=> false

This should be the order of things (validated that RUBY_VERSION first works)

  install_if -> { RUBY_VERSION >= Gem::Version.new("3.4") } do
    gem "base64"
  end
  install_if -> { RUBY_VERSION >= Gem::Version.new("3.3") } do
    gem "racc", "~> 1.8.0"
  end

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, there should be Gemfile.lock output that has racc and base64


s.add_dependency "chef-config", ">= 14.12", "< 20"
s.add_dependency "chef-utils", ">= 16.0", "< 20"
s.add_dependency "ffi", "~> 1.9"
s.add_dependency "ffi", ">= 1.15.5", "< 1.17.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should probably do #1866 first, I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants