Skip to content
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

Make Pkg more resilient to reading older manifests where ex-stdlibs are listed #3634

Merged
merged 3 commits into from
Oct 3, 2023

Conversation

KristofferC
Copy link
Member

This should prevent errors like:

ERROR: Could not locate the source code for the DelimitedFiles package. Are you trying to use a manifest generated by a different version of Julia?

When using older manifests that list DelimitedFiles in the stdlib format even though DelimitedFiles now is upgradable and has e.g. a git-tree-sha1 entry when generated with current Pkg

…re listed

This should prevent errors like:

```
ERROR: Could not locate the source code for the DelimitedFiles package. Are you trying to use a manifest generated by a different version of Julia?
```

When using older manifests that list DelimitedFiles in the stdlib format even though DelimitedFiles now is upgradable and has e.g. a `git-tree-sha1` entry when generated with current Pkg
@topolarity
Copy link
Member

This is great! Having Manifest forward-compatibility is always a lovely thing.

Thanks for diving into this @KristofferC

@IanButterworth
Copy link
Member

even though DelimitedFiles now is upgradable

Does that mean that is_stdlib returns false for DelimitedFiles now?

@KristofferC
Copy link
Member Author

Yes it currently does.

@IanButterworth
Copy link
Member

Ok, would it then make sense to break that check into is_stdlib (true) and is_upgradable_stdlib (true)?
It's not like DelimitedFiles isn't a stdlib anymore?

@KristofferC
Copy link
Member Author

It's not like DelimitedFiles isn't a stdlib anymore?

From the package manager's p.o.v it isn't really though. In all ways the package manager interacts with DelimitedFiles, it acts like a normal package (with the exception of when old manifests are used).

@IanButterworth
Copy link
Member

IanButterworth commented Sep 28, 2023

Maybe we should just have is_upgradable then? Or is_fixed which wouldn't require inverting the logic

@KristofferC
Copy link
Member Author

Yes, I am changing this to something along those lines.

src/Types.jl Outdated
Comment on lines 463 to 467
is_stdlib(uuid::UUID) = uuid in keys(stdlibs()) && uuid ∉ UPGRADABLE_STDLIBS_UUIDS
# Includes upgradable stdlibs
function is_any_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
return is_stdlib(uuid, julia_version) || uuid in UPGRADABLE_STDLIBS_UUIDS
end
Copy link
Member

@IanButterworth IanButterworth Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_any_stdlib doesn't make sense to me.

I can't shake that it should be this, for correctness

Suggested change
is_stdlib(uuid::UUID) = uuid in keys(stdlibs()) && uuid UPGRADABLE_STDLIBS_UUIDS
# Includes upgradable stdlibs
function is_any_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
return is_stdlib(uuid, julia_version) || uuid in UPGRADABLE_STDLIBS_UUIDS
end
is_stdlib(uuid::UUID) = uuid in keys(stdlibs())
# Includes upgradable stdlibs
function is_upgradable_stdlib(uuid::UUID, julia_version::Union{VersionNumber, Nothing})
return uuid in UPGRADABLE_STDLIBS_UUIDS
end

And Pkg tests should check that UPGRADABLE_STDLIBS_UUIDS are all stdlibs probably

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed and tweaked some things slightly. I don't really think that test is needed since it is true "by construction" and the test would be written virtually identically to the implementation.

Copy link
Member

@IanButterworth IanButterworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reservations about what is_stdlib should say are about internals so don't need to be figured out here

@KristofferC KristofferC merged commit ddcc7b2 into master Oct 3, 2023
@KristofferC KristofferC deleted the kc/stdlib_path branch October 3, 2023 14:35
IanButterworth pushed a commit that referenced this pull request Oct 10, 2023
…re listed (#3634)

* Make Pkg more resilient to reading older manifests where ex-stdlibs are listed

This should prevent errors like:

```
ERROR: Could not locate the source code for the DelimitedFiles package. Are you trying to use a manifest generated by a different version of Julia?
```

When using older manifests that list DelimitedFiles in the stdlib format even though DelimitedFiles now is upgradable and has e.g. a `git-tree-sha1` entry when generated with current Pkg

(cherry picked from commit ddcc7b2)
IanButterworth added a commit that referenced this pull request Oct 10, 2023
IanButterworth pushed a commit that referenced this pull request Oct 10, 2023
…re listed (#3634)

* Make Pkg more resilient to reading older manifests where ex-stdlibs are listed

This should prevent errors like:

```
ERROR: Could not locate the source code for the DelimitedFiles package. Are you trying to use a manifest generated by a different version of Julia?
```

When using older manifests that list DelimitedFiles in the stdlib format even though DelimitedFiles now is upgradable and has e.g. a `git-tree-sha1` entry when generated with current Pkg

(cherry picked from commit ddcc7b2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants