Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed crash when printing latest versions with 'cabal install' #1018

Merged
merged 1 commit into from Aug 28, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions cabal-install/Distribution/Client/Install.hs
Expand Up @@ -506,15 +506,20 @@ printPlan dryRun verbosity plan sourcePkgDb = case plan of
diff -> " changes: " ++ intercalate ", " (map change diff)

showLatest :: ConfiguredPackage -> String
showLatest pkg = if pkgVersion /= latestVersion
then (" (latest: " ++ display latestVersion ++ ")")
else ""
showLatest pkg = case mLatestVersion of
Just latestVersion ->
if pkgVersion /= latestVersion
then (" (latest: " ++ display latestVersion ++ ")")
else ""
Nothing -> ""
where
pkgVersion = packageVersion pkg
latestVersion =
packageVersion . last
. SourcePackageIndex.lookupPackageName (packageIndex sourcePkgDb)
$ (packageName pkg)
mLatestVersion :: Maybe Version
mLatestVersion = case SourcePackageIndex.lookupPackageName
(packageIndex sourcePkgDb)
(packageName pkg) of
[] -> Nothing
x -> Just $ packageVersion $ last x

toFlagAssignment :: [Flag] -> FlagAssignment
toFlagAssignment = map (\ f -> (flagName f, flagDefault f))
Expand Down