Commit def2aa01 authored by Michael Hanus's avatar Michael Hanus
Browse files

CPM updated

parent f431516f
...@@ -176,17 +176,21 @@ getLocalPackageSpec dir = ...@@ -176,17 +176,21 @@ getLocalPackageSpec dir =
--- Tries to find a package specification in the current directory or one of its --- Tries to find a package specification in the current directory or one of its
--- ancestors. Returns `Nothing` if there is not package specifiction. --- ancestors. Returns `Nothing` if there is not package specifiction.
--- In order to avoid infinite loops due to cyclic file structures,
--- the search is limited to 10 ancestor hierarchies.
searchLocalPackageSpec :: String -> IO (ErrorLogger (Maybe String)) searchLocalPackageSpec :: String -> IO (ErrorLogger (Maybe String))
searchLocalPackageSpec dir = do searchLocalPackageSpec = searchLocalSpec 10
existsLocal <- doesFileExist $ dir </> "package.json" where
if existsLocal searchLocalSpec m dir = do
then succeedIO (Just dir) existsLocal <- doesFileExist $ dir </> "package.json"
else log Debug ("No package.json in " ++ show dir ++ ", trying " ++ if existsLocal
show (dir </> "..")) |> do then succeedIO (Just dir)
parentExists <- doesDirectoryExist $ dir </> ".." else log Debug ("No package.json in " ++ show dir ++ ", trying " ++
if parentExists show (dir </> "..")) |> do
then searchLocalPackageSpec $ dir </> ".." parentExists <- doesDirectoryExist $ dir </> ".."
else succeedIO Nothing if m>0 && parentExists
then searchLocalSpec (m-1) $ dir </> ".."
else succeedIO Nothing
--- Resolves the dependencies for a package copy and fills the package caches. --- Resolves the dependencies for a package copy and fills the package caches.
resolveAndCopyDependencies :: Config -> Repository -> GC.GlobalCache -> String resolveAndCopyDependencies :: Config -> Repository -> GC.GlobalCache -> String
......
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