Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.
Open
Show file tree
Hide file tree
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
21 changes: 10 additions & 11 deletions src/MetadataTools.jl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Represents a version of a package in METADATA.jl
immutable PkgMetaVersion
ver::VersionNumber
sha::Compat.UTF8String
requires::Vector{Compat.UTF8String}
requires::Vector{Base.Pkg.Reqs.Requirement}
end
function printer(io::IO, pmv::PkgMetaVersion)
print(io, " ", pmv.ver, ",", pmv.sha[1:6])
Expand Down Expand Up @@ -93,14 +93,10 @@ function get_pkg(pkg_name::AbstractString;
ver_path = joinpath(vers_path, dir)
sha = strip(readstring(joinpath(ver_path,"sha1")))
req_path = joinpath(ver_path,"requires")
reqs = Compat.UTF8String[]
reqs = Base.Pkg.Reqs.Requirement[]
if isfile(req_path)
req_file = map(strip,split(readstring(req_path),"\n"))
for req in req_file
length(req) == 0 && continue
req[1] == '#' && continue
push!(reqs, req)
end
append!(reqs, filter(i->isa(i,Base.Pkg.Reqs.Requirement), Base.Pkg.Reqs.read(req_file)))
end
push!(vers,PkgMetaVersion(ver_num,sha,reqs))
end
Expand Down Expand Up @@ -146,10 +142,13 @@ function get_upper_limit(pkg::PkgMeta)
julia_max_ver = v"0.0.0"
# Check if there is a Julia max version dependency
for req in ver.requires
!contains(req,"julia") && continue
s = split(req," ")
length(s) != 3 && continue
julia_max_ver = convert(VersionNumber,s[3])
req.package!="julia" && continue
any(i->i.upper!=typemax(VersionNumber), req.versions.intervals) || continue
# TODO Handle multiple entries in req.versions.intervals properly
if length(req.versions.intervals[1]) > 1
error("This package cannot handle package requirements with multiple version intervals.")
end
julia_max_ver = req.versions.intervals[1].upper
break
end
# If there wasn't, then at least one version will work on
Expand Down
10 changes: 4 additions & 6 deletions src/pkg_graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,21 @@ function make_dep_graph(pkgs::Dict{Compat.UTF8String,PkgMeta}; reverse=false)
# We use the most recent version
# TODO: add an option to modify this behaviour.
pkg_ver = pkg_meta.versions[end]
for req in pkg_ver.requires # Requirements are plain strings
if contains(req, "julia")
for req in pkg_ver.requires
if req.package=="julia"
# Julia version dependency, skip it
continue
end
# Strip OS-specific conditions
other_pkg = (req[1] == '@') ? split(req," ")[2] : split(req," ")[1]
# Special case the the cycle:
# LibCURL -> WinRPM (on Windows only)
# WinRPM -> HTTPClient (on Unix only)
# HTTPClient -> LibCurl
# by breaking WinRPM -> HTTPClient
if pkg_name == "WinRPM" && other_pkg == "HTTPClient"
if pkg_name == "WinRPM" && req.package == "HTTPClient"
continue
end
# Map names to indices
src, dst = pkgname_idx[pkg_name], pkgname_idx[other_pkg]
src, dst = pkgname_idx[pkg_name], pkgname_idx[req.package]
# Add the directed edge
if reverse
dst, src = src, dst
Expand Down