definition:
|
allPackages :: String -> ErrorLogger [Package]
allPackages pkgDir = do
cacheExists <- liftIOEL $ doesDirectoryExist cdir
if cacheExists
then do
logDebug $ "Reading local package cache from '" ++ cdir ++ "'..."
cdircont <- liftIOEL $ getDirectoryContents cdir
let pkgDirs = filter (not . isPrefixOf ".") cdircont
pkgPaths <- liftIOEL $ mapM removeIfIllegalSymLink $ map (cdir </>) pkgDirs
let specPaths = map (</> packageSpecFile) $ concat pkgPaths
specs <- liftIOEL $ mapM (readPackageSpecIO . readCompleteFile) specPaths
return $ rights specs
else return []
where
readPackageSpecIO = fmap readPackageSpec
cdir = cacheDir pkgDir
removeIfIllegalSymLink target = do
dirExists <- doesDirectoryExist target
fileExists <- doesFileExist target
isLink <- isSymlink target
if isLink && (dirExists || fileExists)
then return [target]
else when isLink (removeSymlink target >> return ()) >> return []
|
demand:
|
no demanded arguments
|
deterministic:
|
deterministic operation
|
documentation:
|
--- Reads all packages specifications from the local package cache.
---
--- @param dir the package directory
|
failfree:
|
<FAILING>
|
indeterministic:
|
referentially transparent operation
|
infix:
|
no fixity defined
|
iotype:
|
{(_) |-> _}
|
name:
|
allPackages
|
precedence:
|
no precedence defined
|
result-values:
|
_
|
signature:
|
String -> CPM.ErrorLogger.ErrorLogger [CPM.Package.Package]
|
solution-complete:
|
operation might suspend on free variables
|
terminating:
|
possibly non-terminating
|
totally-defined:
|
possibly non-reducible on same data term
|