From 3ead3c6d19e412489cfccd852150259f7ace729f Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Fri, 1 Mar 2024 17:43:52 +0100 Subject: [PATCH 01/13] more tests + add sources when add/dev --- src/Types.jl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Types.jl b/src/Types.jl index 5f72f49c96..2de3112287 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -1230,6 +1230,13 @@ function write_env(env::EnvCache; update_undo=true, @assert entry.repo.subdir == repo.subdir end end + if entry.path !== nothing + env.project.sources[pkg] = Dict("path" => entry.path) + elseif entry.repo != GitRepo() + d = Dict("url" => entry.repo.source) + entry.repo.rev !== nothing && (d["rev"] = entry.repo.rev) + env.project.sources[pkg] = d + end end if (env.project != env.original_project) && (!skip_writing_project) From d1545f93932e1a928e917b92f8341524ef040c42 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Fri, 1 Mar 2024 17:51:16 +0100 Subject: [PATCH 02/13] add a Changelog entry --- CHANGELOG.md | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f39463873..570e7b4193 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,13 +1,13 @@ -Pkg v1.12 Release Notes -======================= +# Pkg v1.12 Release Notes - Pkg now has support for "workspaces" which is a way to resolve multiple project files into a single manifest. The functions `Pkg.status`, `Pkg.why`, `Pkg.instantiate`, `Pkg.precompile` (and their REPL variants) have been updated to take a `workspace` option. Read more about this feature in the manual about the TOML-files. - `status` now shows when different versions/sources of dependencies are loaded than that which is expected by the manifest ([#4109]) +- It is now possible to specify "sources" for packages in a `[sources]` section in Project.toml. + This can be used to add non-registered normal or test dependencies. Packages are also automatically added to `[sources]` when they are added by url or devved. -Pkg v1.11 Release Notes -======================= +# Pkg v1.11 Release Notes - It is now possible to specify "sources" for packages in a `[sources]` section in Project.toml. This can be used to add non-registered normal or test dependencies. ([#3783]) @@ -18,11 +18,9 @@ Pkg v1.11 Release Notes - Dependencies can now be directly added as weak deps or extras via the `pkg> add --weak/extra Foo` or `Pkg.add("Foo", target=:weakdeps/:extras)` forms ([#3708]) -Pkg v1.10 Release Notes -======================= +# Pkg v1.10 Release Notes -Pkg v1.9 Release Notes -======================= +# Pkg v1.9 Release Notes - New functionality: `Pkg.why` and `pkg> why` to show why a package is inside the environment (shows all "paths" to a package starting at the direct dependencies). - When code coverage tracking is enabled for `Pkg.test` the new path-specific code-coverage option is used to limit coverage @@ -41,8 +39,7 @@ Pkg v1.9 Release Notes Also a new tiered resolve strategy `PRESERVE_TIERED_INSTALLED` that tries this first, which can be set to the default strategy by setting the env var `JULIA_PKG_PRESERVE_TIERED_INSTALLED` to `true` ([#3378]). -Pkg v1.8 Release Notes -====================== +# Pkg v1.8 Release Notes - Pkg will now respect the version of packages put into the sysimage using e.g. PackageCompiler. For example, if version 1.3.2 of package A is in the sysimage, Pkg will always install that version when adding the package, @@ -66,8 +63,7 @@ Pkg v1.8 Release Notes - The julia version stored in the manifest no longer includes the build number i.e. master will now record as `1.9.0-DEV` ([#2995]). - Interrupting a `pkg> test` will now be caught more reliably and exit back to the REPL gracefully ([#2933]). -Pkg v1.7 Release Notes -====================== +# Pkg v1.7 Release Notes - The format of the `Manifest.toml` file have changed. New manifests will use the new format while old manifest will have their existing format in place ([#2580]). @@ -84,6 +80,7 @@ Pkg v1.7 Release Notes - The `mode` keyword for `PackageSpec` has been removed ([#2454]). + [#2284]: https://github.com/JuliaLang/Pkg.jl/issues/2284 [#2431]: https://github.com/JuliaLang/Pkg.jl/issues/2431 [#2432]: https://github.com/JuliaLang/Pkg.jl/issues/2432 From 4c3697643ed155f9e10e61f4f1471f7f29f95f09 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Fri, 1 Mar 2024 18:26:16 +0100 Subject: [PATCH 03/13] remove other source if already set --- src/API.jl | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/API.jl b/src/API.jl index 834fbdcef5..f6df56654e 100644 --- a/src/API.jl +++ b/src/API.jl @@ -193,12 +193,16 @@ function update_source_if_set(project, pkg) # This should probably not modify the dicts directly... if pkg.repo.source !== nothing source["url"] = pkg.repo.source + delete!(source, "path") end if pkg.repo.rev !== nothing source["rev"] = pkg.repo.rev + delete!(source, "path") end if pkg.path !== nothing source["path"] = pkg.path + delete!(source, "url") + delete!(source, "rev") end if pkg.subdir !== nothing source["subdir"] = pkg.subdir From 0473b25d82f5505b2100f480bef23d97bee06358 Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 1 Aug 2024 00:34:38 +0200 Subject: [PATCH 04/13] delete sources when reverting to registered pkg version --- src/API.jl | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/API.jl b/src/API.jl index f6df56654e..7d30262253 100644 --- a/src/API.jl +++ b/src/API.jl @@ -191,18 +191,23 @@ function update_source_if_set(project, pkg) source = get(project.sources, pkg.name, nothing) source === nothing && return # This should probably not modify the dicts directly... - if pkg.repo.source !== nothing - source["url"] = pkg.repo.source - delete!(source, "path") - end - if pkg.repo.rev !== nothing - source["rev"] = pkg.repo.rev - delete!(source, "path") - end - if pkg.path !== nothing - source["path"] = pkg.path - delete!(source, "url") - delete!(source, "rev") + if pkg.repo == GitRepo() + delete!(project.sources, pkg.name) + else + # This should probably not modify the dicts directly... + if pkg.repo.source !== nothing + source["url"] = pkg.repo.source + delete!(source, "path") + end + if pkg.repo.rev !== nothing + source["rev"] = pkg.repo.rev + delete!(source, "path") + end + if pkg.path !== nothing + source["path"] = pkg.path + delete!(source, "url") + delete!(source, "rev") + end end if pkg.subdir !== nothing source["subdir"] = pkg.subdir From 24f431b8c662a265283b78b3af385039a7bfe1e5 Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 1 Aug 2024 00:35:21 +0200 Subject: [PATCH 05/13] update a test --- test/sources.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/sources.jl b/test/sources.jl index 35425aea21..aeb42313e0 100644 --- a/test/sources.jl +++ b/test/sources.jl @@ -21,7 +21,7 @@ temp_pkg_dir() do project_path cp("Project.toml.bak", "Project.toml"; force=true) cp("BadManifest.toml", "Manifest.toml"; force=true) Pkg.resolve() - @test Pkg.project().sources["Example"] == Dict("url" => "https://github.com/JuliaLang/Example.jl") + @test Pkg.project().sources["Example"] == Dict("rev" => "master", "url" => "https://github.com/JuliaLang/Example.jl") @test Pkg.project().sources["LocalPkg"] == Dict("path" => "LocalPkg") end end From c02ee4070175bb316fb56d3d6def2b281457609a Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 1 Aug 2024 21:43:20 +0200 Subject: [PATCH 06/13] also populate sources.subdir --- src/API.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/API.jl b/src/API.jl index 7d30262253..4edfeedcc8 100644 --- a/src/API.jl +++ b/src/API.jl @@ -203,6 +203,9 @@ function update_source_if_set(project, pkg) source["rev"] = pkg.repo.rev delete!(source, "path") end + if pkg.repo.subdir !== nothing + source["subdir"] = pkg.repo.subdir + end if pkg.path !== nothing source["path"] = pkg.path delete!(source, "url") From abeaaddec3a061cc6c23ccd15d71df9c5b9c25ce Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 1 Aug 2024 23:23:09 +0200 Subject: [PATCH 07/13] rm comment --- src/API.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/API.jl b/src/API.jl index 4edfeedcc8..9d4cf03c98 100644 --- a/src/API.jl +++ b/src/API.jl @@ -190,7 +190,6 @@ end function update_source_if_set(project, pkg) source = get(project.sources, pkg.name, nothing) source === nothing && return - # This should probably not modify the dicts directly... if pkg.repo == GitRepo() delete!(project.sources, pkg.name) else From 0e86b53003acbee7b16d2d9d9311edeeb60f942c Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Thu, 1 Aug 2024 23:23:53 +0200 Subject: [PATCH 08/13] add subdir to sources section --- src/Types.jl | 1 + src/project.jl | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Types.jl b/src/Types.jl index 2de3112287..96f951434f 100644 --- a/src/Types.jl +++ b/src/Types.jl @@ -1235,6 +1235,7 @@ function write_env(env::EnvCache; update_undo=true, elseif entry.repo != GitRepo() d = Dict("url" => entry.repo.source) entry.repo.rev !== nothing && (d["rev"] = entry.repo.rev) + entry.repo.subdir !== nothing && (d["subdir"] = entry.repo.subdir) env.project.sources[pkg] = d end end diff --git a/src/project.jl b/src/project.jl index 9006936697..bc88313138 100644 --- a/src/project.jl +++ b/src/project.jl @@ -107,8 +107,8 @@ read_project_compat(raw, project::Project) = read_project_sources(::Nothing, project::Project) = Dict{String,Dict{String,String}}() function read_project_sources(raw::Dict{String,Any}, project::Project) - valid_keys = ("path", "url", "rev", "subdir") - sources = Dict{String,Dict{String,String}}() + valid_keys = ("path", "url", "rev") + sources = Dict{String,String}() for (name, source) in raw if !(source isa AbstractDict) pkgerror("Expected `source` section to be a table") From a4c0bce0ae0dd007e2fa05df3ca6d86386b55cba Mon Sep 17 00:00:00 2001 From: Florian Atteneder Date: Sat, 3 Aug 2024 17:47:30 +0200 Subject: [PATCH 09/13] need to update sources in pin? --- src/API.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/API.jl b/src/API.jl index 9d4cf03c98..70a59334e3 100644 --- a/src/API.jl +++ b/src/API.jl @@ -438,6 +438,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec}; all_pkgs::Bool=false, kwar pkgerror("pinning a package requires a single version, not a versionrange") end end + update_source_if_set(ctx.env.project, pkg) end project_deps_resolve!(ctx.env, pkgs) From 43b5584ecacc7ee12904b53d058e51b324114982 Mon Sep 17 00:00:00 2001 From: lassepe Date: Wed, 30 Apr 2025 13:39:36 +0200 Subject: [PATCH 10/13] Fix dict type --- src/project.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.jl b/src/project.jl index bc88313138..35ba8b7995 100644 --- a/src/project.jl +++ b/src/project.jl @@ -108,7 +108,7 @@ read_project_compat(raw, project::Project) = read_project_sources(::Nothing, project::Project) = Dict{String,Dict{String,String}}() function read_project_sources(raw::Dict{String,Any}, project::Project) valid_keys = ("path", "url", "rev") - sources = Dict{String,String}() + sources = Dict{String,Dict{String,String}}() for (name, source) in raw if !(source isa AbstractDict) pkgerror("Expected `source` section to be a table") From 48dd673b5036366e4f4112f54f05fc315a58530c Mon Sep 17 00:00:00 2001 From: lassepe Date: Wed, 30 Apr 2025 13:50:55 +0200 Subject: [PATCH 11/13] Add subdir key --- src/project.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/project.jl b/src/project.jl index 35ba8b7995..9006936697 100644 --- a/src/project.jl +++ b/src/project.jl @@ -107,7 +107,7 @@ read_project_compat(raw, project::Project) = read_project_sources(::Nothing, project::Project) = Dict{String,Dict{String,String}}() function read_project_sources(raw::Dict{String,Any}, project::Project) - valid_keys = ("path", "url", "rev") + valid_keys = ("path", "url", "rev", "subdir") sources = Dict{String,Dict{String,String}}() for (name, source) in raw if !(source isa AbstractDict) From 366d3e92e26b92617fa17aed84a1df7dd68658fa Mon Sep 17 00:00:00 2001 From: lassepe Date: Wed, 30 Apr 2025 16:04:54 +0200 Subject: [PATCH 12/13] tests: Add missing 'isolate' --- test/new.jl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/new.jl b/test/new.jl index 4f68bca11d..8b4f4c3bc1 100644 --- a/test/new.jl +++ b/test/new.jl @@ -3248,16 +3248,18 @@ temp_pkg_dir() do project_path end end @testset "test resolve with tree hash" begin - mktempdir() do dir - path = copy_test_package(dir, "ResolveWithRev") - cd(path) do - with_current_env() do - @test !isfile("Manifest.toml") - @test !isdir(joinpath(DEPOT_PATH[1], "packages", "Example")) - Pkg.resolve() - @test isdir(joinpath(DEPOT_PATH[1], "packages", "Example")) - rm(joinpath(DEPOT_PATH[1], "packages", "Example"); recursive = true) - Pkg.resolve() + isolate() do + mktempdir() do dir + path = copy_test_package(dir, "ResolveWithRev") + cd(path) do + with_current_env() do + @test !isfile("Manifest.toml") + @test !isdir(joinpath(DEPOT_PATH[1], "packages", "Example")) + Pkg.resolve() + @test isdir(joinpath(DEPOT_PATH[1], "packages", "Example")) + rm(joinpath(DEPOT_PATH[1], "packages", "Example"); recursive=true) + Pkg.resolve() + end end end end From 58897800e76f491097f377d54add959b99893c76 Mon Sep 17 00:00:00 2001 From: lassepe Date: Wed, 30 Apr 2025 16:37:02 +0200 Subject: [PATCH 13/13] Revert accidental formatting of CHANGELOG.md --- CHANGELOG.md | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 570e7b4193..1aaac21ee3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ -# Pkg v1.12 Release Notes +Pkg v1.12 Release Notes +======================= - Pkg now has support for "workspaces" which is a way to resolve multiple project files into a single manifest. The functions `Pkg.status`, `Pkg.why`, `Pkg.instantiate`, `Pkg.precompile` (and their REPL variants) have been updated @@ -7,7 +8,8 @@ - It is now possible to specify "sources" for packages in a `[sources]` section in Project.toml. This can be used to add non-registered normal or test dependencies. Packages are also automatically added to `[sources]` when they are added by url or devved. -# Pkg v1.11 Release Notes +Pkg v1.11 Release Notes +======================= - It is now possible to specify "sources" for packages in a `[sources]` section in Project.toml. This can be used to add non-registered normal or test dependencies. ([#3783]) @@ -18,9 +20,11 @@ - Dependencies can now be directly added as weak deps or extras via the `pkg> add --weak/extra Foo` or `Pkg.add("Foo", target=:weakdeps/:extras)` forms ([#3708]) -# Pkg v1.10 Release Notes +Pkg v1.10 Release Notes +======================= -# Pkg v1.9 Release Notes +Pkg v1.9 Release Notes +====================== - New functionality: `Pkg.why` and `pkg> why` to show why a package is inside the environment (shows all "paths" to a package starting at the direct dependencies). - When code coverage tracking is enabled for `Pkg.test` the new path-specific code-coverage option is used to limit coverage @@ -39,7 +43,8 @@ Also a new tiered resolve strategy `PRESERVE_TIERED_INSTALLED` that tries this first, which can be set to the default strategy by setting the env var `JULIA_PKG_PRESERVE_TIERED_INSTALLED` to `true` ([#3378]). -# Pkg v1.8 Release Notes +Pkg v1.8 Release Notes +====================== - Pkg will now respect the version of packages put into the sysimage using e.g. PackageCompiler. For example, if version 1.3.2 of package A is in the sysimage, Pkg will always install that version when adding the package, @@ -63,7 +68,8 @@ - The julia version stored in the manifest no longer includes the build number i.e. master will now record as `1.9.0-DEV` ([#2995]). - Interrupting a `pkg> test` will now be caught more reliably and exit back to the REPL gracefully ([#2933]). -# Pkg v1.7 Release Notes +Pkg v1.7 Release Notes +====================== - The format of the `Manifest.toml` file have changed. New manifests will use the new format while old manifest will have their existing format in place ([#2580]). @@ -80,7 +86,6 @@ - The `mode` keyword for `PackageSpec` has been removed ([#2454]). - [#2284]: https://github.com/JuliaLang/Pkg.jl/issues/2284 [#2431]: https://github.com/JuliaLang/Pkg.jl/issues/2431 [#2432]: https://github.com/JuliaLang/Pkg.jl/issues/2432