@@ -29,6 +29,7 @@ import Distribution.Server.Users.Types
2929import Distribution.Package
3030import Distribution.PackageDescription
3131import Distribution.PackageDescription.Configuration
32+ import Distribution.Pretty (prettyShow )
3233import Distribution.Utils.ShortText (fromShortText )
3334
3435import Control.Concurrent
@@ -85,18 +86,20 @@ data PackageItem = PackageItem {
8586 -- How many benchmarks (>=0) this package has.
8687 itemNumBenchmarks :: ! Int ,
8788 -- Last upload date
88- itemLastUpload :: ! UTCTime
89+ itemLastUpload :: ! UTCTime ,
90+ -- Last version
91+ itemLastVersion :: ! String
8992 -- Hotness: a more heuristic way to sort packages. presently non-existent.
9093 -- itemHotness :: Int
9194}
9295
9396instance MemSize PackageItem where
94- memSize (PackageItem a b c d e f g h i j k l) = memSize12 a b c d e f g h i j k l
97+ memSize (PackageItem a b c d e f g h i j k l o ) = memSize13 a b c d e f g h i j k l o
9598
9699
97100emptyPackageItem :: PackageName -> PackageItem
98101emptyPackageItem pkg = PackageItem pkg Set. empty Nothing " " []
99- 0 0 False 0 0 0 (UTCTime (toEnum 0 ) 0 )
102+ 0 0 False 0 0 0 (UTCTime (toEnum 0 ) 0 ) " "
100103
101104
102105initListFeature :: ServerEnv
@@ -249,6 +252,7 @@ listFeature CoreFeature{..}
249252 constructItem :: PkgInfo -> IO (PackageName , PackageItem )
250253 constructItem pkg = do
251254 let pkgname = packageName pkg
255+ desc = pkgDesc pkg
252256 -- [reverse index disabled] revCount <- query . GetReverseCount $ pkgname
253257 users <- queryGetUserDb
254258 tags <- queryTagsForPackage pkgname
@@ -257,14 +261,15 @@ listFeature CoreFeature{..}
257261 deprs <- queryGetDeprecatedFor pkgname
258262 maintainers <- queryUserGroup (maintainersGroup pkgname)
259263
260- return $ (,) pkgname $ (updateDescriptionItem (pkgDesc pkg) $ emptyPackageItem pkgname) {
264+ return $ (,) pkgname $ (updateDescriptionItem desc $ emptyPackageItem pkgname) {
261265 itemTags = tags
262266 , itemMaintainer = map (userIdToName users) (UserIdSet. toList maintainers)
263267 , itemDeprecated = deprs
264268 , itemDownloads = cmFind pkgname downs
265269 -- [reverse index disabled] , itemRevDepsCount = directReverseCount revCount
266270 , itemVotes = votes
267271 , itemLastUpload = fst (pkgOriginalUploadInfo pkg)
272+ , itemLastVersion = prettyShow $ pkgVersion $ pkgInfoId pkg
268273 }
269274
270275 ------------------------------
0 commit comments