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

CPM updated

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