Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does the alphanumeric value mean in an elixir mix lock file?

Tags:

elixir

sample of the lock file

Hello, I'm curious what the value "d42e20054116c49d5242d3ff9e1913acccebe6015f449d6e312a5bc160e79a62" represents in the slice of the lockfile above. I've tried reading through the mix source code and feel like it has something to do with git, but I can't pinpoint it exactly.

The lock-related module in the mix source code has read and write lock methods (https://github.com/elixir-lang/elixir/blob/5984c6cc29a41d5bc78d49427730c8786d75e2c9/lib/mix/lib/mix/dep/lock.ex#L13) but doesn't say much about the map it deals with. The tests don't seem to hint at what this value represents either: https://github.com/elixir-lang/elixir/blob/9e40b8f786625b2f036ce9c2467cd0a8ade35ce6/lib/mix/test/mix/dep/lock_test.exs.

I thought it might be a git commit hash (either produced by my machine locally or pulled from the dependency's repo. I didn't find that hash in either place.

Any help is appreciated. Thanks!

like image 926
mrjoelkemp Avatar asked May 07 '20 13:05

mrjoelkemp


Video Answer


1 Answers

This is a hash, used in the dependency convergence process. Roughly speaking, Mix.Dep.Converger builds a :digraph of dependencies and uses topology sort to determine whether the dependencies have diverged or not.

You would not be able to find it in Elixir/Mix source code because it’s delegating to the external converger, which depends on what type of dependency is it. In the case of :hex type of dependency, remote is Hex.RemoteConverger.

That said, this value is under full Hex.RemoteConverger responsibility, mix has zero clue about it. If you would like to provide another dependency source to mix you could implement @behaviour Mix.RemoteConverger and upon dependency convergence process, your converter implementation would be called with whatever arguments you want.

like image 80
Aleksei Matiushkin Avatar answered Oct 24 '22 15:10

Aleksei Matiushkin