Skip to content

Commit 7c1544f

Browse files
authored
Merge pull request #3090 from JuliaLang/backports-release-1.8
Backports release 1.8
2 parents e31a3dc + c24c6e8 commit 7c1544f

File tree

15 files changed

+188
-58
lines changed

15 files changed

+188
-58
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/tmp
2+
/test/tmp
23
*.jl.mem
34
*.jl.cov
45
*.jl.*.cov

CHANGELOG.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,53 @@ Pkg v1.8 Release Notes
22
======================
33

44
- New `` and `` indicators beside packages in `pkg> status` that have new versions available.
5-
`` indicates when new versions cannot be installed.
5+
`` indicates when new versions cannot be installed ([#2906]).
66
- New `outdated::Bool` kwarg to `Pkg.status` (`--outdated` or `-o` in the REPL mode) to show
7-
information about packages not at the latest version.
7+
information about packages not at the latest version ([#2284]).
88
- New `compat::Bool` kwarg to `Pkg.status` (`--compat` or `-c` in the REPL mode) to show any [compat]
9-
entries in the Project.toml.
9+
entries in the Project.toml ([#2702]).
1010
- New `pkg> compat` (and `Pkg.compat`) mode for setting Project compat entries. Provides an interactive editor
1111
via `pkg> compat`, or direct entry manipulation via `pkg> Foo 0.4,0.5` which can load current entries via tab-completion.
12-
i.e. `pkg> compat Fo<TAB>` autocompletes to `pkg> Foo 0.4,0.5` so that the existing entry can be edited.
13-
- Pkg now only tries to download packages from the package server in case the
14-
server tracks a registry that contains the package.
12+
i.e. `pkg> compat Fo<TAB>` autocompletes to `pkg> Foo 0.4,0.5` so that the existing entry can be edited ([#2702]).
13+
- Pkg now only tries to download packages from the package server in case the server tracks a registry that contains
14+
the package ([#2689]).
1515
- `Pkg.instantiate` will now warn when a Project.toml is out of sync with a Manifest.toml. It does this by storing a hash
1616
of the project deps and compat entries (other fields are ignored) in the manifest when it is resolved, so that any change
17-
to the Project.toml deps or compat entries without a re-resolve can be detected.
17+
to the Project.toml deps or compat entries without a re-resolve can be detected ([#2815]).
18+
- If `pkg> add` cannot find a package with the provided name it will now suggest similarly named packages that can be added ([#2985]).
19+
- 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]).
20+
- Interrupting a `pkg> test` will now be caught more reliably and exit back to the REPL gracefully ([#2933]).
1821

1922
Pkg v1.7 Release Notes
2023
======================
2124

2225
- The format of the `Manifest.toml` file have changed. New manifests will use
23-
the new format while old manifest will have their existing format in place.
24-
Julia 1.6.2 is compatible with the new format.
26+
the new format while old manifest will have their existing format in place ([#2580]).
27+
Julia 1.6.2 is compatible with the new format ([#2561]).
2528
- Registries downloaded from the Pkg Server (not git) are no longer uncompressed into files but instead read directly from the compressed tarball into memory. This improves performance on
26-
filesystems which do not handle a large number of files well. To turn this feature off, set the environment variable `JULIA_PKG_UNPACK_REGISTRY=true`.
29+
filesystems which do not handle a large number of files well. To turn this feature off, set the environment variable `JULIA_PKG_UNPACK_REGISTRY=true` ([#2431]).
2730
- It is now possible to use an external `git` executable instead of the default libgit2 library for
28-
the downloads that happen via the Git protocol by setting the environment variable `JULIA_PKG_USE_CLI_GIT=true`.
31+
the downloads that happen via the Git protocol by setting the environment variable `JULIA_PKG_USE_CLI_GIT=true` ([#2448]).
2932
- Registries downloaded from the Pkg Server (not git) is now assumed to be immutable. Manual changes to their files might not be picked up by a running Pkg session.
3033
- The number of packags precompiled in parallel are now limited to 16 unless the
31-
environment variable `JULIA_NUM_PRECOMPILE_TASKS` is set.
32-
- Adding packages by folder name in the REPL mode now requires a prepending a `./` to the folder name package folder is in the current folder, e.g. `add ./Package` is required instead of `add Pacakge`. This is to avoid confusion between the package name `Package` and the local directory `Package`.
33-
- `rm`, `pin`, and `free` now support the `--all` option, and the api variants gain the `all_pkgs::Bool` kwarg, to perform the operation on all packages within the project or manifest, depending on the mode of the operation.
34-
- The `mode` keyword for `PackageSpec` has been removed.
34+
environment variable `JULIA_NUM_PRECOMPILE_TASKS` is set ([#2552]).
35+
- Adding packages by folder name in the REPL mode now requires a prepending a `./` to the folder name package folder is in the current folder, e.g. `add ./Package` is required instead of `add Package`. This is to avoid confusion between the package name `Package` and the local directory `Package`.
36+
- `rm`, `pin`, and `free` now support the `--all` option, and the api variants gain the `all_pkgs::Bool` kwarg, to perform the operation on all packages within the project or manifest, depending on the mode of the operation ([#2432]).
37+
- The `mode` keyword for `PackageSpec` has been removed ([#2454]).
38+
39+
<!--- Generated by NEWS-update.jl --->
40+
[#2284]: https://github.com/JuliaLang/Pkg.jl/issues/2284
41+
[#2431]: https://github.com/JuliaLang/Pkg.jl/issues/2431
42+
[#2432]: https://github.com/JuliaLang/Pkg.jl/issues/2432
43+
[#2448]: https://github.com/JuliaLang/Pkg.jl/issues/2448
44+
[#2454]: https://github.com/JuliaLang/Pkg.jl/issues/2454
45+
[#2552]: https://github.com/JuliaLang/Pkg.jl/issues/2552
46+
[#2561]: https://github.com/JuliaLang/Pkg.jl/issues/2561
47+
[#2580]: https://github.com/JuliaLang/Pkg.jl/issues/2580
48+
[#2689]: https://github.com/JuliaLang/Pkg.jl/issues/2689
49+
[#2702]: https://github.com/JuliaLang/Pkg.jl/issues/2702
50+
[#2815]: https://github.com/JuliaLang/Pkg.jl/issues/2815
51+
[#2906]: https://github.com/JuliaLang/Pkg.jl/issues/2906
52+
[#2933]: https://github.com/JuliaLang/Pkg.jl/issues/2933
53+
[#2985]: https://github.com/JuliaLang/Pkg.jl/issues/2985
54+
[#2995]: https://github.com/JuliaLang/Pkg.jl/issues/2995

docs/NEWS-update.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Script to automatically insert Markdown footnotes for all [#xxxx] issue
2+
# cross-references in the CHANGELOG file.
3+
4+
NEWS = get(ARGS, 1, "CHANGELOG.md")
5+
6+
s = read(NEWS, String)
7+
8+
m = match(r"\[#[0-9]+\]:", s)
9+
if m !== nothing
10+
s = s[1:m.offset-1]
11+
end
12+
13+
footnote(n) = "[#$n]: https://github.com/JuliaLang/Pkg.jl/issues/$n"
14+
N = map(m -> parse(Int,m.captures[1]), eachmatch(r"\[#([0-9]+)\]", s))
15+
foots = join(map(footnote, sort!(unique(N))), "\n")
16+
17+
open(NEWS, "w") do f
18+
println(f, s, "<!--- Generated by NEWS-update.jl --->\n", foots)
19+
end

docs/src/creating-packages.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,5 +309,5 @@ To support the various usecases in the Julia package ecosystem, the Pkg develope
309309
* [`Preferences.jl`](https://github.com/JuliaPackaging/Preferences.jl) allows packages to read and write preferences to the top-level `Project.toml`.
310310
These preferences can be read at runtime or compile-time, to enable or disable different aspects of package behavior.
311311
Packages previously would write out files to their own package directories to record options set by the user or environment, but this is highly discouraged now that `Preferences` is available.
312-
Preferences are available from Juilia 1.6 onward.
312+
Preferences are available from Julia 1.6 onward.
313313

src/API.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1813,7 +1813,7 @@ function compat(ctx::Context, pkg::String, compat_str::Union{Nothing,String}; io
18131813
resolve(ctx)
18141814
catch e
18151815
if e isa ResolverError
1816-
printpkgstyle(io, :Error, e.msg, color = Base.warn_color())
1816+
printpkgstyle(io, :Error, string(e.msg), color = Base.warn_color())
18171817
else
18181818
rethrow()
18191819
end

src/Operations.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ function is_instantiated(env::EnvCache; platform = HostPlatform())::Bool
116116
if idx === nothing
117117
push!(pkgs, Types.PackageSpec(name=env.pkg.name, uuid=env.pkg.uuid, version=env.pkg.version, path=dirname(env.project_file)))
118118
end
119+
else
120+
# Make sure artifacts for project exist even if it is not a package
121+
check_artifacts_downloaded(dirname(env.project_file); platform) || return false
119122
end
120123
# Make sure all paths/artifacts exist
121124
return all(pkg -> is_package_downloaded(env.project_file, pkg; platform), pkgs)
@@ -287,22 +290,24 @@ function collect_fixed!(env::EnvCache, pkgs::Vector{PackageSpec}, names::Dict{UU
287290
return fixed
288291
end
289292

293+
# drops build detail in version but keeps the main prerelease context
294+
# i.e. dropbuild(v"2.0.1-rc1.21321") == v"2.0.1-rc1"
295+
dropbuild(v::VersionNumber) = VersionNumber(v.major, v.minor, v.patch, isempty(v.prerelease) ? () : (v.prerelease[1],))
290296

291297
# Resolve a set of versions given package version specs
292298
# looks at uuid, version, repo/path,
293299
# sets version to a VersionNumber
294300
# adds any other packages which may be in the dependency graph
295-
# all versioned packges should have a `tree_hash`
301+
# all versioned packages should have a `tree_hash`
296302
function resolve_versions!(env::EnvCache, registries::Vector{Registry.RegistryInstance}, pkgs::Vector{PackageSpec}, julia_version)
297303
# compatibility
298304
if julia_version !== nothing
299-
env.manifest.julia_version = julia_version
305+
# only set the manifest julia_version if ctx.julia_version is not nothing
306+
env.manifest.julia_version = dropbuild(VERSION)
300307
v = intersect(julia_version, get_compat(env.project, "julia"))
301308
if isempty(v)
302309
@warn "julia version requirement for project not satisfied" _module=nothing _file=nothing
303310
end
304-
else
305-
env.manifest.julia_version = VERSION
306311
end
307312
names = Dict{UUID, String}(uuid => name for (uuid, (name, version)) in stdlibs())
308313
# recursive search for packages which are tracking a path
@@ -632,8 +637,7 @@ function download_artifacts(env::EnvCache;
632637
pkg_root = source_path(env.project_file, pkg, julia_version)
633638
pkg_root === nothing || push!(pkg_roots, pkg_root)
634639
end
635-
envpkg = env.pkg
636-
envpkg === nothing || push!(pkg_roots, envpkg.path)
640+
push!(pkg_roots, dirname(env.project_file))
637641
for pkg_root in pkg_roots
638642
for (artifacts_toml, artifacts) in collect_artifacts(pkg_root; platform)
639643
# For each Artifacts.toml, install each artifact we've collected from it
@@ -976,12 +980,12 @@ function build_versions(ctx::Context, uuids::Set{UUID}; verbose=false)
976980
local build_project_override, build_project_preferences
977981
if isfile(projectfile_path(builddir(source_path)))
978982
build_project_override = nothing
979-
with_load_path([builddir(source_path)]) do
983+
with_load_path([builddir(source_path), Base.LOAD_PATH...]) do
980984
build_project_preferences = Base.get_preferences()
981985
end
982986
else
983987
build_project_override = gen_target_project(ctx, pkg, source_path, "build")
984-
with_load_path([projectfile_path(source_path)]) do
988+
with_load_path([projectfile_path(source_path), Base.LOAD_PATH...]) do
985989
build_project_preferences = Base.get_preferences()
986990
end
987991
end
@@ -1708,12 +1712,12 @@ function test(ctx::Context, pkgs::Vector{PackageSpec};
17081712
local test_project_preferences, test_project_override
17091713
if isfile(projectfile_path(testdir(source_path)))
17101714
test_project_override = nothing
1711-
with_load_path(testdir(source_path)) do
1715+
with_load_path([testdir(source_path), Base.LOAD_PATH...]) do
17121716
test_project_preferences = Base.get_preferences()
17131717
end
17141718
else
17151719
test_project_override = gen_target_project(ctx, pkg, source_path, "test")
1716-
with_load_path(projectfile_path(source_path)) do
1720+
with_load_path([projectfile_path(source_path), Base.LOAD_PATH...]) do
17171721
test_project_preferences = Base.get_preferences()
17181722
end
17191723
end
@@ -1727,7 +1731,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec};
17271731
printpkgstyle(ctx.io, :Testing, "Running tests...")
17281732
flush(ctx.io)
17291733
cmd = gen_test_code(testfile(source_path); coverage=coverage, julia_args=julia_args, test_args=test_args)
1730-
p = run(pipeline(ignorestatus(cmd), stdin = stdin, stdout = sandbox_ctx.io, stderr = stderr_f()), wait = false)
1734+
p = run(pipeline(ignorestatus(cmd), stdout = sandbox_ctx.io, stderr = stderr_f()), wait = false)
17311735
interrupted = false
17321736
try
17331737
wait(p)

src/REPLMode/REPLMode.jl

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -717,13 +717,21 @@ function try_prompt_pkg_add(pkgs::Vector{Symbol})
717717
API.add(string.(available_pkgs))
718718
elseif lower_resp in ["o"]
719719
editable_envs = filter(v -> v != "@stdlib", LOAD_PATH)
720-
expanded_envs = Base.load_path_expand.(editable_envs)
721-
envs = convert(Vector{String}, filter(x -> !isnothing(x), expanded_envs))
722720
option_list = String[]
723721
keybindings = Char[]
724-
for i in 1:length(envs)
725-
push!(option_list, "$(i): $(pathrepr(envs[i])) ($(editable_envs[i]))")
726-
push!(keybindings, only("$i"))
722+
shown_envs = String[]
723+
# We use digits 1-9 as keybindings in the env selection menu
724+
# That's why we can display at most 9 items in the menu
725+
for i in 1:min(length(editable_envs), 9)
726+
env = editable_envs[i]
727+
expanded_env = Base.load_path_expand(env)
728+
729+
isnothing(expanded_env) && continue
730+
731+
n = length(option_list) + 1
732+
push!(option_list, "$(n): $(pathrepr(expanded_env)) ($(env))")
733+
push!(keybindings, only("$n"))
734+
push!(shown_envs, expanded_env)
727735
end
728736
menu = TerminalMenus.RadioMenu(option_list, keybindings=keybindings, pagesize=length(option_list))
729737
print(ctx.io, "\e[1A\e[1G\e[0J") # go up one line, to the start, and clear it
@@ -738,7 +746,7 @@ function try_prompt_pkg_add(pkgs::Vector{Symbol})
738746
rethrow()
739747
end
740748
choice == -1 && return false
741-
API.activate(envs[choice]) do
749+
API.activate(shown_envs[choice]) do
742750
API.add(string.(available_pkgs))
743751
end
744752
elseif (lower_resp in ["n"])

src/utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ set_readonly(::Nothing) = nothing
5858

5959
# try to call realpath on as much as possible
6060
function safe_realpath(path)
61+
isempty(path) && return path
6162
if ispath(path)
6263
try
6364
return realpath(path)

test/artifacts.jl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ end
488488
"AugmentedPlatform",
489489
"flooblecrank" => "disengaged",
490490
)
491-
491+
492492
p = HostPlatform()
493493
p["flooblecrank"] = "engaged"
494494
add_this_pkg(; platform=p)
@@ -770,4 +770,16 @@ end
770770
end
771771
end
772772

773+
@testset "artifacts for non package project" begin
774+
temp_pkg_dir() do tmpdir
775+
artifacts_toml = joinpath(tmpdir, "Artifacts.toml")
776+
cp(joinpath(@__DIR__, "test_packages", "ArtifactInstallation", "Artifacts.toml"), artifacts_toml)
777+
Pkg.activate(tmpdir)
778+
cts_hash = artifact_hash("collapse_the_symlink", artifacts_toml)
779+
@test !artifact_exists(cts_hash)
780+
Pkg.instantiate()
781+
@test artifact_exists(cts_hash)
782+
end
783+
end
784+
773785
end # module

test/manifest/formats/v2.0/Manifest.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This file is machine-generated - editing it directly is not advised
22

3-
julia_version = "1.7.0-DEV.1199"
3+
julia_version = "1.7.0-DEV"
44
manifest_format = "2.0"
55
some_other_field = "other"
66
some_other_data = [1,2,3,4]

0 commit comments

Comments
 (0)