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

portable_formula: use [email protected] on Linux #156

Merged
merged 5 commits into from
Aug 31, 2022

Conversation

danielnachun
Copy link
Contributor

This PR should allow us to build the portable formulae on Linux runners with newer glibc. We won't need to rebuilt the bottles since they are currently build against glibc 2.13 in the Wheezy container - the goal here is to make sure they work.

@danielnachun
Copy link
Contributor Author

I'm a little unsure how to add the [email protected] dependency here as on_linux is not defined in this class.

@Bo98
Copy link
Member

Bo98 commented Jun 20, 2022

It'll need to be in self.inherited of PortableFormula, like the keg_only line.

@danielnachun
Copy link
Contributor Author

Okay that got us past the first hurdle but now it's failing with this:

[email protected]: gawk 3.0 (or later) is required to build glibc.

I guess it's trying to build [email protected] from source? Is there a way to use the bottle or do we have to rebuild it here for the test?

@Bo98
Copy link
Member

Bo98 commented Jun 21, 2022

You'll need to special case install [email protected] without the --build-bottle here:

deps = Utils.safe_popen_read("brew", "deps", "-n", "--include-build", name).split("\n")
# Avoid installing glibc. Bottles depend on glibc.
safe_system "brew", "install", "--build-bottle", *verbose, *deps

@danielnachun danielnachun force-pushed the use_glibc_2_13 branch 5 times, most recently from 9637eaa to eb3f429 Compare June 21, 2022 03:44
@danielnachun
Copy link
Contributor Author

I realized we needed to test this with Ubuntu 16.04, so I changed the Dockerfile to use that instead. Now I'm stuck with

fatal: not in a git directory

Presumably I'm missing a step in the Dockerfile, though I'm not exactly sure what to change.

Comment on lines 37 to 42
deps = Utils.safe_popen_read("brew", "deps", "-n", "--include-build", name).split("\n")

if deps.include?("[email protected]")
safe_system "brew", "install", "--ignore-dependencies", *verbose, "[email protected]"
deps -= ["[email protected]"]
end
Copy link
Member

@Bo98 Bo98 Jun 21, 2022

Choose a reason for hiding this comment

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

[email protected] will still be there.

Maybe try something like (variable names could maybe be better):

Suggested change
deps = Utils.safe_popen_read("brew", "deps", "-n", "--include-build", name).split("\n")
if deps.include?("[email protected]")
safe_system "brew", "install", "--ignore-dependencies", *verbose, "[email protected]"
deps -= ["[email protected]"]
end
deps_to_install_from_bottles = ["[email protected]"]
deps = Dependency.expand(Formula[name], cache_key: "portable-package-#{name}") do |dependent, dep|
Dependency.prune if dep.test? || dep.optional?
next if deps_to_install_from_bottles.include?(dep.name)
Dependency.keep_but_prune_recursive_deps
end.map(&:name)
bottled_deps, deps = deps.partition { |dep| deps_to_install_from_bottles.include?(dep) }
safe_system "brew", "install", *verbose, *bottled_deps

I did an array and maybe that's overkill but you get the point hopefully.

@Bo98
Copy link
Member

Bo98 commented Jun 21, 2022

I realized we needed to test this with Ubuntu 16.04, so I changed the Dockerfile to use that instead. Now I'm stuck with

fatal: not in a git directory

Presumably I'm missing a step in the Dockerfile, though I'm not exactly sure what to change.

I'll take a look tomorrow but maybe try pass --debug for more information.

@danielnachun danielnachun force-pushed the use_glibc_2_13 branch 3 times, most recently from 0e14042 to 7e961a7 Compare June 21, 2022 05:31
@danielnachun
Copy link
Contributor Author

I added --debug to the output but it's still not clear to me what the cause of the problem is.

@Bo98
Copy link
Member

Bo98 commented Jun 22, 2022

That error is really weird. The .git directory exists but git says we're not in a git directory? I'll see if I can try reproduce locally.

@danielnachun
Copy link
Contributor Author

I can't reproduce it locally by just using docker run -it homebrew/ubuntu16.04:master, so I'm assuming there's something about the Dockerfile that's causing this problem.

@iMichka
Copy link
Member

iMichka commented Jun 25, 2022

Maybe it has to do with the way we mount the core repo.
What does ${GITHUB_REPOSITORY,,} do? Is that a typo? https://github.com/Homebrew/homebrew-portable-ruby/blob/master/.github/workflows/build.yml#L45

@danielnachun
Copy link
Contributor Author

Maybe it has to do with the way we mount the core repo.
What does ${GITHUB_REPOSITORY,,} do? Is that a typo? https://github.com/Homebrew/homebrew-portable-ruby/blob/master/.github/workflows/build.yml#L45

That does look very odd, but I pushed a commit to change it and it didn't seem to help. I'm still not sure how to try to reproduce this locally. I think I have to run the Dockerfile locally with docker but I'm still figuring that out.

@Bo98
Copy link
Member

Bo98 commented Jun 26, 2022

What does ${GITHUB_REPOSITORY,,} do? Is that a typo?

