Skip to content

remove filtering 00-index for cabal version < 2.0 hack #1152

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

Merged
merged 1 commit into from
Dec 31, 2022
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