scala / community-build

Scala 2 community build — a corpus of open-source repos built against Scala nightlies
Apache License 2.0
139 stars 59 forks source link

install latest scala-cli on behemoths #1517

Closed SethTisue closed 2 years ago

SethTisue commented 2 years ago

so I can use the new scala-cli shebang for scripting

SethTisue commented 2 years ago

I would prefer to use Coursier to manage the installation of scala-cli, but the capability to do that only recently landed, in Coursier 2.1.0-M1. We have an older version install, but cs update won't install a milestone by default. and also it looks like coursier is preferred to cs these days, but our starting point was having cs installed, so to get on the latest we ssh in as jenkins and do:

cs install coursier:2.1.0-M1
coursier uninstall cs
coursier install --contrib scala-cli

and then if scala-cli version shows (as of Dec 7 2021 anyway) 0.0.9, Bob's your uncle!

===

I don't think it should be necessary, but if coursier wants to make a native image for something itself, you'll need to first ssh to the behemoth as admin and:

sudo apt-get install build-essential

(and maybe throw in libz-dev if you see errors about missing zlib headers? not sure if it's needed)

SethTisue commented 2 years ago

gah, one annoying thing here is that you can't #!/usr/bin/env -S scala-cli shebang <args> because our coreutils on the behemoths is too old for env to support -S (and it definitely needs it in order to pass an argument such as shebang)

I don't feel confident attempting to upgrade coreutils systemwide (if doing so is even possible without a full OS upgrade)

so here's what I worked out. let's build a recent coreutils and then copy the env binary into /usr/local/bin

that means in order to run the build locally you have to also do ln -s /usr/bin/env /usr/local/bin/env, but oh well

here's the steps. ssh to the behemoth as jenkins, then:

wget http://ftp.gnu.org/gnu/coreutils/coreutils-8.32.tar.xz && tar xf coreutils-8.32.tar.xz
cd coreutils-8.32
./configure
make

then ssh to the behemoth as admin and:

sudo cp ~jenkins/coreutils-8.32/src/env /usr/local/bin/env

I have now done this on all 3 behemoths.