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

Prototype: Install from Binary #1761

Closed
wants to merge 2 commits into from

Conversation

technicalpickles
Copy link

@technicalpickles technicalpickles commented Apr 23, 2021

This is work towards #42

I have only confirmed this on Ubuntu x86_64, with MRI releases. There will need to be some more work to make it more generalized, and supporting other systems. I built this off of my other PR #1760 thinking I would use that to build, and this to install. I can rebase if necessary.

Screen.Recording.2021-04-23.at.3.49.02.PM.mov

This follows the pattern that rvm uses. There's a --movable flag, and that adds some extra options.

Only tested on Ubuntu so far, but I can confirm that the configure options end up in RbConfig, but have not tested beyond that yet.
I have only confirmed this on Ubuntu x86_64, with MRI releases. There will need to be some more work to make it more generalized, and supporting other systems.
@technicalpickles
Copy link
Author

There will need to be some more work to make it more generalized, and supporting other systems.

I was looking more closely at the RVM mirror, and seems that some of these have not been updated particularly recently (5 years). 10.12, vs Big Sur which is 11.2.

Copy link
Member

@mislav mislav left a comment

Choose a reason for hiding this comment

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

This is great. Thanks for working on this!

My expectation was that --movable was added to produce the binaries that are later downloaded with --binary. But looking at the diff, that's not the case, as this downloads RVM's own movable rubies. In the long term, where should we download the rubies from, and how do we verify their authenticity?

@hsbt
Copy link
Member

hsbt commented May 8, 2021

I have no idea to support pre-build binary without ruby-build team. At least, I will not support and investigate them.

@technicalpickles
Copy link
Author

But looking at the diff, that's not the case, as this downloads RVM's own movable rubies.

This is squarely in prototype territory. I didn't have a good place to toss those built iwth --movable at the time I was working on.

In the long term, where should we download the rubies from, and how do we verify their authenticity?

I was thinking about this. I could imagine having something similar to share/ruby-build/<version>:

install_binary "<digest>" "url"

Something I had been thinking about is, how much does this overlap with the existing ruby-build code? The main hooks are using an existing binary rather than building. But the fetch code? It'd be new code.

I could imagine more code being needed to download from GitHub Packages like I mentioned in #42 (comment) . I could also imagine having publish a built file. homebrew had a lot of tooling around both of those already (fetching and publishing), so it wasn't as big of a lift for that project.

As @hsbt said, this would need to be hosted somewhere and managed by someone. I think if we can have a way to let people add repositories of binaries w/ a preference to install them, that would still be a great step forward. It would also help validate the approach for a wider audience.

@mislav
Copy link
Member

mislav commented May 10, 2021

I could imagine more code being needed to download from GitHub Packages like I mentioned in #42 (comment) . I could also imagine having publish a built file. homebrew had a lot of tooling around both of those already (fetching and publishing), so it wasn't as big of a lift for that project.

Using GitHub Packages is a great idea! 🤔

@eregon
Copy link
Member

eregon commented Jun 9, 2021

FYI, you could follow an approach similar to https://github.com/ruby/ruby-builder
It would need to be OS and OS version and architecture specific at minumum.

More might be needed, e.g., if libssl is installed by Homebrew, or MacPorts or Homebrew in a non-standard location on macOS. But that might not be an issue given that ruby-build builds its own openssl for CRuby.

I think building movable Rubies is hard and brittle (#1760 (comment)), so I'd think that would be a non-goal, only use binaries if they are installed to the expected location.

Ultimately it would be best if CRuby itself would provide builds for various OS/OS version/arch, JRuby & TruffleRuby already do. That might be worth opening a ticket at https://bugs.ruby-lang.org/

@hsbt
Copy link
Member

hsbt commented Jun 16, 2021

I prefer to use the binaries from ruby/ruby-builder instead of binaries of RVM because they are built by ruby-build and uses github packages.

@technicalpickles
Copy link
Author

technicalpickles commented Jul 8, 2021

Some relevant details from ruby-builder 1 2:

const releasesURL = 'https://github.com/ruby/ruby-builder/releases'

function getDownloadURL(platform, engine, version) {
  let builderPlatform = platform
  if (platform.startsWith('windows-')) {
    builderPlatform = 'windows-latest'
  } else if (platform.startsWith('macos-')) {
    builderPlatform = 'macos-latest'
  }

  if (common.isHeadVersion(version)) {
    return getLatestHeadBuildURL(builderPlatform, engine, version)
  } else {
    return `${releasesURL}/download/${builderReleaseTag}/${engine}-${version}-${builderPlatform}.tar.gz`
  }
}

Note: they are using releases not packages, which is a little easier for downloading.

@wlnirvana
Copy link

any updates?

@eregon
Copy link
Member

eregon commented Aug 15, 2021

I prefer to use the binaries from ruby/ruby-builder instead of binaries of RVM because they are built by ruby-build and uses github packages.

That's not directly possible because those CRuby binaries are not movable (ruby/setup-ruby#98 (comment)) and so they only work if installed under /opt/hostedtoolcache/Ruby/$VERSION/x64 (linux) / /Users/runner/hostedtoolcache/Ruby/$VERSION/x64 (macOS).

So either someone can find how to make properly-working movable CRuby builds (I think it's hard, likely needs some hacks and I'm not willing to do it, but it seems possible), or there could be a separate set of builds (e.g., another repo like ruby-builder) which for instance expects the install location to be ~/.rbenv/versions (or potentially ~/.rubies for compatibility with chruby, but then we'd need an easy to configure rbenv to use that, or maybe even change the default of rbenv).

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.

5 participants