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

release-1.9: compute paths relative manifest more consistently (#3513) #3529

Merged
merged 1 commit into from
Jun 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ end
tracking_registered_version(pkg::Union{PackageSpec, PackageEntry}, julia_version=VERSION) =
!is_stdlib(pkg.uuid, julia_version) && pkg.path === nothing && pkg.repo.source === nothing

function source_path(project_file::String, pkg::Union{PackageSpec, PackageEntry}, julia_version = VERSION)
function source_path(manifest_file::String, pkg::Union{PackageSpec, PackageEntry}, julia_version = VERSION)
return is_stdlib(pkg.uuid, julia_version) ? Types.stdlib_path(pkg.name) :
pkg.path !== nothing ? joinpath(dirname(project_file), pkg.path) :
pkg.path !== nothing ? joinpath(dirname(manifest_file), pkg.path) :
pkg.repo.source !== nothing ? find_installed(pkg.name, pkg.uuid, pkg.tree_hash) :
pkg.tree_hash !== nothing ? find_installed(pkg.name, pkg.uuid, pkg.tree_hash) :
nothing
Expand Down Expand Up @@ -130,7 +130,7 @@ function is_instantiated(env::EnvCache; platform = HostPlatform())::Bool
check_artifacts_downloaded(dirname(env.project_file); platform) || return false
end
# Make sure all paths/artifacts exist
return all(pkg -> is_package_downloaded(env.project_file, pkg; platform), pkgs)
return all(pkg -> is_package_downloaded(env.manifest_file, pkg; platform), pkgs)
end

function update_manifest!(env::EnvCache, pkgs::Vector{PackageSpec}, deps_map, julia_version)
Expand Down Expand Up @@ -168,7 +168,7 @@ end
# about extensions
function fixup_ext!(env, pkgs)
for pkg in pkgs
v = joinpath(source_path(env.project_file, pkg), "Project.toml")
v = joinpath(source_path(env.manifest_file, pkg), "Project.toml")
if haskey(env.manifest, pkg.uuid)
entry = env.manifest[pkg.uuid]
if isfile(v)
Expand Down Expand Up @@ -538,7 +538,7 @@ function deps_graph(env::EnvCache, registries::Vector{Registry.RegistryInstance}
Registry.isyanked(info, v) && continue
if installed_only
pkg_spec = PackageSpec(name=pkg.name, uuid=pkg.uuid, version=v, tree_hash=Registry.treehash(info, v))
is_package_downloaded(env.project_file, pkg_spec) || continue
is_package_downloaded(env.manifest_file, pkg_spec) || continue
end

# Skip package version that are not the same as external packages in sysimage
Expand Down Expand Up @@ -2189,8 +2189,8 @@ function diff_array(old_env::Union{EnvCache,Nothing}, new_env::EnvCache; manifes
return Tuple{T,S,S}[(uuid, index_pkgs(old, uuid), index_pkgs(new, uuid))::Tuple{T,S,S} for uuid in all_uuids]
end

function is_package_downloaded(project_file::String, pkg::PackageSpec; platform=HostPlatform())
sourcepath = source_path(project_file, pkg)
function is_package_downloaded(manifest_file::String, pkg::PackageSpec; platform=HostPlatform())
sourcepath = source_path(manifest_file, pkg)
identifier = pkg.name !== nothing ? pkg.name : pkg.uuid
(sourcepath === nothing) && pkgerror("Could not locate the source code for the $(identifier) package. Are you trying to use a manifest generated by a different version of Julia?")
isdir(sourcepath) || return false
Expand Down Expand Up @@ -2307,7 +2307,7 @@ function print_status(env::EnvCache, old_env::Union{Nothing,EnvCache}, registrie

# TODO: Show extension deps for project as well?

pkg_downloaded = !is_instantiated(new) || is_package_downloaded(env.project_file, new)
pkg_downloaded = !is_instantiated(new) || is_package_downloaded(env.manifest_file, new)

new_ver_avail = !latest_version && !Operations.is_tracking_repo(new) && !Operations.is_tracking_path(new)
pkg_upgradable = new_ver_avail && isempty(cinfo[1])
Expand Down