Commit 50c5abd2 authored by Michael Hanus 's avatar Michael Hanus
Browse files

CPM updated

parent 53e109cc
......@@ -27,8 +27,7 @@ cusage/CheckUsage
ertools/ERD2CDBI
ertools/ERD2Curry
importcalls/ImportCalls
optimize/bindingopt
optimize/binding_optimization/BindingOpt
optimize/BindingOpt
runcurry/RunCurry
spicey/spiceup
verification/ToVerifier
......
......@@ -200,6 +200,8 @@ which can be specifed in the \code{package.json} file
then the command \code{cpm install} also compiles the application
and installs the executable in the \code{bin} install directory of CPM
(see Section~\ref{sec:config} for details).
The installation of executables can be suppressed by the
\code{cpm install} option \code{-n} or \code{--noexec}.
\subsection{Checking out Packages}
......@@ -588,7 +590,8 @@ to the newest available version.
\item[\fbox{\code{install}}] Installs all dependencies of the current package.
Furthermore, if the current package contains an executable application,
the application is compiled and the executable is installed.
the application is compiled and the executable is installed
(unless the option \code{-n} or \code{--noexec} is set).
\item[\fbox{\code{install $package$ [--$pre$]}}] Installs the newest version of
a package to the global package cache. \code{--$pre$} enables the installation
......
......@@ -44,7 +44,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 02/04/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 03/04/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
......@@ -160,7 +160,8 @@ data CheckoutOptions = CheckoutOptions
data InstallOptions = InstallOptions
{ instTarget :: Maybe String
, instVersion :: Maybe Version
, instPrerelease :: Bool }
, instPrerelease :: Bool
, instExecutable :: Bool }
data UninstallOptions = UninstallOptions
{ uninstPackage :: Maybe String
......@@ -210,7 +211,7 @@ checkoutOpts s = case optCommand s of
installOpts :: Options -> InstallOptions
installOpts s = case optCommand s of
Install opts -> opts
_ -> InstallOptions Nothing Nothing False
_ -> InstallOptions Nothing Nothing False True
uninstallOpts :: Options -> UninstallOptions
uninstallOpts s = case optCommand s of
......@@ -349,7 +350,11 @@ optionParser = optParser
<.> flag (\a -> Right $ a { optCommand = Install (installOpts a) { instPrerelease = True } })
( short "p"
<> long "pre"
<> help "Try pre-release versions when searching for newest version.") )
<> help "Try pre-release versions when searching for newest version.")
<.> flag (\a -> Right $ a { optCommand = Install (installOpts a) { instExecutable = False } })
( short "n"
<> long "noexec"
<> help "Do not install executable.") )
<|> command "uninstall" (help "Uninstall package")
(\a -> Right $ a { optCommand = Uninstall (uninstallOpts a) })
( arg (\s a -> Right $ a { optCommand =
......@@ -564,7 +569,7 @@ installbin opts cfg repo gc = do
(checkout opts cfg repo gc |>
log Debug ("Change into directory " ++ copkgdir) |>
(setCurrentDirectory copkgdir >> succeedIO ()) |>
install (InstallOptions Nothing Nothing False) cfg repo gc |>
install (InstallOptions Nothing Nothing False True) cfg repo gc |>
cleanPackage Debug)
where
binpkgdir = binPackageDir cfg
......@@ -572,12 +577,12 @@ installbin opts cfg repo gc = do
install :: InstallOptions -> Config -> Repository -> GlobalCache
-> IO (ErrorLogger ())
install (InstallOptions Nothing Nothing _) cfg repo gc =
install (InstallOptions Nothing Nothing _ instexec) cfg repo gc =
tryFindLocalPackageSpec "." |>= \specDir ->
cleanCurryPathCache specDir |>
installLocalDependencies cfg repo gc specDir |>= \ (pkg,_) ->
installExecutable cfg repo pkg specDir
install (InstallOptions (Just pkg) Nothing pre) cfg repo gc = do
if instexec then installExecutable cfg repo pkg specDir else succeedIO ()
install (InstallOptions (Just pkg) Nothing pre _) cfg repo gc = do
fileExists <- doesFileExist pkg
if fileExists
then installFromZip cfg pkg
......@@ -585,12 +590,12 @@ install (InstallOptions (Just pkg) Nothing pre) cfg repo gc = do
Nothing -> failIO $ "Package '" ++ pkg ++
"' not found in package repository."
Just p -> acquireAndInstallPackageWithDependencies cfg repo gc p
install (InstallOptions (Just pkg) (Just ver) _) cfg repo gc =
install (InstallOptions (Just pkg) (Just ver) _ _) cfg repo gc =
case findVersion repo pkg ver of
Nothing -> failIO $ "Package '" ++ pkg ++ "-" ++ (showVersion ver) ++
"' not found in package repository."
Just p -> acquireAndInstallPackageWithDependencies cfg repo gc p
install (InstallOptions Nothing (Just _) _) _ _ _ =
install (InstallOptions Nothing (Just _) _ _) _ _ _ =
failIO "Must specify package name"
--- Installs the executable specified in the package in the
......
......@@ -2,6 +2,6 @@ module CASS.PackageConfig where
packageVersion :: String
packageVersion = "0.0.1"
packagePath :: String
packagePath = "/home/mh/pakcs/currytools/cpm/vendor/cass"
packagePath = "/net/medoc/home/mh/pakcs/currytools/cpm/vendor/cass"
packageExecutable :: String
packageExecutable = ""
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