Commit 9b8103da authored by Michael Hanus 's avatar Michael Hanus
Browse files

CPM updated

parent 0414c78f
......@@ -760,8 +760,13 @@ For instance, the command
lists all packages where the name of the executable contains the
string \ccode{show}.
\item[\fbox{\code{update}}] Updates the local copy of the central package index
\item[\fbox{\code{update}}]
Updates the local copy of the central package index
to the newest available version.
This command also cleans the global package cache in order to support
the download of fresh package versions.
Note that this also removes local copies of packages
installed by the command \ccode{add --package}.
\item[\fbox{\code{install}}]
Installs all dependencies of the current package.
......
......@@ -49,7 +49,7 @@ cpmBanner :: String
cpmBanner = unlines [bannerLine,bannerText,bannerLine]
where
bannerText =
"Curry Package Manager <curry-language.org/tools/cpm> (version of 03/11/2017)"
"Curry Package Manager <curry-language.org/tools/cpm> (version of 09/11/2017)"
bannerLine = take (length bannerText) (repeat '-')
main :: IO ()
......
......@@ -20,7 +20,7 @@ module CPM.Repository
, updateRepositoryCache
) where
import Char ( toLower )
import Char ( toLower, toUpper )
import Directory
import Either
import FilePath
......@@ -30,12 +30,13 @@ import List
import ReadShowTerm ( showQTerm, readQTerm )
import System ( exitWith )
import CPM.Config ( Config, repositoryDir, packageIndexRepository )
import CPM.Config ( Config, repositoryDir, packageIndexRepository
, packageInstallDir )
import CPM.ConfigPackage ( packageVersion )
import CPM.ErrorLogger
import CPM.Package
import CPM.FileUtil ( checkAndGetDirectoryContents, inDirectory
, whenFileExists )
, whenFileExists, removeDirectoryComplete )
import CPM.Resolution ( isCompatibleToCompiler )
data Repository = Repository [Package]
......@@ -167,12 +168,17 @@ readRepositoryFrom path = do
Right s -> Right s
dirOrSpec d = (not $ isPrefixOf "." d) && takeExtension d /= ".md" &&
(not $ isPrefixOf repositoryCacheFileName d)
(not $ isPrefixOf repositoryCacheFileName (map toUpper d))
--- Updates the package index from the central Git repository.
--- Cleans also the global package cache in order to support
--- downloading the newest versions.
updateRepository :: Config -> IO (ErrorLogger ())
updateRepository cfg = do
cleanRepositoryCache cfg
debugMessage $ "Deleting global package cache: '" ++
packageInstallDir cfg ++ "'"
removeDirectoryComplete (packageInstallDir cfg)
gitExists <- doesDirectoryExist $ (repositoryDir cfg) </> ".git"
if gitExists
then do
......@@ -197,7 +203,7 @@ updateRepository cfg = do
--- The local file name containing the repository cache as a Curry term.
repositoryCacheFileName :: String
repositoryCacheFileName = "repository_cache"
repositoryCacheFileName = "REPOSITORY_CACHE"
--- The file containing the repository cache as a Curry term.
repositoryCache :: Config -> String
......
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