From: simonpj Date: Thu, 27 Jan 2005 12:16:51 +0000 (+0000) Subject: [project @ 2005-01-27 12:16:51 by simonpj] X-Git-Tag: Initial_conversion_from_CVS_complete~1176 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d1a59a929136dc2332af4ddc0f500b4ba2cc1cb3;p=ghc-hetmet.git [project @ 2005-01-27 12:16:51 by simonpj] Fix handling of dependent packages without a version --- diff --git a/ghc/utils/ghc-pkg/Main.hs b/ghc/utils/ghc-pkg/Main.hs index d6da914..189ca99 100644 --- a/ghc/utils/ghc-pkg/Main.hs +++ b/ghc/utils/ghc-pkg/Main.hs @@ -626,19 +626,28 @@ updatePackageDB -> IO [InstalledPackageInfo] updatePackageDB db_stack pkgs new_pkg = do let - -- we update dependencies without version numbers to - -- match the actual versions of the relevant packages instaled. + -- The input package spec is allowed to give a package dependency + -- 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)} - resolveDep pkgid - | realVersion pkgid = pkgid - | otherwise = lookupDep (pkgName pkgid) --- = pkgid + resolveDep dep_pkgid + | realVersion dep_pkgid = dep_pkgid + | otherwise = lookupDep dep_pkgid - lookupDep name - = my_head "dep" [ pid | p <- concat (map snd db_stack), + lookupDep dep_pkgid + = let + name = pkgName dep_pkgid + in + case [ pid | p <- concat (map snd db_stack), 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 pkgid = package new_pkg