Commit 23540461 authored by Michael Hanus 's avatar Michael Hanus

CPM updated

parent 4c36b254
......@@ -309,7 +309,7 @@ one can use the command
cypm install <package>
\end{lstlisting}
This command checks out the package in some internal directory
(default: \code{\$HOME/.cpm/app_packages}, see
(default: \code{\$HOME/.cpm/apps_$Curry system$}, see
Section~\ref{sec:config})
and installs the binary of the application provided by the package
in \code{\$HOME/.cpm/bin} (see also Section~\ref{sec:checkout}).
......@@ -685,7 +685,7 @@ Default value: \code{\$HOME/.cpm/bin}
\item[\fbox{\code{APP_PACKAGE_PATH}}]
The path to the package cache where packages are checked out if only
their binaries are installed (see Section~\ref{sec:installapp}).
Default value: \code{\$HOME/.cpm/app_packages}.
Default value: \code{\$HOME/.cpm/apps_$Curry system$}.
\item[\fbox{\code{HOME_PACKAGE_PATH}}]
The path to the meta-package which is used if you are outside another
......
......@@ -65,7 +65,7 @@ defaultConfig = Config
{ packageInstallDir = "$HOME/.cpm/packages"
, binInstallDir = "$HOME/.cpm/bin"
, repositoryDir = "$HOME/.cpm/index"
, appPackageDir = "$HOME/.cpm/app_packages"
, appPackageDir = ""
, packageIndexURL = packageIndexDefaultURL
, homePackageDir = ""
, curryExec = Dist.installDir </> "bin" </> Dist.curryCompiler
......@@ -113,6 +113,17 @@ setCompilerExecutable cfg = do
maybe (error $ "Executable '" ++ exec ++ "' not found in path!")
(\absexec -> return cfg { curryExec = absexec })
--- Sets the `appPackageDir` depending on the compiler version.
setAppPackageDir :: Config -> IO Config
setAppPackageDir cfg
| null (appPackageDir cfg)
= do homedir <- getHomeDirectory
let cpmdir = homedir </> ".cpm"
(cname,cmaj,cmin) = compilerVersion cfg
cmpname = cname ++ "_" ++ show cmaj ++ "." ++ show cmin
return cfg { appPackageDir = cpmdir </> "apps_" ++ cmpname }
| otherwise = return cfg
--- Sets the `homePackageDir` depending on the compiler version.
setHomePackageDir :: Config -> IO Config
setHomePackageDir cfg
......@@ -190,10 +201,11 @@ readConfigurationWith defsettings = do
case mergedSettings of
Left e -> return $ Left e
Right s0 -> do s1 <- replaceHome s0
createDirectories s1
s2 <- setCompilerVersion s1
s3 <- setHomePackageDir s2
return $ Right s3
s3 <- setAppPackageDir s2
s4 <- setHomePackageDir s3
createDirectories s4
return $ Right s4
replaceHome :: Config -> IO Config
replaceHome cfg = do
......
......@@ -56,7 +56,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 05/10/2018)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 15/11/2018)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
......
......@@ -10,7 +10,7 @@ module CPM.PackageCache.Runtime
, writePackageConfig
) where
import FilePath ( (</>), (<.>) )
import FilePath ( (</>), (<.>), takeDirectory )
import FileGoodies ( baseName )
import Directory ( createDirectoryIfMissing, copyFile, getDirectoryContents
, getAbsolutePath, doesDirectoryExist, doesFileExist )
......@@ -70,7 +70,7 @@ ensureCacheDirectory :: String -> IO String
ensureCacheDirectory dir = do
createDirectoryIfMissing True packagesDir
return packagesDir
where packagesDir = dir </> ".cpm" </> "packages"
where packagesDir = dir </> ".cpm" </> "packages"
--- Writes the package configuration module (if specified) into the
......@@ -91,6 +91,7 @@ writePackageConfig cfg pkgdir pkg loadpath =
writeConfigFile configmod binname = do
let configfile = pkgdir </> "src" </> foldr1 (</>) (split (=='.') configmod)
<.> ".curry"
createDirectoryIfMissing True (takeDirectory configfile)
abspkgdir <- getAbsolutePath pkgdir
writeFile configfile $ unlines $
[ "module " ++ configmod ++ " where"
......
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