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

Add brew and apt support #349

Open
dbalatero opened this issue Nov 7, 2022 · 29 comments
Open

Add brew and apt support #349

dbalatero opened this issue Nov 7, 2022 · 29 comments

Comments

@dbalatero
Copy link
Contributor

Hi @reese, hope you're good! Wondering if there are plans to add this as a Cargo package so you can cargo install rubyfmt?

I have a few other linting plugins that work that way that I use from Neovim (example), and they seem to nicely make their way to my $PATH without much more work. Thanks!

@reese
Copy link
Collaborator

reese commented Nov 12, 2022

I feel like we should have a better distribution strategy, but I don't think any plans are set at the moment. (cc @penelopezone if you've got thoughts on this.)

My first thought is that having to actually build the Ruby checkout might make something like cargo install kinda annoying unless we got rid of all of the build-time system dependencies (like make and autoreconf). It might end up being more straightforward to have precompiled binaries and to use system package managers like brew instead, but I definitely think having some kind of easier package management is something we should do.

@dbalatero
Copy link
Contributor Author

I think brew install rubyfmt / apt-get install rubyfmt would be totally fine ways to distribute it. I'm thinking of integrating it into my company's pipeline, and I really just need a cheap, no-nonsense way to:

  • get it into CI pipelines
  • get it onto dev machines

Honestly, the package manager approach would probably be most familiar to folks, and cargo would be a bit more niche unless you do Rust!

@fables-tales
Copy link
Owner

Strong 👍 we should do brew and apt but not cargo

@fables-tales fables-tales changed the title Add cargo install support Add brew and apt support Nov 13, 2022
@matthewford
Copy link

brew fails if you run make release

bash -c "find target/release | grep -i 'librubyfmt-.*\.a' | xargs rm; exit 0"
find: target/release: No such file or directory

@reese
Copy link
Collaborator

reese commented Nov 19, 2022

@matthewford how is brew involved here? What's the original command you're running?

@matthewford
Copy link

@reese my recipe is here: https://github.com/matthewford/homebrew-core/tree/bump-rubyfmt-0.8

I don't think it's a brew issue specifically I see there was an old closed issue with the same error

@matthewford
Copy link

#340

@matthewford
Copy link

Homebrew/homebrew-core#88103 (comment) this is the same issue

@matthewford
Copy link

matthewford commented Nov 20, 2022

@reese using your homebew PR I see a similar issue:

Last 15 lines from /Users/matthewford/Library/Logs/Homebrew/rubyfmt/01.cargo:
   Compiling rubyfmt v0.8.0-pre (/private/tmp/rubyfmt-20221120-87784-1mvjnl7/rubyfmt-0.8.0/librubyfmt)
   Compiling unicode-normalization v0.1.21
   Compiling addr2line v0.17.0
   Compiling aho-corasick v0.7.18
   Compiling object v0.29.0
   Compiling bstr v0.2.17
error: failed to run custom build command for `rubyfmt v0.8.0-pre (/private/tmp/rubyfmt-20221120-87784-1mvjnl7/rubyfmt-0.8.0/librubyfmt)`

Caused by:
  process didn't exit successfully: `/private/tmp/rubyfmt-20221120-87784-1mvjnl7/rubyfmt-0.8.0/target/release/build/rubyfmt-072919fc54932cda/build-script-build` (exit status: 1)
  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: build failed, waiting for other jobs to finish...
error: failed to compile `rubyfmt-main v0.8.0-pre (/private/tmp/rubyfmt-20221120-87784-1mvjnl7/rubyfmt-0.8.0)`, intermediate artifacts can be found at `/private/tmp/rubyfmt-20221120-87784-1mvjnl7/rubyfmt-0.8.0/target`

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

I think you're pointing to several different issues here, the issue on my PR, #340, and the make error you're referring to are all separate issues.

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Mine is because we rely on a git checkout, so we probably need to actually pull the submodule first, your error is because make release calls find which exits non-zero the first time you build

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

#340 is specific to M1 and is referring to an error in the build script, that's separate from either of these

@matthewford
Copy link

matthewford commented Nov 20, 2022

@reese I got around the it's not a git dir, by cloning in this commit matthewford/homebrew-core@649219c, but then ran into the other issue about find: target/release: No such file or directory. Not on an M1 mac

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Right, I'm saying the M1 bit is not what you're running into. You can either just mkdir_p "target/release" or just use cargo install like on my PR instead. (Are you committing to doing the brew bit here? I'm happy to leave this to you if you want, we don't need to both be working on this)

@matthewford
Copy link

@reese I'm struggling to get this to compile via homebrew, I tried adding

mkdir_p "target/release"

but then still getting this error:

Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Can you give the full error output? There should be more above that line.

@matthewford
Copy link

Unfortunately there isn't any

 Compiling rubyfmt v0.8.0-pre (/private/tmp/rubyfmt-20221120-20601-1tb15x5/librubyfmt)
  Compiling unicode-normalization v0.1.21
  Compiling aho-corasick v0.7.18
error: failed to run custom build command for `rubyfmt v0.8.0-pre (/private/tmp/rubyfmt-20221120-20601-1tb15x5/librubyfmt)`

Caused by:
 process didn't exit successfully: `/private/tmp/rubyfmt-20221120-20601-1tb15x5/target/release/build/rubyfmt-072919fc54932cda/build-script-build` (exit status: 1)
 --- stderr
 Error: Os { code: 2, kind: NotFound, message: "No such file or directory" }
warning: build failed, waiting for other jobs to finish...
make: *** [release] Error 101

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

I don't think I have any immediate answers then, I'm debugging the same thing but it builds fine outside of brew, so it's definitely something related to the brew setup (which I'm not at all familiar with).

@matthewford
Copy link

matthewford commented Nov 20, 2022

If you use the debug flag to keep the tmp dir around.

brew reinstall --build-from-source rubyfmt -v --debug
make release works fine within the tmp dir, so I have no idea

@matthewford
Copy link

@reese that last commit works well. Thanks for this!

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Looks like you already saw it, but just for posterity in case anyone else sees this, I'm updating the brew formula here, and I think the missing files mentioned in the thread were probably autoconf and make not being marked as dependencies, so I think just adding them should get us working.

@matthewford thanks for taking a look! I definitely just took all the git bits from your branch to make the submodule stuff work, your help was much appreciated!

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Ah dang, so one issue here:

@penelopezone I don't think brew will let us release a pre-release version. We'd probably need to do a 0.8.0 release that's not 0.8.0-pre if we want it in brew.

@fables-tales
Copy link
Owner

I mean call it 0.8.1 and ship it I guess? That seems like a very weird arbitrary constraint but I have no issues with that

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

We might just be able to un-check the prerelease option on the Github release, I don't know if it actually requires us to cut a new release.

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

I'm just gonna try unchecking it and see if that works 🤷

@fables-tales
Copy link
Owner

why is homebrew like this

@reese
Copy link
Collaborator

reese commented Nov 20, 2022

Ok yeah just unchecking the box worked, thanks brew very cool. Now just gotta make sure all the builds work

@reese
Copy link
Collaborator

reese commented Nov 22, 2022

Just an update for the folks following along at home, the current release is now out on brew, so now you can brew install rubyfmt!

Still a WIP on getting apt support working though, that's coming down the line.

@dbalatero
Copy link
Contributor Author

For anyone else installing, I had to run brew update to pick up the 0.8.0 version (I guess there's an older 0.2.0 version that was on brew before)!

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