babashka / bbin

Install any Babashka script or project with one command
MIT License
138 stars 9 forks source link

Error when installing from a Git repo with no tags #55

Closed mk closed 1 year ago

mk commented 1 year ago

I tried running bbin install io.github.nextjournal/garden-cli (which I had previously installed) and got the following error:

mk@mkair ~ [1]> bbin version
bbin 0.1.9

mk@mkair ~ [1]> bbin install io.github.nextjournal/garden-cli
{:coords
 #:git{:url "https://github.com/nextjournal/garden-cli.git",
       :tag "",
       :sha ""},
 :lib io.github.nextjournal/garden-cli}
Error building classpath. Library io.github.nextjournal/garden-cli has invalid tag: 
----- Error --------------------------------------------------------------------
Type:     java.io.FileNotFoundException
Message:  /Users/mk/.clojure/.cpcache/A1A0BDF8D59CA7999543C1499C00A8D9.cp (No such file or directory)
Location: /opt/homebrew/bin/bbin:589:13

----- Context ------------------------------------------------------------------
585:                   {:coords {:bbin/url (str "file://" (get-in header [:coords :local/root]))}}
586:                   header)
587:         _ (pprint header' cli-opts)
588:         _ (when-not (#{::no-lib} lib)
589:             (deps/add-deps {:deps script-deps}))
                 ^--- /Users/mk/.clojure/.cpcache/A1A0BDF8D59CA7999543C1499C00A8D9.cp (No such file or directory)
590:         script-root (fs/canonicalize (or (get-in header [:coords :local/root])
591:                                          (local-lib-path script-deps))
592:                                      {:nofollow-links true})
593:         bin-config (load-bin-config script-root)
594:         script-name (or (:as cli-opts)

----- Stack trace --------------------------------------------------------------
clojure.java.io/fn--11617                       - <built-in>
clojure.java.io/fn--11569/G--11523--11576       - <built-in>
clojure.java.io/fn--11591                       - <built-in>
clojure.java.io/fn--11530/G--11519--11537       - <built-in>
clojure.java.io/reader                          - <built-in>
... (run with --debug to see elided elements)
babashka.bbin.cli/bbin                          - /opt/homebrew/bin/bbin:825:1
babashka.bbin.cli                               - /opt/homebrew/bin/bbin:831:3
clojure.core/apply                              - <built-in>
babashka.bbin.cli                               - /opt/homebrew/bin/bbin:835:3
babashka.bbin.cli                               - /opt/homebrew/bin/bbin:833:1

It works when passing the --latest-sha param.

For when a library does not have a tag, it might be worth considering installing the latest sha instead. Alternatively the error message could be improved.

rads commented 1 year ago

Good suggestion. I'm planning to prioritize this next when I have some time.

mk commented 1 year ago

@rads great to see this, thank you!

rads commented 1 year ago

@mk: No problem. It's great to see people using bbin in the wild.