Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions src/Distribution/Server/Packages/Index.hs
Original file line number Diff line number Diff line change
Expand Up @@ -207,32 +207,23 @@ writeLegacy users =
--
-- This used to live in Distribution.Server.Util.Index.
--
-- NOTE: In order to mitigate the effects of
-- https://github.com/haskell/cabal/issues/4624
-- as a hack, this operation filters out .cabal files
-- with cabal-version >= 2.
writeLegacyAux :: Package pkg
=> (pkg -> ByteString)
-> (pkg -> Tar.Entry -> Tar.Entry)
-> [Tar.Entry]
-> PackageIndex pkg
-> ByteString
writeLegacyAux externalPackageRep updateEntry extras =
Tar.write . (extras++) . mapMaybe entry . PackageIndex.allPackages
Tar.write . (extras++) . map entry . PackageIndex.allPackages
where
-- entry :: pkg -> Maybe Tar.Entry
entry pkg
| specVerGEq2 = Nothing
| otherwise = Just
. updateEntry pkg
. Tar.fileEntry tarPath
$ cabalText
entry pkg =
updateEntry pkg
. Tar.fileEntry tarPath
$ cabalText
where
Right tarPath = Tar.toTarPath False fileName
name = unPackageName $ packageName pkg
fileName = name </> display (packageVersion pkg)
</> name <.> "cabal"

-- TODO: Hack-alert! We want to do this in a more elegant way.
specVerGEq2 = maybe False (>= CabalSpecV2_0) $ parseSpecVerLazy cabalText
cabalText = externalPackageRep pkg