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