Skip to content
GitLab
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
b8d7b60a
Commit
b8d7b60a
authored
Oct 07, 2007
by
bjorn@bringert.net
Browse files
Move listInstalledPackages to Config.
parent
182c165d
Changes
4
Hide whitespace changes
Inline
Side-by-side
cabal-install/src/Network/Hackage/CabalInstall/BuildDep.hs
View file @
b8d7b60a
...
...
@@ -12,9 +12,8 @@
-----------------------------------------------------------------------------
module
Network.Hackage.CabalInstall.BuildDep
where
import
Network.Hackage.CabalInstall.Config
(
findCompiler
,
getKnownPackages
)
import
Network.Hackage.CabalInstall.Config
(
findCompiler
,
getKnownPackages
,
listInstalledPackages
)
import
Network.Hackage.CabalInstall.Dependency
(
getPackages
,
getBuildDeps
,
listInstalledPackages
,
depToUnresolvedDep
,
resolveDependenciesAux
)
import
Network.Hackage.CabalInstall.Install
(
install
,
installPackages
)
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
(
..
),
UnresolvedDependency
)
...
...
cabal-install/src/Network/Hackage/CabalInstall/Config.hs
View file @
b8d7b60a
...
...
@@ -14,6 +14,7 @@ module Network.Hackage.CabalInstall.Config
(
repoCacheDir
,
packageFile
,
packageDir
,
listInstalledPackages
,
getKnownPackages
,
message
,
pkgURL
...
...
@@ -43,7 +44,8 @@ import Distribution.PackageDescription (GenericPackageDescription(..)
,
PackageDescription
(
..
)
,
parsePackageDescription
,
ParseResult
(
..
))
import
Distribution.ParseUtils
(
FieldDescr
,
simpleField
,
listField
,
liftField
,
field
)
import
Distribution.Simple.Compiler
(
Compiler
)
import
Distribution.Simple.Compiler
(
Compiler
,
PackageDB
(
..
))
import
Distribution.Simple.Configure
(
getInstalledPackages
)
import
qualified
Distribution.Simple.Configure
as
Configure
(
configCompiler
)
import
Distribution.Simple.InstallDirs
(
InstallDirTemplates
(
..
),
PathTemplate
,
toPathTemplate
,
defaultInstallDirs
)
import
Distribution.Simple.Program
(
ProgramConfiguration
,
defaultProgramConfiguration
)
...
...
@@ -73,6 +75,15 @@ packageDir cfg pkg repo = repoCacheDir cfg repo
</>
pkgName
pkg
</>
showVersion
(
pkgVersion
pkg
)
listInstalledPackages
::
ConfigFlags
->
Compiler
->
ProgramConfiguration
->
IO
[
PackageIdentifier
]
listInstalledPackages
cfg
comp
conf
=
do
Just
ipkgs
<-
getInstalledPackages
(
configVerbose
cfg
)
comp
(
if
configUserInstall
cfg
then
UserPackageDB
else
GlobalPackageDB
)
conf
return
ipkgs
getKnownPackages
::
ConfigFlags
->
IO
[
PkgInfo
]
getKnownPackages
cfg
=
fmap
concat
$
mapM
(
readRepoIndex
cfg
)
$
configRepos
cfg
...
...
cabal-install/src/Network/Hackage/CabalInstall/Dependency.hs
View file @
b8d7b60a
...
...
@@ -16,8 +16,6 @@ module Network.Hackage.CabalInstall.Dependency
resolveDependencies
,
resolveDependenciesAux
,
finalizePackage
-- * Installed packages
,
listInstalledPackages
-- * Utilities
,
depToUnresolvedDep
,
getPackages
-- :: [ResolvedPackage] -> [(PackageIdentifier,[String],String)]
...
...
@@ -33,7 +31,6 @@ import Distribution.PackageDescription
,
GenericPackageDescription
(
packageDescription
)
,
finalizePackageDescription
)
import
Distribution.ParseUtils
(
showDependency
)
import
Distribution.Simple.Configure
(
getInstalledPackages
)
import
Distribution.Simple.Compiler
(
PackageDB
(
..
),
Compiler
,
showCompilerId
,
compilerVersion
)
import
Distribution.Simple.Program
(
ProgramConfiguration
)
...
...
@@ -41,7 +38,7 @@ import Data.Char (toLower)
import
Data.List
(
nub
,
maximumBy
,
isPrefixOf
)
import
qualified
System.Info
(
arch
,
os
)
import
Network.Hackage.CabalInstall.Config
(
getKnownPackages
,
findCompiler
)
import
Network.Hackage.CabalInstall.Config
(
listInstalledPackages
,
getKnownPackages
,
findCompiler
)
import
Network.Hackage.CabalInstall.Types
(
ResolvedPackage
(
..
),
UnresolvedDependency
(
..
)
,
ConfigFlags
(
..
),
PkgInfo
(
..
),
ResolvedDependency
(
..
),
Repo
(
..
))
import
Text.Printf
(
printf
)
...
...
@@ -197,12 +194,3 @@ resolveDependencies cfg comp conf deps
=
do
installed
<-
listInstalledPackages
cfg
comp
conf
available
<-
getKnownPackages
cfg
return
$
flattenDepList
installed
$
resolveDependenciesAux
cfg
comp
conf
installed
available
deps
listInstalledPackages
::
ConfigFlags
->
Compiler
->
ProgramConfiguration
->
IO
[
PackageIdentifier
]
listInstalledPackages
cfg
comp
conf
=
do
Just
ipkgs
<-
getInstalledPackages
(
configVerbose
cfg
)
comp
(
if
configUserInstall
cfg
then
UserPackageDB
else
GlobalPackageDB
)
conf
return
ipkgs
\ No newline at end of file
cabal-install/src/Network/Hackage/CabalInstall/Info.hs
View file @
b8d7b60a
...
...
@@ -12,9 +12,9 @@
-----------------------------------------------------------------------------
module
Network.Hackage.CabalInstall.Info
where
import
Network.Hackage.CabalInstall.Config
(
pkgURL
,
findCompiler
)
import
Network.Hackage.CabalInstall.Config
(
pkgURL
,
findCompiler
,
listInstalledPackages
)
import
Network.Hackage.CabalInstall.Dependency
(
resolveDependencies
,
fulfillDependency
,
listInstalledPackages
)
(
resolveDependencies
,
fulfillDependency
)
import
Network.Hackage.CabalInstall.Fetch
(
isFetched
,
packageFile
)
import
Network.Hackage.CabalInstall.Types
(
ConfigFlags
(
..
),
ResolvedPackage
(
..
)
,
UnresolvedDependency
(
..
))
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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