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

Make no distinction between arm64-darwin-{21,22,23} #7407

Open
sandstrom opened this issue Jan 22, 2024 · 5 comments
Open

Make no distinction between arm64-darwin-{21,22,23} #7407

sandstrom opened this issue Jan 22, 2024 · 5 comments

Comments

@sandstrom
Copy link

When running macOS with an ARM processor, our Gemfile.lock looks like this:

PLATFORMS
  aarch64-linux
  arm64-darwin-21
  arm64-darwin-22
  arm64-darwin-23
  arm64-linux
  x86_64-darwin-21
  x86_64-darwin-22
  x86_64-linux

This doesn't make sense to me, there is no discernible difference between 21/22/23.

I think it would make more sense if it looked like this:

PLATFORMS
  aarch64-linux
  arm64-darwin
  arm64-linux
  x86_64-darwin
  x86_64-linux

(i.e. that the mac platform wouldn't get a bump every year)

Semi-related

@sandstrom sandstrom changed the title Make no distinction between arm64-darwin-21, arm64-darwin-22 and arm64-darwin-23 Make no distinction between arm64-darwin-{21,22,23} Jan 22, 2024
@gstokkink
Copy link

gstokkink commented Apr 24, 2024

Agree with this, not sure what the purpose is of also including the Darwin kernel version in the lockfile, as it's not done for the other architectures either?

@deivid-rodriguez could you maybe shed some light on this? Thanks in advance 😄

@hsbt
Copy link
Member

hsbt commented Apr 24, 2024

We can easily normalize that with https://github.com/rubygems/rubygems/blob/master/lib/rubygems/platform.rb#L118.

But I'm not sure what breaking impact with this change. Does anyone survey that?

@sandstrom
Copy link
Author

sandstrom commented Apr 24, 2024

I think unknown platforms are just ignored.

Any platform allowed(?)

So for example this platform list in Gemfile.lock:

PLATFORMS
  aarch64-linux
  arm64-darwin-21
  arm64-darwin-22
  arm64-darwin-23
  anything-goes-whatever-works
  arm64-linux
  x86_64-darwin-21
  x86_64-darwin-22
  x86_64-linux

Would not cause any trouble when running bundle install. The only thing it does is sorting it alphabetically.

Automatic cleanup

However, we would be left with some "junk platforms" in the gem lockfile.

Perhaps a temporary addition to bundle install that would look for the pattern arm64-darwin-[/d]{2} and replace them with arm64-darmwin to help with automatic cleanup. Such temporary addition could be removed after e.g. ~1 year.

@deivid-rodriguez
Copy link
Member

deivid-rodriguez commented Apr 25, 2024

Agree with this, not sure what the purpose is of also including the Darwin kernel version in the lockfile, as it's not done for the other architectures either?

We just parse what Ruby gives us as RbConfig::CONFIG["arch"].

I agree that Darwin versions are not really different in practice? But not sure. I know people have actually released platform specific gems for different darwin versions but maybe they are actually all equal in code, and that's just due to how RubyGems and Bundler handle platforms right now. I'm also not sure about backwards compatibility.

One thing to note is that since recently, if no darwin version specific precompiled gems are found among resolved gems, Bundler won't lock specific version platforms, but the generic one, like requested here. So this is only a limited problem right now because most popular gems releasing precompiled versions don't ship -darwin-<version> variants, but just generic darwin variants.

@gstokkink
Copy link

One thing to note is that since recently, if no darwin version specific precompiled gems are found among resolved gems, Bundler won't lock specific version platforms, but the generic one, like requested here. So this is only a limited problem right now because most popular gems releasing precompiled versions don't ship -darwin-<version> variants, but just generic darwin variants.

Ah, good to know. Seems like nokogiri is one of those.

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

No branches or pull requests

4 participants