No that's intentional - it converts it to lowercase.

$ GITHUB_REPOSITORY=Homebrew/homebrew-portable-ruby; echo ${GITHUB_REPOSITORY,,}
homebrew/homebrew-portable-ruby

Really we can ditch the Dockerfile. I can push the CI changes needed to do that, though it would be nice to know how we're managing to get past the several git repo checks in brew as that seems like a bug. Permissions?

@Bo98 Bo98 force-pushed the use_glibc_2_13 branch 2 times, most recently from 96db95a to 1eedd01 Compare July 5, 2022 14:29
@Bo98
Copy link
Member

Bo98 commented Jul 5, 2022

Our "Test Portable Ruby" step apparently has never worked properly on macOS since it's impossible to specify an external Ruby to be used. It also didn't work on Linux because HOMEBREW_RUBY_PATH is ignored, but I've fixed that to use PATH now.

@Bo98 Bo98 force-pushed the use_glibc_2_13 branch 3 times, most recently from eaa89ea to 6d9e543 Compare July 5, 2022 14:43
@MikeMcQuaid
Copy link
Member

How do we restart CI here? I don't see a button like I've used with homebrew-core and brew.

I've rerun them. Presumably you don't have sufficient permissions.

@Bo98
Copy link
Member

Bo98 commented Jul 21, 2022

Also the 10.11 build failed in the "Test Portable Ruby" step but didn't really output anything about why.

In the last push I fixed this step so it would actually test something - i.e. it now actually checks if it is using the just-built Ruby.

For months/years it's never actually tested that properly. For months/years it's actually been using the existing Portable Ruby that brew installs.

I've got it working on Linux but it seems to still be using it's own Portable Ruby on macOS for some reason. I think because the removal of the existing Portable Ruby in brew cleanup doesn't take HOMEBREW_USE_RUBY_FROM_PATH into consideration so either we change that or we remove the existing Portable Ruby install more directly in the workflow rather than relying on brew cleanup, which I'll probably do.

@Bo98 Bo98 force-pushed the use_glibc_2_13 branch from 5826d82 to 5fefaa5 Compare July 21, 2022 12:49
@Bo98
Copy link
Member

Bo98 commented Jul 21, 2022

Looks like HOMEBREW_USE_RUBY_FROM_PATH doesn't actually work on macOS. I can probably just make the step Linux only for now.

@danielnachun danielnachun force-pushed the use_glibc_2_13 branch 4 times, most recently from 0c20031 to a6a237c Compare July 22, 2022 17:53
@danielnachun
Copy link
Contributor Author

I made the "Test Portable Ruby" step Linux-only and 10.11 now works, but now ARM isn't. I messed up pulling the other commits added here and overwrote some by accident and that may be why ARM isn't working, though I thought I managed to restore everything.

@Bo98
Copy link
Member

Bo98 commented Aug 2, 2022

Sorry for the delay - I took the week off.

I think the proper fix is still on the brew side. Skipping tests is not really acceptable in the long term, even if it has always been an issue. I'll take a look later today.

@danielnachun
Copy link
Contributor Author

Should we rerun this with testing of Portable Ruby enabled on macOS when Homebrew/brew#13644 is merged?

@MikeMcQuaid
Copy link
Member

Should we rerun this with testing of Portable Ruby enabled on macOS when Homebrew/brew#13644 is merged?

Did this now @danielnachun 👍🏻

@Bo98
Copy link
Member

Bo98 commented Aug 4, 2022

10.11 works now. 11-arm64 however refuses to use the Ruby on the path:

Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby

@Bo98
Copy link
Member

Bo98 commented Aug 4, 2022

Looks like HOMEBREW_USE_RUBY_FROM_PATH doesn't actually prioritise from the user PATH as I thought - it prioritises /usr/bin over anything, and it just happens to work on 10.11 because /usr/bin/ruby there is so ancient it can't run the version check script.

@github-actions
Copy link

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Aug 26, 2022
@Bo98 Bo98 removed the stale label Aug 26, 2022
@MikeMcQuaid
Copy link
Member

@danielnachun Is this needed for 3.6.0/the glibc changes?

@Bo98
Copy link
Member

Bo98 commented Aug 26, 2022

This is only needed to deprecate the Debian 7 Docker image. No plans to ship a new version of portable-ruby - existing bottles should be fine.

This is ready to go, just need to fix HOMEBREW_USE_RUBY_FROM_PATH over in brew first.

@MikeMcQuaid
Copy link
Member

This is only needed to deprecate the Debian 7 Docker image. No plans to ship a new version of portable-ruby - existing bottles should be fine.

Ok. Sounds like this may also be worth doing as part of 3.6.0.

@danielnachun
Copy link
Contributor Author

It would be great to get this in with 3.6.0. I've tried to look into this and haven't figure anything out yet.

@Bo98 Bo98 merged commit fbde149 into Homebrew:master Aug 31, 2022
@MikeMcQuaid
Copy link
Member

Hurrah, thanks for getting this over the line, both!

@danielnachun danielnachun deleted the use_glibc_2_13 branch September 2, 2022 17:32
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants