Fork me on GitHub
#tools-deps
<
2019-10-21
>
andy.fingerhut00:10:54

I think it can. Homebrew's first platform was macOS, I believe, where ruby has been installed by default since a long time ago (although I hear that might be changing in the latest macOS just released? Or perhaps the next one?)

andy.fingerhut00:10:31

And probably if I had done a non-minimal install of Ubuntu 19.04 Linux, it might have included ruby as well. In any case, sudo apt-get install ruby definitely works if you do that before brew install clojure. It seems that the main Homebrew install instructions for Linux work without ruby being installed first, surprisingly enough.

seancorfield00:10:50

I just tried install Homebrew on WSL based on https://docs.brew.sh/Homebrew-on-Linux and the first thing it did was install Ruby...

seancorfield00:10:17

(but it might be an "embedded" Ruby for its own use?)

andy.fingerhut00:10:44

Ruby got installed after you did only this command? sh -c "$(curl -fsSL )" ?

andy.fingerhut00:10:28

I will test on a fresh Linux VM and look at what happens a little more carefully while installing Homebrew.

seancorfield00:10:37

Yeah, just confirmed it's an internal version of Ruby, just to run Homebrew! 😐

seancorfield00:10:12

Hmm, and to get Ruby you need patchelf which in turn requires Clang / gcc... OK, not going down that rabbit hole! 🙂

seancorfield00:10:56

So, could Clojure's brew recipe use something other than Ruby to do that textual change in the script?

andy.fingerhut00:10:39

Even a minimal Ubuntu 19.10 Linux install includes gcc, and I remember brew installation installed patchelf early on before.

seancorfield00:10:28

This is an earlier Ubuntu from an early WSL1 install (the joys of Insider builds)

seancorfield00:10:26

