Commit d1a59a92 authored by simonpj's avatar simonpj
Browse files

[project @ 2005-01-27 12:16:51 by simonpj]

Fix handling of dependent packages without a version
parent dae341f5
...@@ -626,19 +626,28 @@ updatePackageDB ...@@ -626,19 +626,28 @@ updatePackageDB
-> IO [InstalledPackageInfo] -> IO [InstalledPackageInfo]
updatePackageDB db_stack pkgs new_pkg = do updatePackageDB db_stack pkgs new_pkg = do
let let
-- we update dependencies without version numbers to -- The input package spec is allowed to give a package dependency
-- match the actual versions of the relevant packages instaled. -- without a version number; e.g.
-- depends: base
-- Here, we update these dependencies without version numbers to
-- match the actual versions of the relevant packages installed.
updateDeps p = p{depends = map resolveDep (depends p)} updateDeps p = p{depends = map resolveDep (depends p)}
resolveDep pkgid resolveDep dep_pkgid
| realVersion pkgid = pkgid | realVersion dep_pkgid = dep_pkgid
| otherwise = lookupDep (pkgName pkgid) | otherwise = lookupDep dep_pkgid
-- = pkgid
lookupDep name lookupDep dep_pkgid
= my_head "dep" [ pid | p <- concat (map snd db_stack), = let
name = pkgName dep_pkgid
in
case [ pid | p <- concat (map snd db_stack),
let pid = package p, let pid = package p,
pkgName pid == name ] pkgName pid == name ] of
(pid:_) -> pid -- Found installed package,
-- replete with its version
[] -> dep_pkgid -- No installed package; use
-- the version-less one
is_exposed = exposed new_pkg is_exposed = exposed new_pkg
pkgid = package new_pkg pkgid = package new_pkg
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment