-getPackageInfo :: IO [PackageConfig]
-getPackageInfo = do ps <- getPackages
- getPackageDetails ps
-
-getPackageDetails :: [PackageName] -> IO [PackageConfig]
-getPackageDetails ps = do
- pkg_details <- getPackageConfigMap
- return [ pkg | Just pkg <- map (lookupPkg pkg_details) ps ]
-
+-- -----------------------------------------------------------------------------
+-- Package Utils
+
+getExplicitPackagesAnd :: [PackageName] -> IO [PackageConfig]
+getExplicitPackagesAnd pkg_names = do
+ pkg_map <- getPackageConfigMap
+ expl <- readIORef v_ExplicitPackages
+ all_pkgs <- foldM (add_package pkg_map) expl pkg_names
+ getPackageDetails all_pkgs
+
+-- return all packages, including both the auto packages and the explicit ones
+getExplicitAndAutoPackageConfigs :: IO [PackageConfig]
+getExplicitAndAutoPackageConfigs = do
+ pkg_map <- getPackageConfigMap
+ let auto_packages = [ mkPackageName (name p) | p <- eltsUFM pkg_map, auto p ]
+ getExplicitPackagesAnd auto_packages