(This is on my Mac running Win10 via Parallels with WSL as just a testing ground... maybe later I'll try it on my Win10 laptop although that's also WSL1 but I use it a lot more there... on this machine, I use Mac's Terminal for all my work)

seancorfield00:10:22

Although on Windows now I'm using Scoop to install Clojure etc in PowerShell

andy.fingerhut00:10:24

I believe I have followed the Homebrew Linux install instructions faithfully, and while it does install a ruby executable, it seems to be in a directory that does not end up on your command PATH after following the instructions, but some other directory.

seancorfield00:10:45

Right: > Yeah, just confirmed it's an internal version of Ruby, just to run Homebrew!

andy.fingerhut00:10:09

It seems that perhaps there ought to be a way (or perhaps already is?) for a Homebrew install script to access that internal version.

andy.fingerhut00:10:23

but that's a minor issue of polish, I think.

seancorfield00:10:40

This looks like the only line that is problematic: https://github.com/clojure/brew-install/blob/1.10.1/src/main/resources/install.sh#L14 -- if that used any low-level, guaranteed-to-be-installed command to change the text, it wouldn't need Ruby and it would work just fine.

andy.fingerhut00:10:15

Perhaps. It does appear that sed has a -i option on the couple of systems where I have checked, for easier overwrite-the-input-file-in-one-shell-command convenience.

seancorfield01:10:56

Given that there's a cp just below it, why not use this directly sed "s;PREFIX;$prefix;" < clojure > $prefix/bin/clojure

seancorfield01:10:32

So it would be

mkdir ...
sed ...
cp ...

seancorfield01:10:54

I don't see much reason to modify the installed source files in place.

seancorfield01:10:09

(I'll be interested to hear Alex's thoughts on this tomorrow)

Alex Miller (Clojure team)03:10:22

sed has incompatible syntax between Mac and Linux

dominicm08:10:15

It's the -i flag that's incompatible. You can easily avoid it.

Alex Miller (Clojure team)03:10:20

If you can make it work, patch wanted

andy.fingerhut04:10:18

Any doc page you would recommend on how to test modifications to a Homebrew install script?

andy.fingerhut05:10:28

I have tested on a Linux machine using brew install --interactive clojure where I edited the install.sh script to replace ruby with ${HOMEBREW_RUBY_PATH}, and that worked. It used the Homebrew-internal installation of ruby. I will try that on a macOS system next to see if it works there, too.

andy.fingerhut05:10:30

Yep, worked on a macOS system, too. That shell variable ${HOMEBREW_RUBY_PATH} was the full path name to a Homebrew-internal ruby executable on both a Linux system that had no other ruby installed, as well as on a Mac that had /usr/bin/ruby preinstalled before Homebrew was installed.

andy.fingerhut05:10:15

I created a PR, even though they are likely not accepted for this project, just one convenient way to show the suggested change: https://github.com/clojure/brew-install/pull/5 . Feel free to close it.

hiredman05:10:10

I think "brew-install" in the project name is a misnomer, and install.sh is expected to work on Linux sans homebrew

andy.fingerhut05:10:45

The install.sh script that my PR suggests changing appears to be identical to a file with the same name that I found in both a Mac and Linux Homebrew installation when I installed the clojure Flask.

andy.fingerhut05:10:25

The line my PR suggests changing is the one that was failing on a Linux system with no ruby executable.

andy.fingerhut05:10:08

I mean, I am fairly new to this Homebrew stuff, so could be making any number of mistaken assumptions here, but giving it a shot.

hiredman05:10:42

Sure, and it is also, unless I am mistaken, identical to install.sh which is used for installing on Linux systems which do not use homebrew

andy.fingerhut05:10:18

There is another file named linux-install.sh in the same directory of that repo with install.sh, which uses install commands, that I suspect might be the non-Homebrew Linux install script.

hiredman05:10:52

Ah, my mistake

andy.fingerhut05:10:10

Always glad for another mind on the problem, though. Thanks for looking into it.

hiredman05:10:31

I use Linux as my desktop os, and the idea of using homebrew to manage installed packages is so alien to me. I would consider just making the homebrew script exit with an error suggesting using the Linux install script on Linux. In which case you could depend on the bsd sed options and wouldn't need Ruby. But that is maybe a terribly unfriendly idea.

👍 4
andy.fingerhut05:10:31

The script works fine on macOS already today, since /usr/bin/ruby comes preinstalled (until either Catalina, I think, or maybe the next macOS release, when I have read it will no longer come preinstalled). With this change, it should continue to work on macOS, and start working on Linux. That doesn't mean anyone must use Homebrew on Linux -- just another option.

dominicm08:10:35

I would just not sed in place, and use it to write elsewhere.

dominicm08:10:44

-i is just a convenience flag with sed

tianshu09:10:29

how to add a repository in deps.edn?

dominicm09:10:28

There's a :mvn/repos key

kommen10:10:47

since upgrading to clojure 1.10.1.478 (from https://github.com/Homebrew/homebrew-core/pull/45565) clojure fails to run

kommen10:10:16

$ clojure
Error: Could not find or load main class clojure.main
$ clojure -Spath
Error: Could not find or load main class clojure.main

kommen10:10:30

$ brew info clojure
clojure: stable 1.10.1.478
The Clojure Programming Language

/usr/local/Cellar/clojure/1.10.1.478 (9 files, 21.1MB) *
  Built from source on 2019-10-19 at 20:39:17
From: 
==> Dependencies
Required: rlwrap ✔
==> Requirements
Required: java >= 1.8 ✔
==> Analytics
install: 3,096 (30 days), 11,637 (90 days), 49,842 (365 days)
install_on_request: 3,070 (30 days), 11,511 (90 days), 49,114 (365 days)
build_error: 0 (30 days)

kommen10:10:21

any body else having issues like this?

dominicm10:10:06

Have you wiped your .m2?

dominicm10:10:18

(I'm not suggesting you should)

kommen10:10:10

no, I didn’t

kommen10:10:02

I just tried to move .clojure/deps.edn somewhere else, suspecting a problem with it. but then I get:

kommen10:10:03

$ clj
cp: PREFIX/example-deps.edn: No such file or directory

kommen10:10:38

with an ~/.clojure/deps.edn file only containing {} I guet the same Error: Could not find or load main class clojure.main error

kommen10:10:25

since the -m flag of the java call was changed in this release, I suspect that this would be the problem:

dominicm11:10:52

I don't think it is. I think your install failed.

dominicm11:10:00

Given that you have issues with PREFIX

kommen11:10:09

yes, you’re right

kommen11:10:29

tried to reinstall already, but no luck

dominicm11:10:06

Ruby powers the rewrite on Mac, that's all I know I'm afraid. Maybe there's a log somewhere?

kommen11:10:50

woudn’t know where to look for a log

dominicm11:10:03

It'll be a brew install log I'd guess.

kommen11:10:04

ok, so I manually fixed the install_dir= in /usr/local/bin/clojure and it works now, let’s see if this is only a problem with my machine or if some body else runs into it

kommen11:10:13

for future reference: macOS 10.15 (19A583),

$ ruby --version
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
brew config
HOMEBREW_VERSION: 2.1.15

kommen11:10:37

ok, found the logs and this also explains it:

kommen11:10:38

$ cat ~/Library/Logs/Homebrew/clojure/01.install.sh 
2019-10-21 12:50:08 +0200

./install.sh
/usr/local/Cellar/clojure/1.10.1.478

truffleruby: the -p option is not implemented

dominicm11:10:32

Haha. Yes it does :)

kommen11:10:45

@dominicm thanks for keeping company and pointing me in the right direction

Alex Miller (Clojure team)12:10:34

Ok, so is there something to fix here or is this an issue mainly on your system?

dominicm13:10:09

The problem is that truffle ruby is installed, and that didn't support -p for doing the substitution. Anyone who's playing with graal may run into this.

Alex Miller (Clojure team)13:10:51

so the prior discussion here about using the brew install ruby impl would presumably also address that

dominicm13:10:06

Yes. So would switching to sed.

Alex Miller (Clojure team)13:10:33

-i has different incompatible syntax on mac and linux there

Alex Miller (Clojure team)13:10:45

I used to use sed, then perl for a bit

dominicm13:10:02

I know. But you can avoid using -i

Alex Miller (Clojure team)13:10:30

I seem to remember there was some reason I didn't do that either, but it was a long time ago now

dominicm13:10:30

Probably not a problem. Using brew means ruby anyway. The only impetus would be to unify the install scripts.

plexus13:10:21

unfortunately some distros have stopped including ed... echo -e 'w clojure.bak\n1,$s^PREFIX^'$PREFIX'^\nwq' | ed clojure

kommen13:10:58

I remember I once proposed a sed command which worked on linux and macos, but either my mind or jira search fails me

andy.fingerhut13:10:01

This is exactly the same problem I found on Linux with Homebrew with no Ruby preinstalled. This will be an issue for all macOS Catalina systems, too, which also have no ruby preinstalled for the first time with macOS since it was introduced almost 20 years ago.

kommen13:10:04

but Dominic is right, using brew means using ruby, so I guess it makes sense to be able to rely on ruby

andy.fingerhut13:10:25

There is an issue open for Homebrew for this since June 2019 I found last night.

andy.fingerhut13:10:10

I believe that the patch I submitted for the Clojure Homebrew installer will work for Catalina as well, because it will force the Clojure install.sh to use a ruby installed inside of Homebrew, rather than a system-wide one.

andy.fingerhut13:10:31

But I do not have a macOS Catalina system to test on to be certain.

Alex Miller (Clojure team)13:10:19

well, that certainly bumps it up my priority list

markbastian14:10:50

Does anyone know if the immutant folks intended to let their domain expire? When I go to http://immutant.org/ there's just a domain expiration notification.

dominicm15:10:00

This probably isn't the channel for that. @U06SGCEHJ you're associated I think?

Alex Miller (Clojure team)15:10:45

definitely not the channel, but I'm not sure anyone is still working on immutant

markbastian15:10:49

Ok, thanks for the info. I'll see if there's a better place.

markbastian15:10:56

Oh, I just noticed I posted this in tools-deps, not clojure. Sorry!

Alex Miller (Clojure team)15:10:15

tools.deps.alpha 0.8.578, clj 1.10.1.478 are now available - see #announcements for details

Alex Miller (Clojure team)15:10:06

as a side note, there were changes made to the internal cli scripts between clj and tools.deps (clojure.tools.deps.alpha.script.make-classpath and clojure.tools.deps.alpha.script.generate-manifest). I doubt many people use any of that directly, but changes were made in clojure.tools.deps.alpha.script.make-classpath2 and clojure.tools.deps.alpha.script.generate-manifest2 to avoid any breakage.

ro622:10:05

Is anyone successfully using (add-lib ...) in a Cursive repl? I get a true back, but then "could not locate ... on classpath" when requiring the lib.

cfleming22:10:28

@alexmiller The new :deps and :paths support in aliases is interesting. Am I correct in thinking that this would allow overriding the system deps.edn, e.g. to use a fork of Clojure?

Alex Miller (Clojure team)22:10:19

It still has install deps on the chain

Alex Miller (Clojure team)22:10:34

So, no difference there

cfleming22:10:35

I see. Yes, re-reading the announcement I see I misread it - it’s more for tools to not require the project classpath instead.