Fork me on GitHub
#tools-deps
<
2021-08-13
>
seancorfield02:08:17

For some tools.build fun, I switched HoneySQL over to using that for all its CI needs: https://github.com/seancorfield/honeysql/blob/develop/build.clj -- CircleCI and GH Actions run this now. Multi-version Clojure testing, ClojureScript testing, Eastwood, Readme testing, JAR-building. Only the Clojars deploy is manual (and currently has to use -X so :pom-file can be provided -- the -M version of deps-deploy doesn't support that option).

šŸ‘Œ 3
seancorfield02:08:13

(TIL: git rev-list --count HEAD produces 1 when run in a GH Actions script???)

dpsutton02:08:28

i can recreate that with git clone --depth 1 <repo>

dpsutton02:08:41

which is probably analogous to what gh is doing

seancorfield03:08:18

Ah, thanks @dpsutton -- yeah, I think you're right that it just clones the most recent commit and nothing else.

dorab17:08:12

Is there a way to prevent build/wite-file from doing a pr-str on the :content? In that way, it is different than spit.

Alex Miller (Clojure team)17:08:07

sure, pass it the string you want to write

dorab18:08:13

Taking the discussion to tools-build

Alex Miller (Clojure team)17:08:34

btw, I've created #tools-build if anyone wants to have future discussion there

seancorfield18:08:26

@alexmiller If t.d.a encounters two git deps with the same URL (and same SHA) but two different :deps/root values, could that cause the "cannot compare versions" error?

seancorfield18:08:40

This is the error (reformatted a bit):

Unable to compare versions for repro-lib/root: 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"} and 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"} 
{:lib repro-lib/root, :coord-x {:local/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"}, :coord-y {:local/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"}}

Unable to compare versions for repro-lib/root: 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/red/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"} and 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/blue/a252586fe4831fe8a719571793cfe81f1f4f7e88/Root"}

seancorfield18:08:24

This is the issue where this has come up https://github.com/polyfy/polylith/issues/108 and the repro case is explained/linked in that.

seancorfield18:08:07

I initially wondered whether it might be a case-sensitivity issue -- the repo has Root, Blue, Red but the :local/root and :git/url deps both have blue and red instead. But then I noticed it is comparing across two different URLs (repro-lib/red and repro-lib/blue) with the same SHA and both have Root? (This might also be an issue with Polylith not respecting :exclusions though).

Alex Miller (Clojure team)19:08:25

whether it's a case problem will likely depend on your os - if you're using a case-sensitive file system, then probably an issue

Alex Miller (Clojure team)19:08:19

those errors above (while in gitlibs dir) are local deps, which can never be compared, as they are just seen as arbitrary files with no known relationship

Alex Miller (Clojure team)19:08:12

so prior questions about gitlibs are irrelevant as those are not at play here

seancorfield19:08:36

Well, other than these being git deps -- and having :local/root deps inside them?

Alex Miller (Clojure team)19:08:11

but ... they're NOT git deps

Alex Miller (Clojure team)19:08:28

:local/root == local dep

seancorfield19:08:38

Note that they are both git deps to the same repo but different :deps/root values.

Alex Miller (Clojure team)19:08:48

there are like 3 repro projects, sorry

Alex Miller (Clojure team)19:08:08

although my comment on your errors above stands - those are local deps

seancorfield19:08:59

and that root project has no deps

Alex Miller (Clojure team)19:08:53

if you have 2 git deps, that both point to local deps within their git repo, then the idea that you're "in" a git dep is lost and there is no way to compare those two deps

Alex Miller (Clojure team)19:08:09

as in the error above, you just have two pointers to the file system

Alex Miller (Clojure team)19:08:29

we've talked about this general problem before here wrt monorepos and there is a ticket for it

seancorfield19:08:38

OK, so this is related to :deps/root? I'm just trying to understand exactly what combo causes this. It looks like have two "identical" git deps with different :deps/root values is what is causing the transitive deps to end up being incomparable?

Alex Miller (Clojure team)19:08:58

I think you have something like: <main> git dep A (+ sub path) local dep to ../foo git dep B (+ sub path) local dep to ../foo

seancorfield19:08:24

I double-checked and was on the wrong branch above (Imre has simplified the repro quite a bit now), and get this error:

Unable to compare versions for repro-lib/green: 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/red/4237c6492172dc6a4102ccfc34df6316ccd1734b/green", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/red/4237c6492172dc6a4102ccfc34df6316ccd1734b/green"} and 
{:local/root "/Users/sean/.gitlibs/libs/repro-lib/blue/4237c6492172dc6a4102ccfc34df6316ccd1734b/green", :deps/manifest :deps, :deps/root "/Users/sean/.gitlibs/libs/repro-lib/blue/4237c6492172dc6a4102ccfc34df6316ccd1734b/green"}
so they are ultimately two paths to the "same" lib, but via different :dep/root -- yes, exactly the above!

seancorfield19:08:09

So the paths to green here are via red in one path and blue in the other -- hence uncomparable b/c they're no longer just "git deps".

Alex Miller (Clojure team)19:08:59

comparisons are made based on two local coords there which (from tools.deps pov) point to arbitrary places in the filesystem, which cannot be compared

2
seancorfield19:08:10

Yup, looks like it. Thank you for sticking with me on that -- we got there in the end šŸ™‚

Alex Miller (Clojure team)19:08:32

I think the "A while ago we discussed the option of a ā€œnearest git repositoryā€ on slack. I wanted to record that. But itā€™s also lacking a problem statement. The idea was a new coordinate type which would search for its nearest repo. In the case of working within the repo, it would search upwards and find the .git folder. In the case of a git/url, it would do the same. This would solve the transitive dependency problem." idea in the comments is interesting but I have not spent a lot of time thinking about it.

Alex Miller (Clojure team)19:08:59

you really want a local dep that retains the git context of its dependee

Alex Miller (Clojure team)19:08:06

and then comparisons would basically need to use git coord comparison rather than local coord comparison

seancorfield19:08:25

So git dep A + sub path X and git dep A + sub path Y both become (different) local deps, in essence?

Alex Miller (Clojure team)20:08:47

depends what you mean by that notation :)

Alex Miller (Clojure team)20:08:56

in any case, I'm not going to work on this today

seancorfield22:08:30

@alexmiller I'm looking at how t.d.a handles :exclusions. It's only documented for :mvn/version coords but it looks like it actually works for all types of coords?

seancorfield22:08:41

Thanks. Oh, and the problem above ultimately traced back to Polylith's test tool not respecting :deps/root -- @imre helped me track that down.

šŸ‘ 2
2
tengstrand15:08:55

Is this something that needs to be fixed @seancorfield?

seancorfield17:08:44

@U1G0HH87L I submitted a PR for the fix.

tengstrand18:08:39

Your changes looks good! My approval of the PR didnā€™t trigger the CI build, so Iā€™m looking into that.

tengstrand18:08:38

Itā€™s merged now!

seancorfield18:08:49

Thank you! Woohoo! I'm a contributor now! šŸ™‚

seancorfield18:08:38

I would have included tests if I could have figured out easily where to put them and how to trigger that code path šŸ˜