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

grafana: fix build with yarn 1.0 #17863

Merged
merged 1 commit into from
Sep 9, 2017
Merged

Conversation

chrmoritz
Copy link
Contributor

@chrmoritz chrmoritz commented Sep 9, 2017

  • Have you followed the guidelines for contributing?
  • Have you checked that there aren't other open pull requests for the same formula update/change?
  • Have you built your formula locally with brew install --build-from-source <formula>, where <formula> is the name of the formula you're submitting?
  • Does your build pass brew audit --strict <formula> (after doing brew install <formula>)?

The upgrade to yarn 1.0 has broken the ability to build grafana against latest node from source, because yarn 1.0 has enabled/fixed strict top level engine checks.

[1/5] Validating package.json...
error [email protected]: The engine "node" is incompatible with this module. Expected version "4.x".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Refs: Homebrew/brew#2962

The PR adds a workaround which restores the ability to build grafana against the latest node version (and fixes the warning about not being able to find node-gyp).

@@ -23,7 +23,9 @@ def install

cd grafana_path do
system "go", "run", "build.go", "build"
system "yarn", "install"

ENV.prepend_path "PATH", "#{Formula["node"].opt_libexec}/lib/node_modules/npm/bin/node-gyp-bin"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd prefer to see a fix in the node formula for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not a node issue. It just yarn not being aware of homebrew and not looking into the libexec folder when trying to find node-gyp relative to the node executable. This is one of the fixes I wanted to upstream, but I didn't found time to do so yet.
(After that the global node-gyp installation fallback will fail because of sandbox restrictions.)

I can revert this fix if you want, because it fixes only an optional development dependency and I'm still not sure if you want to proper fix yarn configuration on a per formula basis or do something like what was proposed in Homebrew/brew#2962.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's try to either tweak the layout of the node formula or get something upstreamed to yarn.

it fixes only an optional development dependency

I assume it just reinstalls node-gyp, right?

Copy link
Contributor Author

@chrmoritz chrmoritz Sep 9, 2017

Choose a reason for hiding this comment

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

I assume it just reinstalls node-gyp, right?

The install node-gyp globally fallback is failing to because of sandbox restrictions and us not configuring yarn correctly to work with the sandbox. Compiling native addons with yarn does not work at all inside the homebrew sandbox as of now. It just skips the optional build dependency fsevents in our case.

Copy link
Contributor

@ilovezfs ilovezfs Sep 9, 2017

Choose a reason for hiding this comment

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

If you set

ENV["PREFIX"] = ENV["HOME"]

and invoke yarn as Formula["yarn"].opt_libexec/"bin/yarn" does it work?

Copy link
Contributor Author

@chrmoritz chrmoritz Sep 9, 2017

Choose a reason for hiding this comment

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

It should, but it's a hack to fix the fallback.

It shouldn't be an issue to leave the unimportant optional build only dependency broken for now (it was broken since the formula started using yarn anyway and it's not the only formula affected by it).

The best way forward is to fix all issues with yarn and homebrew properly, which involves both upstreaming fixes and doing build-time configuration for yarn in homebrew.

@ilovezfs ilovezfs merged commit c544162 into Homebrew:master Sep 9, 2017
@ilovezfs
Copy link
Contributor

ilovezfs commented Sep 9, 2017

Thanks @chrmoritz!

@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants