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

idris: install using haskell-stack #1630

Closed
wants to merge 1 commit into from

Conversation

ilovezfs
Copy link
Contributor

@ilovezfs ilovezfs commented Jun 1, 2016

  • use haskell-stack to build idris to work around GHC 8 incompatibility
  • minor style changes to the test-do block

Issue #1486.

@BrewTestBot BrewTestBot added the in progress Stale bot should stay away label Jun 1, 2016
@MikeMcQuaid
Copy link
Member

👍

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

@MikeMcQuaid That would be lovely, but I expect it to fail. I want to see it fail on CI not just locally, to rule out any local issues.

However, I'm experimenting locally with a stack-based workaround.

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

Yup, same failure as I get locally:

Building libraries...
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C prelude build
../../dist/dist-sandbox-a2ddac0/build/idris/idris --build prelude.ipkg
./Builtins.idr:6:1: error: expected: declaration,
    end of input
||| The canonical single-element type, also known as the trivially 
^                                                                  
Type checking ./Builtins.idr
make[1]: *** [build] Error 1
make: *** [build] Error 2
cabal: Leaving directory '.'
cabal: Error: some packages failed to install:
idris-0.11.2 failed during the building phase. The exception was:
ExitFailure 2

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

Stack-based workaround installs and passes the test:

==> Summary
🍺  /usr/local/Cellar/idris/0.11.2_2: 2,324 files, 936.0M, built in 8 minutes 39 seconds
iMac-TMP:Idris-dev joe$ brew test -v idris
Testing idris
==> Using the sandbox
/usr/bin/sandbox-exec -f /tmp/homebrew20160601-56408-1fj3ukz.sb /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -W0 -I /usr/local/Library/Homebrew -- /usr/local/Library/Homebrew/test.rb /usr/local/Library/Taps/homebrew/homebrew-core/Formula/idris.rb -v
==> /usr/local/Cellar/idris/0.11.2_2/bin/idris /tmp/idris-test-20160601-56409-1w546mh/hello.idr -o /tmp/idris-test-20160601-56409-1w546mh/hello
==> /tmp/idris-test-20160601-56409-1w546mh/hello
iMac-TMP:Idris-dev joe$

@ilovezfs ilovezfs changed the title idris: trigger CI idris: install using haskell-stack Jun 1, 2016
@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

@MikeMcQuaid I've updated the PR with the haskell-stack based workaround.

Also, CC @zmwangx and @borsboom (RE: commercialhaskell/stack#848)

mkdir_p bin
system "stack", "install", "--local-bin-path=#{bin}"

install_dir = libexec/"stack/.stack-work/install/x86_64-osx/lts-5.11/7.10.3"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is why we need stack install --prefix...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@MikeMcQuaid

install_dir = IO.popen("stack path --local-install-root") { |io| io.gets.chomp }

or

install_dir = `stack path --local-install-root`.chomp

?

Copy link
Member

Choose a reason for hiding this comment

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

install_dir = Utils.popen("stack path --local-install-root").chomp

@borsboom
Copy link
Contributor

borsboom commented Jun 1, 2016

You might want to use the output of stack path --local-install-root instead of hard-coding .stack-work/install/x86_64-osx/lts-5.11/7.10.3 which could change in the future.

It looks like you're copying out of the .stack-work directory as a workaround for the lack of a stack --prefix option. I don't know if this is a problem with Idris in particular, but I'll just warn you that some Haskell packages are not relocatable because they end up with compiled-in hard-coded paths pointing to the original build directory (finding an elegant solution to this is the main holdup of supporting a stack --prefix option, but we recently got some code contributed that attempts to make these relocatable so hopefully we'll have a solution soon).

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

You might want to use the output of stack path --local-install-root instead of hard-coding .stack-work/install/x86_64-osx/lts-5.11/7.10.3 which could change in the future.

Good idea.

for the lack of a stack --prefix option

Pretty please, with sugar on top.

I don't know if this is a problem with Idris in particular

It is, which is why I had to leave the .stack-work intact for everything except the docs and executables.

we recently got some code contributed that attempts to make these relocatable.

Nice! Do you happen to have a link?

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

Woo hoo 🍏

system "stack", "setup"
system "stack", "build"

mkdir_p bin
Copy link
Member

Choose a reason for hiding this comment

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

Tiniest nit that normally we go for bin.mkpath

@MikeMcQuaid
Copy link
Member

Tiny nits otherwise 👍

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

@MikeMcQuaid Sweet.

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 1, 2016

@MikeMcQuaid Also, we can optionally make the .stack-work visible using --work-dir=whatever_subfolder_name_you_want. Any preference between the default .stack-work or something else?

- use haskell-stack to build idris to work around GHC 8 incompatibility
- minor style changes to the test-do block

Issue Homebrew#1486.
@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

@DomT4 Any changes desired?

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

@MikeMcQuaid any thoughts on #1630 (comment)? I don't know if there's any precedent for a significant invisible dot directory that's actually installed within the Cellar, but I don't mind the .stack-work default if you don't.

@MikeMcQuaid
Copy link
Member

@ilovezfs I think I'd rather it's not in the Cellar if possible? I'm not sure I understand the contents or purpose, though, so I'm lacking context currently.

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

It's required that it be installed since it contains the installation directory ("work-dir" is somewhat of a misnomer, or at least an incomplete description). The core issue is that some paths can get hard coded (which they indeed do in the case of Idris), and the stack work-dir must be a subfolder of the directory in which you're building. It can have whatever name you'd like, but the default is libexec/"stack/.stack-work" since we're building in libexec/"stack". Here's what's ultimately installed: https://gist.github.com/ilovezfs/0dd1839e08440f29471ff6aa40554762

@MikeMcQuaid
Copy link
Member

I see, yuck. Normally I'm pretty 👎 on installation happening in the prefix but if it's unavoidable to fix up this package that's otherwise broken then a begruding 👍. I think in this case it's better to be a hidden/dotted work directory then, yeh.

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

I see, yuck. Normally I'm pretty 👎 on installation happening in the prefix

@MikeMcQuaid hehe. Yes indeed. That's why I flagged what's happening here with a neon sign for you!

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

On the bright side, this is a proof-of-concept for using stack with brew, even with its current limitations, and there's reason to be hopeful that the situation will improve in the future as there are upstream stack plans for the ability to locate the work-dir outside of the build path and, even more significantly, to add a --prefix option for installation.

@ilovezfs ilovezfs closed this in a93d454 Jun 2, 2016
@BrewTestBot BrewTestBot removed the in progress Stale bot should stay away label Jun 2, 2016
@ilovezfs
Copy link
Contributor Author

ilovezfs commented Jun 2, 2016

🚢 'd

@ilovezfs ilovezfs deleted the idris-ci branch June 3, 2016 10:21
@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.

5 participants