Skip to content

Commit

Permalink
pkg2 wip: calculation of dependencies, stripped of fixed packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski committed May 14, 2013
1 parent e0fb95f commit 559b92c
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions extras/pkg2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function fixed(avail::Dict=available())
return pkgs
end

function requirements(reqs::Dict, fix::Dict=fixed())
function requirements(reqs::Dict=parse_requires("REQUIRE"), fix::Dict=fixed())
for (p1,f1) in fix
satisfies(p1, f1.version, reqs) ||
warn("$p1 is fixed at $(f1.version) conflicting with top-level requirement: $(reqs[p1])")
Expand All @@ -132,14 +132,25 @@ function requirements(reqs::Dict, fix::Dict=fixed())
end
reqs
end
requirements() = requirements(parse_requires("REQUIRE"))

function dependencies(avail::Dict, fixed::Dict=fixed())
for (pkg,vers) in avail
for (ver,avail) in vers

function dependencies(avail::Dict=available(), fix::Dict=fixed(avail))
for (fp,fx) in fix
if haskey(avail, fp)
delete!(avail, fp)
continue
end
for (ap,av) in avail, (v,a) in av
if satisfies(fp, fx.version, a.requires)
delete!(a.requires, fp, nothing)
else
delete!(av, v)
end
end
end
for (ap,av) in avail
isempty(av) && delete!(avail, ap)
end
avail
end

# end # module

0 comments on commit 559b92c

Please sign in to comment.