Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
53fc7ec4
Commit
53fc7ec4
authored
Oct 07, 2007
by
bjorn@bringert.net
Browse files
Set prefix to .cabal by default.
parent
03783edd
Changes
4
Hide whitespace changes
Inline
Side-by-side
cabal-install/src/Network/Hackage/CabalInstall/Clean.hs
View file @
53fc7ec4
...
...
@@ -14,13 +14,12 @@ module Network.Hackage.CabalInstall.Clean
(
clean
)
where
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
)
import
Network.Hackage.CabalInstall.Config
(
packagesDirectory
)
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
(
..
))
import
System.Directory
(
removeDirectoryRecursive
)
-- | 'clean' removes all downloaded packages from the {config-dir}\/packages\/ directory.
clean
::
ConfigFlags
->
IO
()
clean
cfg
=
removeDirectoryRecursive
(
packagesDirectory
cfg
)
=
removeDirectoryRecursive
(
configCacheDir
cfg
)
cabal-install/src/Network/Hackage/CabalInstall/Config.hs
View file @
53fc7ec4
...
...
@@ -11,8 +11,7 @@
-- Utilities for handling saved state such as known packages, known servers and downloaded packages.
-----------------------------------------------------------------------------
module
Network.Hackage.CabalInstall.Config
(
packagesDirectory
,
repoCacheDir
(
repoCacheDir
,
packageFile
,
packageDir
,
getKnownPackages
...
...
@@ -46,7 +45,7 @@ import Distribution.PackageDescription (GenericPackageDescription(..)
import
Distribution.ParseUtils
(
FieldDescr
,
simpleField
,
listField
,
liftField
,
field
)
import
Distribution.Simple.Compiler
(
Compiler
)
import
qualified
Distribution.Simple.Configure
as
Configure
(
configCompiler
)
import
Distribution.Simple.InstallDirs
(
InstallDirTemplates
(
..
),
PathTemplate
,
defaultInstallDirs
)
import
Distribution.Simple.InstallDirs
(
InstallDirTemplates
(
..
),
PathTemplate
,
toPathTemplate
,
defaultInstallDirs
)
import
Distribution.Simple.Program
(
ProgramConfiguration
,
defaultProgramConfiguration
)
import
Distribution.Version
(
Dependency
,
showVersion
)
import
Distribution.Verbosity
(
Verbosity
,
normal
)
...
...
@@ -56,13 +55,9 @@ import Network.Hackage.CabalInstall.Types (ConfigFlags (..), PkgInfo (..), Repo(
import
Network.Hackage.CabalInstall.Utils
-- | Full path to the packages directory.
packagesDirectory
::
ConfigFlags
->
FilePath
packagesDirectory
cfg
=
configCacheDir
cfg
</>
"packages"
-- | Full path to the local cache directory for a repository.
repoCacheDir
::
ConfigFlags
->
Repo
->
FilePath
repoCacheDir
cfg
repo
=
packagesDirectory
cfg
</>
repoName
repo
repoCacheDir
cfg
repo
=
configCacheDir
cfg
</>
repoName
repo
-- |Generate the full path to the locally cached copy of
-- the tarball for a given @PackageIdentifer@.
...
...
@@ -130,26 +125,28 @@ findCompiler cfg = Configure.configCompiler
-- * Default config
--
defaultC
onfig
Dir
::
IO
FilePath
defaultC
onfig
Dir
=
getAppUserDataDirectory
"cabal"
defaultC
abal
Dir
::
IO
FilePath
defaultC
abal
Dir
=
getAppUserDataDirectory
"cabal"
defaultConfigFile
::
IO
FilePath
defaultConfigFile
=
do
dir
<-
defaultC
onfig
Dir
defaultConfigFile
=
do
dir
<-
defaultC
abal
Dir
return
$
dir
</>
"config"
defaultCacheDir
::
IO
FilePath
defaultCacheDir
=
defaultConfigDir
defaultCacheDir
=
do
dir
<-
defaultCabalDir
return
$
dir
</>
"packages"
defaultCompiler
::
CompilerFlavor
defaultCompiler
=
fromMaybe
GHC
defaultCompilerFlavor
defaultConfigFlags
::
IO
ConfigFlags
defaultConfigFlags
=
do
installDirs
<-
defaultInstallDirs
defaultCompiler
True
do
defaultPrefix
<-
defaultCabalDir
installDirs
<-
defaultInstallDirs
defaultCompiler
True
cacheDir
<-
defaultCacheDir
return
$
ConfigFlags
{
configCompiler
=
defaultCompiler
,
configInstallDirs
=
installDirs
,
configInstallDirs
=
installDirs
{
prefixDirTemplate
=
toPathTemplate
defaultPrefix
}
,
configCacheDir
=
cacheDir
,
configRepos
=
[
Repo
"hackage.haskell.org"
"http://hackage.haskell.org/packages/archive"
]
,
configVerbose
=
normal
...
...
cabal-install/src/Network/Hackage/CabalInstall/Fetch.hs
View file @
53fc7ec4
...
...
@@ -32,7 +32,7 @@ import Text.Printf (printf)
import
System.Directory
(
doesFileExist
,
createDirectoryIfMissing
)
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
(
..
),
UnresolvedDependency
(
..
),
Repo
(
..
))
import
Network.Hackage.CabalInstall.Config
(
packagesDirectory
,
repoCacheDir
,
packageFile
,
packageDir
,
pkgURL
,
message
,
findCompiler
)
import
Network.Hackage.CabalInstall.Config
(
repoCacheDir
,
packageFile
,
packageDir
,
pkgURL
,
message
,
findCompiler
)
import
Network.Hackage.CabalInstall.Dependency
(
filterFetchables
,
resolveDependencies
)
import
Distribution.Package
(
PackageIdentifier
(
..
),
showPackageId
)
...
...
cabal-install/src/Network/Hackage/CabalInstall/Setup.hs
View file @
53fc7ec4
...
...
@@ -19,7 +19,7 @@ module Network.Hackage.CabalInstall.Setup
import
Control.Monad
(
when
)
import
Distribution.ParseUtils
(
parseDependency
)
import
Distribution.Compiler
(
CompilerFlavor
(
..
))
import
Distribution.Simple.InstallDirs
(
InstallDirTemplates
(
..
))
import
Distribution.Simple.InstallDirs
(
InstallDirTemplates
(
..
)
,
toPathTemplate
)
import
Distribution.Verbosity
import
Data.List
(
find
)
import
System.Console.GetOpt
(
ArgDescr
(
..
),
ArgOrder
(
..
),
OptDescr
(
..
),
usageInfo
,
getOpt'
)
...
...
@@ -97,7 +97,7 @@ configFromOptions = foldr f
OptUserInstall
u
->
cfg
{
configUserInstall
=
u
}
OptHelp
->
error
"Got to setFlagsFromOptions OptHelp"
OptVerbose
v
->
cfg
{
configVerbose
=
v
}
where
lib
g
d
=
cfg
{
configInstallDirs
=
g
(
configInstallDirs
cfg
)
(
read
$
show
d
)
}
-- FIXME: Read PathTemplate seems to require quotes
where
lib
g
d
=
cfg
{
configInstallDirs
=
g
(
configInstallDirs
cfg
)
(
toPathTemplate
d
)
}
data
Cmd
=
Cmd
{
cmdName
::
String
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment