-
-
Notifications
You must be signed in to change notification settings - Fork 283
allow for a metadata table in a Package.toml in a registry and have a deprecated sub-table indicate the package is deprecated
#4433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a0c774c
allow for a `deprecated` table in a `Package.toml` in a registry
KristofferC e3ec238
store deprecated table under a tags table
KristofferC 52943f8
docs
KristofferC 595ffee
tags -> metadata
KristofferC d7327f2
show more deprecated info in status
KristofferC File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,6 +5,8 @@ using Pkg, UUIDs, LibGit2, Test | |
| using Pkg: depots1 | ||
| using Pkg.REPLMode: pkgstr | ||
| using Pkg.Types: PkgError, manifest_info, PackageSpec, EnvCache | ||
| using Pkg.Operations: get_pkg_deprecation_info | ||
|
|
||
| using Dates: Second | ||
|
|
||
| using ..Utils | ||
|
|
@@ -41,8 +43,6 @@ function setup_test_registries(dir = pwd()) | |
| ) | ||
| write( | ||
| joinpath(regpath, "Example", "Deps.toml"), """ | ||
| ["0.5"] | ||
| julia = "0.6-1.0" | ||
| """ | ||
| ) | ||
| write( | ||
|
|
@@ -343,6 +343,89 @@ end | |
| end | ||
| end | ||
|
|
||
| @testset "deprecated package" begin | ||
| temp_pkg_dir() do depot | ||
| # Set up test registries with an extra deprecated package | ||
| regdir = mktempdir() | ||
| setup_test_registries(regdir) | ||
|
|
||
| # Add a deprecated package to the first registry | ||
| regpath = joinpath(regdir, "RegistryFoo1") | ||
| mkpath(joinpath(regpath, "DeprecatedExample")) | ||
|
|
||
| # Add the deprecated package to Registry.toml | ||
| registry_toml = read(joinpath(regpath, "Registry.toml"), String) | ||
| registry_toml = replace( | ||
| registry_toml, | ||
| "[packages]" => | ||
| "[packages]\n11111111-1111-1111-1111-111111111111 = { name = \"DeprecatedExample\", path = \"DeprecatedExample\" }" | ||
| ) | ||
| write(joinpath(regpath, "Registry.toml"), registry_toml) | ||
|
|
||
| # Create deprecated package with [metadata.deprecated] table | ||
| write( | ||
| joinpath(regpath, "DeprecatedExample", "Package.toml"), """ | ||
| name = "DeprecatedExample" | ||
| uuid = "11111111-1111-1111-1111-111111111111" | ||
| repo = "https://github.com/test/DeprecatedExample.jl.git" | ||
|
|
||
| [metadata.deprecated] | ||
| reason = "This package is no longer maintained" | ||
| alternative = "Example" | ||
| """ | ||
| ) | ||
|
|
||
| write( | ||
| joinpath(regpath, "DeprecatedExample", "Versions.toml"), """ | ||
| ["1.0.0"] | ||
| git-tree-sha1 = "1234567890abcdef1234567890abcdef12345678" | ||
| """ | ||
| ) | ||
|
|
||
| git_init_and_commit(regpath) | ||
|
|
||
| # Add the test registry | ||
| Pkg.Registry.add(url = regpath) | ||
|
|
||
| # Test that the package is marked as deprecated | ||
| registries = Pkg.Registry.reachable_registries() | ||
| reg_idx = findfirst(r -> r.name == "RegistryFoo", registries) | ||
| @test reg_idx !== nothing | ||
|
|
||
| reg = registries[reg_idx] | ||
| pkg_uuid = UUID("11111111-1111-1111-1111-111111111111") | ||
| @test haskey(reg, pkg_uuid) | ||
|
|
||
| pkg_entry = reg[pkg_uuid] | ||
| pkg_info = Pkg.Registry.registry_info(pkg_entry) | ||
|
|
||
| # Test that deprecated info is loaded correctly | ||
| @test Pkg.Registry.isdeprecated(pkg_info) | ||
| @test pkg_info.deprecated !== nothing | ||
| @test pkg_info.deprecated["reason"] == "This package is no longer maintained" | ||
| @test pkg_info.deprecated["alternative"] == "Example" | ||
|
|
||
| # Test that non-deprecated package is not marked as deprecated | ||
| example1_uuid = UUID("c5f1542f-b8aa-45da-ab42-05303d706c66") | ||
| example1_entry = reg[example1_uuid] | ||
| example1_info = Pkg.Registry.registry_info(example1_entry) | ||
| @test !Pkg.Registry.isdeprecated(example1_info) | ||
| @test example1_info.deprecated === nothing | ||
|
|
||
| # Test get_pkg_deprecation_info function | ||
| deprecated_pkg_spec = Pkg.Types.PackageSpec(name = "DeprecatedExample", uuid = pkg_uuid) | ||
| normal_pkg_spec = Pkg.Types.PackageSpec(name = "Example1", uuid = example1_uuid) | ||
|
|
||
| dep_info = get_pkg_deprecation_info(deprecated_pkg_spec, registries) | ||
| @test dep_info !== nothing | ||
| @test dep_info["reason"] == "This package is no longer maintained" | ||
| @test dep_info["alternative"] == "Example" | ||
|
|
||
| normal_info = get_pkg_deprecation_info(normal_pkg_spec, registries) | ||
| @test normal_info === nothing | ||
| end | ||
| end | ||
|
|
||
| @testset "yanking" begin | ||
| uuid = Base.UUID("7876af07-990d-54b4-ab0e-23690620f79a") # Example | ||
| # Tests that [email protected] does not get installed | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand this change?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's just a completely bogus entry, the
Deps.tomlfile don't have compat info like that. It has name -> uuid entries, e.g.:https://github.com/JuliaRegistries/General/blob/master/A/AAindex/Deps.toml
I guess nothing read that file before.