Skip to content
Snippets Groups Projects

Add a bootstrap-haskell script, fixes #36

Merged Ghost User requested to merge bootstrap into master

Merge request reports

Checking pipeline status.

Approval is optional

Merged by avatar (Jun 2, 2025 12:59pm UTC)

Merge details

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • I added a PR for the script I had previously written (#41) for comparison.

  • Hey! Anything I can do to help move this along? It would be great to have this ready when cabal 3.0 is released so there's a good story for the whole toolchain :)

  • Author Contributor

    @m-renaud please try the latest version

  • Author Contributor

    travis is forever broken here and I cannot figure out how to fix it

  • @hasufell tried it out just now, works great other than the "wait for input not working".

    I downloaded the script to a local file and ran cat bootstrap-haskell | sh and it printed the prompt to press enter to continue, but continued along with actually waiting for input.

    If I change the script to be executable (chmod +x bootstrap-haskell) and then ./bootstrap-haskell it works as expected. It looks likeread has different behaviour if its piped into sh instead of being run as a script as part of a pipeline (see this SO answer).

    So, it looks like our options are either:

    1. Use the workaround provided there (3 commands, messier, -1 from me)
    2. Don't prompt, just install.

    My vote would be for (2), if they're on the ghcup site they already know what it does. At the bottom we could give instructions for how to uninstall ghcup (namely, rm -rf ~/.ghcup), or we could also provide a ghcup uninstall command which does the right thing. I think for an initial version just providing instructions would be sufficient.

    Also, I noticed that the script runs _edo ghcup set which just prints the usage of the command at the bottom:

    Done installing, run "ghci-8.4.4" or set up your current GHC via: ghcup set 8.4.4
    ghcup set
    ghcup-set
    Set the currently active GHC to the specified version
    
    USAGE:
        ghcup set [FLAGS] <VERSION>
    
    FLAGS:
        -h, --help       Prints help information
    
    ARGS:
        <VERSION>        E.g. "8.4.3" or "8.6.1"
    
    DISCUSSION:
        Sets the the current GHC version by creating non-versioned
        symlinks for all ghc binaries of the specified version in
        "~/.ghcup/bin/<binary>".

    Was that intentional?

  • Matt Renaud
  • I noticed you commented out some of the llvm deps in the travis config, what's the rationale behind that? It looks like it may be the cause of the issue.

  • Also, I just realized that by running just ghcup set returns a status code of 1 meaning that cabal-install is never installed.

  • Ghost User
  • Author Contributor

    Also, I noticed that the script runs _edo ghcup set which just prints the usage of the command at the bottom:

    That's because you are upgrading to an older version while the script is running. See what the travis.sh does.

    I noticed you commented out some of the llvm deps in the travis config, what's the rationale behind that? It looks like it may be the cause of the issue.

    Why do you think that? It's gold linker messup afais and GHC just picks up whatever it wants.

    Also, I just realized that by running just ghcup set returns a status code of 1 meaning that cabal-install is never installed.

    See above, you're upgrading to an older version while running the script. Set BOOTSTRAP_HASKELL_NO_UPGRADE=1.

  • Author Contributor

    If I change the script to be executable (chmod +x bootstrap-haskell) and then ./bootstrap-haskell it works as expected. It looks likeread has different behaviour if its piped into sh instead of being run as a script as part of a pipeline (see this SO answer).

    Will look into it.

  • Sorry, I don't think I was very clear in my previous comment, either that or I didn't follow your response.

    When I pipe the bootstrap-haskell script though sh it doesn't complete successfully. It installs ghc but then fails at the next step:

    ...
    Done installing, run "ghci-8.4.4" or set up your current GHC via: ghcup set 8.4.4
    ghcup set
    ghcup-set
    Set the currently active GHC to the specified version
    
    USAGE:
        ghcup set [FLAGS] <VERSION>
    
    FLAGS:
        -h, --help       Prints help information
    
    ARGS:
        <VERSION>        E.g. "8.4.3" or "8.6.1"
    
    DISCUSSION:
        Sets the the current GHC version by creating non-versioned
        symlinks for all ghc binaries of the specified version in
        "~/.ghcup/bin/<binary>".
    
    $ echo $?
    2

    The bootstrap-haskell script has the line _edo ghcup set which is incorrect usage, causing the script to exit early and never run _edo ghcup install-cabal or any of the other commands below it.

    Shouldn't it be _edo ghcup set 8.4.4?

  • Matt Renaud
  • Matt Renaud
  • Author Contributor

    The bootstrap-haskell script has the line _edo ghcup set which is incorrect usage, causing the script to exit early and never run _edo ghcup install-cabal or any of the other commands below it.

    Shouldn't it be _edo ghcup set 8.4.4?

    No, the line is correct, I already explained it: You're upgrading to an older version while running the script. Set BOOTSTRAP_HASKELL_NO_UPGRADE=1 (after you've copied the script from this PR). Also see the commits of this PR.

  • No, the line is correct...

    Ah, yes you're right. I see where my confusion came from: I hadn't realized that there was a required change to ghcup in this PR to make ghcup set auto-discover the version to use if no arguments are passed. I had just pulled down a copy of the bootstrap script, not the updated ghcup so the ghcup that was being downloaded and used obviously didn't have this change so was erroring out. Sorry about the noise.

  • Author Contributor

    to make ghcup set auto-discover the version to use if no arguments are passed

    Yeah, I think it's a useful feature. Also removes the need to hack around and try to source ghcup.

  • Matt Renaud
  • Ghost User
  • Author Contributor

    So, in order to merge this I would basically have to exclude this from the travis test...

  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading