Skip to content

Resolving a Project.toml with [sources] set for an existing dependency #4086

@fonsp

Description

@fonsp

Hi! I found an interesting case while experimenting for #4085:

Setup: I have a local clone of https://github.com/JuliaPluto/HypertextLiteral.jl checked out at some old commit, at v0.9.4. The current latest version is v0.9.5.

I wrote this Project.toml:

[deps]
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"

[sources.HypertextLiteral]
path = "/Users/fons/Documents/HypertextLiteral.jl"

I make two empty directories that I activate.

One

In the first environment, I write the Project.toml, and then resolve. The result is as expected:

(yay3) pkg> resolve
    Updating `~/Downloads/yay3/Project.toml`
  [ac1192a8] + HypertextLiteral v0.9.4 `~/Documents/HypertextLiteral.jl`
    Updating `~/Downloads/yay3/Manifest.toml`
  [ac1192a8] + HypertextLiteral v0.9.4 `~/Documents/HypertextLiteral.jl`
  [410a4b4d] + Tricks v0.1.9

shell> cat Project.toml
[deps]
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"

[sources.HypertextLiteral]
path = "/Users/fons/Documents/HypertextLiteral.jl"


shell> cat Manifest.toml
# This file is machine-generated - editing it directly is not advised

julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "312e4b9e605df01eeae246a2087d05a62416059a"

[[deps.HypertextLiteral]]
deps = ["Tricks"]
path = "/Users/fons/Documents/HypertextLiteral.jl"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
version = "0.9.4"

[[deps.Tricks]]
git-tree-sha1 = "7822b97e99a1672bfb1b49b668a6d46d58d8cbcb"
uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
version = "0.1.9"

(yay3) pkg> precompile

(yay3) pkg> st
Status `~/Downloads/yay3/Project.toml`
  [ac1192a8] HypertextLiteral v0.9.4 `~/Documents/HypertextLiteral.jl`

Two

In the second environment, I first add HypertextLiteral, adding it from registry at 0.9.5. I then modify the Project.toml to include [sources] and I resolve.

➜  yay2 julia --project=.
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.11.1 (2024-10-16)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

(yay2) pkg> add HypertextLiteral
   Resolving package versions...
    Updating `~/Downloads/yay2/Project.toml`
  [ac1192a8] + HypertextLiteral v0.9.5
    Updating `~/Downloads/yay2/Manifest.toml`
  [ac1192a8] + HypertextLiteral v0.9.5
  [410a4b4d] + Tricks v0.1.9

shell> nano Project.toml

julia> # (I added the sources section)

(yay2) pkg> resolve
  No Changes to `~/Downloads/yay2/Project.toml`
    Updating `~/Downloads/yay2/Manifest.toml`
  [ac1192a8] ~ HypertextLiteral v0.9.5 ⇒ v0.9.5 `~/Documents/HypertextLiteral.jl`

shell> cat Project.toml
[deps]
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"


[sources.HypertextLiteral]
path = "/Users/fons/Documents/HypertextLiteral.jl"

shell> cat Manifest.toml
# This file is machine-generated - editing it directly is not advised

julia_version = "1.11.1"
manifest_format = "2.0"
project_hash = "312e4b9e605df01eeae246a2087d05a62416059a"

[[deps.HypertextLiteral]]
deps = ["Tricks"]
git-tree-sha1 = "7134810b1afce04bbc1045ca1985fbe81ce17653"
path = "/Users/fons/Documents/HypertextLiteral.jl"
uuid = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
version = "0.9.5"

[[deps.Tricks]]
git-tree-sha1 = "7822b97e99a1672bfb1b49b668a6d46d58d8cbcb"
uuid = "410a4b4d-49e4-4fbc-ab6d-cb71b17b3775"
version = "0.1.9"

(yay2) pkg> precompile

(yay2) pkg> st
Status `~/Downloads/yay2/Project.toml`
  [ac1192a8] HypertextLiteral v0.9.5 `~/Documents/HypertextLiteral.jl`

Difference

The two give a different Manifest, and status gives different output. The second one seems incorrect.

The local path was checked out at an old commit, so the git-tree-sha1 should not match.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions