Commit 51387887 authored by Michael Hanus 's avatar Michael Hanus

CPM updated

parent 9889e859
......@@ -737,10 +737,8 @@ depsCmd opts cfg =
loadPackageSpec specDir |>= \pkg ->
checkCompiler cfg pkg >>
if depsPath opts -- show CURRYPATH only?
then loadCurryPathFromCache cfg specDir |>=
maybe (computePackageLoadPath cfg specDir)
succeedIO |>= \currypath ->
putStrLn currypath >> succeedIO ()
then getCurryLoadPath cfg specDir |>= \loadpath ->
putStrLn loadpath >> succeedIO ()
else resolveDependencies cfg specDir |>= \result ->
putStrLn (showResult result) >> succeedIO ()
......@@ -799,7 +797,8 @@ installCmd (InstallOptions Nothing Nothing _ instexec False) cfg repo =
cleanCurryPathCache pkgdir |>
installLocalDependencies cfg repo pkgdir |>= \ (pkg,_) ->
saveBaseVersionToCache cfg pkgdir >>
writePackageConfig cfg pkgdir pkg |>
getCurryLoadPath cfg pkgdir |>= \currypath ->
writePackageConfig cfg pkgdir pkg currypath |>
if instexec then installExecutable cfg pkg else succeedIO ()
-- Install executable only:
installCmd (InstallOptions Nothing Nothing _ _ True) cfg _ =
......@@ -1193,9 +1192,7 @@ genDocForPrograms opts cfg docdir specDir pkg = do
if null docmods
then log Info "No modules to be documented!"
else
loadCurryPathFromCache cfg specDir |>=
maybe (computePackageLoadPath cfg specDir)
succeedIO |>= \currypath ->
getCurryLoadPath cfg specDir |>= \currypath ->
let pkgurls = path2packages abspkgdir currypath in
if apidoc
then foldEL (\_ -> docModule currypath pkgurls) () docmods |>
......@@ -1367,9 +1364,7 @@ execCmd o cfg =
execWithPkgDir :: ExecOptions -> Config -> String -> IO (ErrorLogger ())
execWithPkgDir o cfg specDir =
loadCurryPathFromCache cfg specDir |>=
maybe (computePackageLoadPath cfg specDir)
succeedIO |>= execWithCurryPath o cfg
getCurryLoadPath cfg specDir |>= execWithCurryPath o cfg
execWithCurryPath :: ExecOptions -> Config -> String -> IO (ErrorLogger ())
execWithCurryPath o _ currypath =
......@@ -1517,6 +1512,13 @@ saveCurryPathToCache cfg pkgdir path = do
writeFile (curryPathCacheFile pkgdir)
(unlines [path, showCompilerVersion cfg, baseVersion cfg])
--- Gets CURRYPATH of the given package (either from the local cache file
--- in the package dir or compute it).
getCurryLoadPath :: Config -> String -> IO (ErrorLogger String)
getCurryLoadPath cfg pkgdir =
loadCurryPathFromCache cfg pkgdir |>=
maybe (computePackageLoadPath cfg pkgdir) succeedIO
--- Restores package CURRYPATH from local cache file in the given package dir,
--- if it is still up-to-date, i.e., it exists and is newer than the package
--- specification.
......
......@@ -59,7 +59,7 @@ copyPackages cfg pkgs dir = mapEL copyPackage pkgs
then -- in order to obtain complete package specification:
readPackageFromRepository cfg pkg |>= \reppkg ->
copyDirectoryFollowingSymlinks pkgDir cdir >>
writePackageConfig cfg destDir reppkg >> succeedIO reppkg
writePackageConfig cfg destDir reppkg "" >> succeedIO reppkg
else error $ "Package " ++ packageId pkg ++
" could not be found in package cache."
where
......@@ -75,8 +75,9 @@ ensureCacheDirectory dir = do
--- Writes the package configuration module (if specified) into the
--- the package sources.
writePackageConfig :: Config -> String -> Package -> IO (ErrorLogger ())
writePackageConfig cfg pkgdir pkg =
writePackageConfig :: Config -> String -> Package -> String
-> IO (ErrorLogger ())
writePackageConfig cfg pkgdir pkg loadpath =
maybe (succeedIO ())
(\configmod ->
let binname = maybe ""
......@@ -100,7 +101,11 @@ writePackageConfig cfg pkgdir pkg =
, ""
, "--- Package location."
, "packagePath :: String"
, "packagePath = \"" ++ abspkgdir ++ "\""
, "packagePath = " ++ show abspkgdir
, ""
, "--- Load path for the package (if it is the main package)."
, "packageLoadPath :: String"
, "packageLoadPath = " ++ show loadpath
] ++
if null binname
then []
......
......@@ -26,7 +26,7 @@ uninstall: clean
$(TOOL): $(LIBDIR)/CPNS.curry
$(REPL) $(REPL_OPTS) $(ADD_OPTS) :load CPNSD :save :q
$(REPL) --nocypm $(REPL_OPTS) $(ADD_OPTS) :load CPNSD :save :q
# Show the currently registered ports:
show:
......
......@@ -24,10 +24,10 @@ uninstall: clean
$(SUBMITFORM): SubmitForm.curry HtmlCgi.curry \
$(LIBDIR)/NamedSocket.curry $(LIBDIR)/CPNS.curry
$(REPL) $(REPL_OPTS) :load SubmitForm :save :q
$(REPL) --nocypm $(REPL_OPTS) :load SubmitForm :save :q
$(REGISTRY): Registry.curry HtmlCgi.curry
$(REPL) $(REPL_OPTS) :load Registry :save :q
$(REPL) --nocypm $(REPL_OPTS) :load Registry :save :q
cleanServers:
......
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