Official Linux script to install Clojure vs. Clojure from Debian 11 Repo

Hi Everybody,

When possible I always use packages from official Linux distro repo. In my case it’s Debian 11 (Bullseye / Testing / Next-Stable):

I was curious what official Linux installation script does different so in one Debian VM I installed VSCode (Codium in my case), Calva and Clojure using https://download.clojure.org/install/linux-install-1.10.1.763.sh and in a second VM I installed Clojure by: apt-get install openjdk-11-jdk clojure leiningen

Comparing those two I noticed that Debian version does not have clj command. After checking man page I found that clj is not supposed to have REPL but after executing clojure command I entered same (I think) REPL as when I executed clj command.

Could you please tell me, Is there something I might/will miss when developing in Clojure installed from Debian repo? Is there a real difference between Clojure from repo and Clojure installed by the official script?

Thank you.

Kind regards,
Robert

Happy New Year 2021 :wink:

1 Like

Interesting experiment! If the Debian lacks clj then we may infer that it does not package the official, so to speak, Clojure wrappers.

The question is, essentially, “1.what Clojure-related parts does Debian package?” and “2.how often does Debian update them?”, so you might get the best answer by asking Debian about its policy for Clojure. Or go find Debian’s package definition “source code” for Clojure and see for yourself what’s inside and how responsively it has updated in the past, compared to Clojure upstream.

But I would go out on a limb and suggest not using any Linux distro’s packaging of Clojure, except when you are making a Clojure-based package that will itself become part of that distro! In short, in cases where you would naturally plan on updating your contributions in lockstep with the distro’s Clojure pieces, and to never desire any Clojure part that is newer or more complete than what the distro provides.

A Linux distro is really, really helpful as a curator of a “known-to-work” combination of the byzantine, tightly coupled, microscopically configurable, circularly dependent core packages, which are so painful to get working that no one cares exactly which version of each piece they have, as long as the whole integrated system works. In contrast, a Linux distro adds less value to Java jars, so we have the luxury of getting annoyed when we’ve chosen an update stream that may be several versions behind at times.

1 Like

Hi Phill,

Thank you very much for responding.

This is the source they use: https://salsa.debian.org/clojure-team

I would say it’s up-to-date.

dpkg --list | grep clojure

ii  clojure                       1.10.1-1    all   Lisp dialect for the JVM
ii  libclojure-java               1.10.1-1    all   Lisp dialect for the JVM (library)
ii  libcore-specs-alpha-clojure   0.2.44-3    all   specs to describe Clojure core macros and functions
ii  libspec-alpha-clojure         0.2.176-3   all   library to describe the structure of data and functions

clojure

Clojure 1.10.1
user=>

I completely agree but it’d be so much easier if I could use Debian packaging. There is no security team on the planet that will like curl x.sh | sudo bash. But if I can use Debian packaging, I don’t need to ask anything to anyone. And we can discuss how to present the whole thing to a security team but this is not the point of this question. Please let’s not discuss that in this thread. Thank you.

Some more details about packaging:

apt-file list clojure

clojure: /etc/rlwrap/clojure1.10
clojure: /usr/bin/clojure1.10
clojure: /usr/bin/clojurec1.10
clojure: /usr/share/doc/clojure/README.Debian
clojure: /usr/share/doc/clojure/changelog.Debian.gz
clojure: /usr/share/doc/clojure/changelog.gz
clojure: /usr/share/doc/clojure/copyright
clojure: /usr/share/man/man1/clojure1.10.1.gz
clojure: /usr/share/man/man1/clojurec1.10.1.gz

apt-file list libclojure-java

libclojure-java: /usr/share/doc/libclojure-java/changelog.Debian.gz
libclojure-java: /usr/share/doc/libclojure-java/changelog.gz
libclojure-java: /usr/share/doc/libclojure-java/copyright
libclojure-java: /usr/share/java/clojure-1.10.1.jar
libclojure-java: /usr/share/java/clojure-1.10.jar
libclojure-java: /usr/share/maven-repo/org/clojure/clojure/1.10.1/clojure-1.10.1.jar
libclojure-java: /usr/share/maven-repo/org/clojure/clojure/1.10.1/clojure-1.10.1.pom
libclojure-java: /usr/share/maven-repo/org/clojure/clojure/1.10.x/clojure-1.10.x.jar
libclojure-java: /usr/share/maven-repo/org/clojure/clojure/1.10.x/clojure-1.10.x.pom

apt-file list libcore-specs-alpha-clojure

libcore-specs-alpha-clojure: /usr/share/doc-base/core-specs-alpha-clojure
libcore-specs-alpha-clojure: /usr/share/doc/libcore-specs-alpha-clojure/README.md
libcore-specs-alpha-clojure: /usr/share/doc/libcore-specs-alpha-clojure/changelog.Debian.gz
libcore-specs-alpha-clojure: /usr/share/doc/libcore-specs-alpha-clojure/changelog.gz
libcore-specs-alpha-clojure: /usr/share/doc/libcore-specs-alpha-clojure/copyright
libcore-specs-alpha-clojure: /usr/share/maven-repo/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar
libcore-specs-alpha-clojure: /usr/share/maven-repo/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.pom
libcore-specs-alpha-clojure: /usr/share/maven-repo/org/clojure/core.specs.alpha/debian/core.specs.alpha-debian.jar
libcore-specs-alpha-clojure: /usr/share/maven-repo/org/clojure/core.specs.alpha/debian/core.specs.alpha-debian.pom

