Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
Packages
Cabal
Commits
cac2c913
Commit
cac2c913
authored
10 years ago
by
Mikhail Glushenkov
Browse files
Options
Downloads
Patches
Plain Diff
Whitespace, 80-col violations.
parent
104c6852
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cabal-install/Distribution/Client/List.hs
+39
-17
39 additions, 17 deletions
cabal-install/Distribution/Client/List.hs
with
39 additions
and
17 deletions
cabal-install/Distribution/Client/List.hs
+
39
−
17
View file @
cac2c913
...
...
@@ -87,15 +87,29 @@ getPkgList verbosity packageDBs repos comp conf listFlags pats = do
prefs
name
=
fromMaybe
anyVersion
(
Map
.
lookup
name
(
packagePreferences
sourcePkgDb
))
pkgsInfo
::
[(
PackageName
,
[
Installed
.
InstalledPackageInfo
],
[
SourcePackage
])]
pkgsInfo
::
[(
PackageName
,
[
Installed
.
InstalledPackageInfo
],
[
SourcePackage
])]
pkgsInfo
-- gather info for all packages
|
null
pats
=
mergePackages
(
InstalledPackageIndex
.
allPackages
installedPkgIndex
)
(
PackageIndex
.
allPackages
sourcePkgIndex
)
|
null
pats
=
mergePackages
(
InstalledPackageIndex
.
allPackages
installedPkgIndex
)
(
PackageIndex
.
allPackages
sourcePkgIndex
)
-- gather info for packages matching search term
|
otherwise
=
mergePackages
(
matchingPackages
InstalledPackageIndex
.
searchByNameSubstring
installedPkgIndex
)
(
matchingPackages
(
\
idx
n
->
concatMap
snd
(
PackageIndex
.
searchByNameSubstring
idx
n
))
sourcePkgIndex
)
|
otherwise
=
pkgsInfoMatching
pkgsInfoMatching
::
[(
PackageName
,
[
Installed
.
InstalledPackageInfo
],
[
SourcePackage
])]
pkgsInfoMatching
=
let
matchingInstalled
=
matchingPackages
InstalledPackageIndex
.
searchByNameSubstring
installedPkgIndex
matchingSource
=
matchingPackages
(
\
idx
n
->
concatMap
snd
(
PackageIndex
.
searchByNameSubstring
idx
n
))
sourcePkgIndex
in
mergePackages
matchingInstalled
matchingSource
matches
::
[
PackageDisplayInfo
]
matches
=
[
mergePackageInfo
pref
...
...
@@ -169,8 +183,10 @@ info verbosity packageDBs repos comp conf
-- just available source packages, so we must resolve targets using
-- the combination of installed and source packages.
let
sourcePkgs'
=
PackageIndex
.
fromList
$
map
packageId
(
InstalledPackageIndex
.
allPackages
installedPkgIndex
)
++
map
packageId
(
PackageIndex
.
allPackages
sourcePkgIndex
)
$
map
packageId
(
InstalledPackageIndex
.
allPackages
installedPkgIndex
)
++
map
packageId
(
PackageIndex
.
allPackages
sourcePkgIndex
)
pkgSpecifiers
<-
resolveUserTargets
verbosity
(
fromFlag
$
globalWorldFile
globalFlags
)
sourcePkgs'
userTargets
...
...
@@ -191,7 +207,8 @@ info verbosity packageDBs repos comp conf
PackageIndex
.
PackageIndex
SourcePackage
->
PackageSpecifier
SourcePackage
->
Either
String
PackageDisplayInfo
gatherPkgInfo
prefs
installedPkgIndex
sourcePkgIndex
(
NamedPackage
name
constraints
)
gatherPkgInfo
prefs
installedPkgIndex
sourcePkgIndex
(
NamedPackage
name
constraints
)
|
null
(
selectedInstalledPkgs
)
&&
null
(
selectedSourcePkgs
)
=
Left
$
"There is no available version of "
++
display
name
++
" that satisfies "
...
...
@@ -205,10 +222,11 @@ info verbosity packageDBs repos comp conf
(
pref
,
installedPkgs
,
sourcePkgs
)
=
sourcePkgsInfo
prefs
name
installedPkgIndex
sourcePkgIndex
selectedInstalledPkgs
=
InstalledPackageIndex
.
lookupDependency
installedPkgIndex
(
Dependency
name
verConstraint
)
selectedSourcePkgs
=
PackageIndex
.
lookupDependency
sourcePkgIndex
(
Dependency
name
verConstraint
)
selectedInstalledPkgs
=
InstalledPackageIndex
.
lookupDependency
installedPkgIndex
(
Dependency
name
verConstraint
)
selectedSourcePkgs
=
PackageIndex
.
lookupDependency
sourcePkgIndex
(
Dependency
name
verConstraint
)
selectedSourcePkg'
=
latestWithPref
pref
selectedSourcePkgs
-- display a specific package version if the user
...
...
@@ -217,7 +235,8 @@ info verbosity packageDBs repos comp conf
verConstraint
=
foldr
intersectVersionRanges
anyVersion
verConstraints
verConstraints
=
[
vr
|
PackageConstraintVersion
_
vr
<-
constraints
]
gatherPkgInfo
prefs
installedPkgIndex
sourcePkgIndex
(
SpecificSourcePackage
pkg
)
=
gatherPkgInfo
prefs
installedPkgIndex
sourcePkgIndex
(
SpecificSourcePackage
pkg
)
=
Right
$
mergePackageInfo
pref
installedPkgs
sourcePkgs
selectedPkg
True
where
...
...
@@ -236,8 +255,9 @@ sourcePkgsInfo prefs name installedPkgIndex sourcePkgIndex =
(
pref
,
installedPkgs
,
sourcePkgs
)
where
pref
=
prefs
name
installedPkgs
=
concatMap
snd
(
InstalledPackageIndex
.
lookupPackageName
installedPkgIndex
name
)
sourcePkgs
=
PackageIndex
.
lookupPackageName
sourcePkgIndex
name
installedPkgs
=
concatMap
snd
(
InstalledPackageIndex
.
lookupPackageName
installedPkgIndex
name
)
sourcePkgs
=
PackageIndex
.
lookupPackageName
sourcePkgIndex
name
-- | The info that we can display for each package. It is information per
...
...
@@ -433,8 +453,10 @@ mergePackageInfo versionPref installedPkgs sourcePkgs selectedPkg showVer =
modules
=
combine
Installed
.
exposedModules
installed
(
maybe
[]
Source
.
exposedModules
.
Source
.
library
)
source
,
dependencies
=
combine
(
map
(
SourceDependency
.
simplifyDependency
)
.
Source
.
buildDepends
)
source
(
map
InstalledDependency
.
Installed
.
depends
)
installed
,
dependencies
=
combine
(
map
(
SourceDependency
.
simplifyDependency
)
.
Source
.
buildDepends
)
source
(
map
InstalledDependency
.
Installed
.
depends
)
installed
,
haddockHtml
=
fromMaybe
""
.
join
.
fmap
(
listToMaybe
.
Installed
.
haddockHTMLs
)
$
installed
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment