Fix upload v2 core packages fpco/stackage#481

Simple fix: was only adding packages from the build plan, not from the
core libraries list. Most of the annoyance in the patch is just dealing
with the multiple PackageName and Version types.
This commit is contained in:
Michael Snoyman 2015-03-19 13:40:11 +02:00
parent 5c3e4adf10
commit 706a977e19

View File

@ -244,21 +244,17 @@ finishUpload
, ltsStackage = sid
}
let cores :: Set PackageName
cores = setFromList
$ map (PackageName . display . fst)
$ mapToList
let cores, nonCores :: Map PackageName Version
cores = mapKeysWith const (PackageName . display)
$ fmap (Version . display)
$ siCorePackages
$ bpSystemInfo siPlan
forM_ (mapToList $ fmap ppVersion $ bpPackages siPlan) $ \(name', version') -> do
let nameT = display name'
mpair = (,)
<$> fromPathPiece nameT
<*> fromPathPiece (display version')
(name, version) <-
case mpair of
Nothing -> error $ "Could not parse: " ++ show (name', version')
Just pair -> return pair
nonCores
= mapKeysWith const (PackageName . display)
$ fmap (Version . display . ppVersion)
$ bpPackages siPlan
forM_ (mapToList $ cores ++ nonCores) $ \(name, version) -> do
let PackageName nameT = name
insert_ Package
{ packageStackage = sid
, packageName' = name