apt-file list libspec-alpha-clojure

libspec-alpha-clojure: /usr/share/doc-base/spec-alpha-clojure
libspec-alpha-clojure: /usr/share/doc/libspec-alpha-clojure/README.md
libspec-alpha-clojure: /usr/share/doc/libspec-alpha-clojure/changelog.Debian.gz
libspec-alpha-clojure: /usr/share/doc/libspec-alpha-clojure/changelog.gz
libspec-alpha-clojure: /usr/share/doc/libspec-alpha-clojure/copyright
libspec-alpha-clojure: /usr/share/maven-repo/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar
libspec-alpha-clojure: /usr/share/maven-repo/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.pom
libspec-alpha-clojure: /usr/share/maven-repo/org/clojure/spec.alpha/debian/spec.alpha-debian.jar
libspec-alpha-clojure: /usr/share/maven-repo/org/clojure/spec.alpha/debian/spec.alpha-debian.pom

On Linux, I use brew (linuxbrew) for installing Clojure, so I have the same install/maintenance process on my Mac desktop and also on my laptop. It also makes it easy to install specific older versions for testing. And it makes sure you get the official Cognitect version of the Clojure CLI.

Linuxbrew also doesn’t require sudo, so concerns around a security team should be mitigated.

As to the OP’s question. clj is GNU read line wrapped version of clojure. So that’s what you’ll be missing. That said, you can probably create yourself a clj alias that does the same rl-wrapping.

You’re assuming that clojure is the same clojure script from the official CLI stuff…

@robert If you run clojure -Sdescribe what output do you get?

You should see something like this if it’s the official CLI:

(! 502)-> clojure -Sdescribe
{:version "1.10.1.763"
 :config-files ["/usr/local/Cellar/[email protected]/1.10.1.763/deps.edn" "/Users/sean/.clojure/deps.edn" ]
 :config-user "/Users/sean/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/Cellar/[email protected]/1.10.1.763"
 :config-dir "/Users/sean/.clojure"
 :cache-dir "/Users/sean/.clojure/.cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}
1 Like

Thank you very much both @didibus and @seancorfield.

After reviewing again differences between Debian and official version I realized that the main (only) difference is (as you correctly pointed out):

/usr/local/lib/clojure/libexec/exec.jar
/usr/local/lib/clojure/libexec/clojure-tools-1.10.1.763.jar
/usr/local/lib/clojure/deps.edn
/usr/local/lib/clojure/example-deps.edn
/usr/local/bin/clojure
/usr/local/bin/clj

Both clojure and clj are shell scripts. clj is missing in Debian version and clojure (in /bin/clojure) is also a shell script and much simpler (shorter).

wc -l /bin/clojure /usr/local/bin/clojure

   26 /bin/clojure
  435 /usr/local/bin/clojure

/bin/clojure -Sdescribe

Execution error (FileNotFoundException) at java.io.FileInputStream/open0 (FileInputStream.java:-2).
-Sdescribe (No such file or directory)

Full report at:
/tmp/clojure-9054386668500752730.edn

uuups :wink:

and I copied the shell script and files from /usr/local/lib/ into the installed Debian version and:
/usr/local/bin/clojure -Sdescribe

{:version "1.10.1.763"
 :config-files ["/usr/local/lib/clojure/deps.edn" "/home/user/.clojure/deps.edn" ]
 :config-user "/home/user/.clojure/deps.edn"
 :config-project "deps.edn"
 :install-dir "/usr/local/lib/clojure"
 :config-dir "/home/user/.clojure"
 :cache-dir "/home/user/.clojure/.cpcache"
 :force false
 :repro false
 :main-aliases ""
 :repl-aliases ""}

So I guess I can copy the files (/usr/local/lib/* and /usr/local/bin/clj, /usr/local/bin/clojure) into the Debian version or maybe even better try Linuxbrew (I didn’t even know brew works on Linux, thank you for letting me know).

1 Like

Hi @robert! :wave:

And what did you come up with? Using a packaged version with some tweaks or installing manually?

1 Like

Apologizes for late answer @tomekw

Both, I installed Debian package and I manually added:

/usr/local/lib/
├── clojure
│   ├── deps.edn
│   ├── example-deps.edn
│   └── libexec
│       ├── clojure-tools-1.10.1.763.jar
│       └── exec.jar
/usr/local/bin/
├── clj
├── clojure

And works great since January.

Recently I read How to install Clojure v1.11 Alfa on Linux? topic which is also a reason I noticed your question and I changed deps.edn in my home folder and again it’s working without any issue and I’m rocking 1.11 alfa :smiley: