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

Option -x|--exec added to the install command

parent 41ca886c
......@@ -608,15 +608,15 @@ This section gives a short description of all available CPM commands.
In addition to the commands listed below, there are some global options
which can be placed in front of the CPM command:
\begin{description}
\item[\code{-d$\,|\,$--define $option$=$value$}:]
This option overrides the configuration options of CPM,
see Section~\ref{sec:config}.
\item[\code{-v$\,|\,$--verbosity [info|debug]}:]
The default value is \code{info}.
The value \code{debug} provides more output messages in order to see
what CPM is doing.
\item[\code{-t$\,|\,$--time}:]
This option adds the elapsed time to every info or debug output line.
\item[\code{-d$\,|\,$--define $option$=$value$}:]
This option overrides the configuration options of CPM,
see Section~\ref{sec:config}.
\end{description}
%
The available commands of CPM are:
......@@ -664,10 +664,15 @@ exporting the module \code{JSON.Data} can be found by the command
\item[\fbox{\code{update}}] Updates the local copy of the central package index
to the newest available version.
\item[\fbox{\code{install}}] Installs all dependencies of the current package.
\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
(unless the option \code{-n} or \code{--noexec} is set).
With the option \code{-x} or \code{--exec}, the executable
is installed without installing all dependencies again.
This is useful to speed up the re-installation of a previously
installed application.
\item[\fbox{\code{install $package$ [--$pre$]}}] Installs the newest version
(compatible to the current compiler) of
......
......@@ -46,7 +46,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 06/06/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 29/06/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
......@@ -160,7 +160,8 @@ data InstallOptions = InstallOptions
{ instTarget :: Maybe String
, instVersion :: Maybe Version
, instPrerelease :: Bool
, instExecutable :: Bool }
, instExecutable :: Bool
, instExecOnly :: Bool }
data UninstallOptions = UninstallOptions
{ uninstPackage :: Maybe String
......@@ -231,7 +232,7 @@ checkoutOpts s = case optCommand s of
installOpts :: Options -> InstallOptions
installOpts s = case optCommand s of
Install opts -> opts
_ -> InstallOptions Nothing Nothing False True
_ -> InstallOptions Nothing Nothing False True False
uninstallOpts :: Options -> UninstallOptions
uninstallOpts s = case optCommand s of
......@@ -441,6 +442,11 @@ optionParser = optParser
( short "n"
<> long "noexec"
<> help "Do not install executable.")
<.> flag (\a -> Right $ a { optCommand = Install (installOpts a)
{ instExecOnly = True } })
( short "x"
<> long "exec"
<> help "Install executable only (do not re-install dependencies).")
uninstallArgs =
arg (\s a -> Right $ a { optCommand =
......@@ -723,20 +729,25 @@ installapp opts cfg repo gc = do
(checkout opts cfg repo gc |>
log Debug ("Change into directory " ++ copkgdir) |>
(setCurrentDirectory copkgdir >> succeedIO ()) |>
install (InstallOptions Nothing Nothing False True) cfg repo gc )
install (InstallOptions Nothing Nothing False True False) cfg repo gc )
where
apppkgdir = appPackageDir cfg
copkgdir = apppkgdir </> coPackage opts
install :: InstallOptions -> Config -> Repository -> GlobalCache
-> IO (ErrorLogger ())
install (InstallOptions Nothing Nothing _ instexec) cfg repo gc =
install (InstallOptions Nothing Nothing _ instexec False) cfg repo gc =
tryFindLocalPackageSpec "." |>= \pkgdir ->
cleanCurryPathCache pkgdir |>
installLocalDependencies cfg repo gc pkgdir |>= \ (pkg,_) ->
writePackageConfig cfg pkgdir pkg |>
if instexec then installExecutable cfg repo pkg else succeedIO ()
install (InstallOptions (Just pkg) Nothing pre _) cfg repo gc = do
-- Install executable only:
install (InstallOptions Nothing Nothing _ _ True) cfg repo _ =
tryFindLocalPackageSpec "." |>= \pkgdir ->
loadPackageSpec pkgdir |>= \pkg ->
installExecutable cfg repo pkg
install (InstallOptions (Just pkg) Nothing pre _ _) cfg repo gc = do
fileExists <- doesFileExist pkg
if fileExists
then installFromZip cfg pkg
......@@ -744,12 +755,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"
--- Checks the compiler compatibility.
......
Supports Markdown
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