Skip to content

Commit 10e4b9b

Browse files
authored
remove filtering 00-index for cabal version < 2.0 hack (#1152)
Co-authored-by: Gershom Bazerman <[email protected]>
1 parent 59d6dd7 commit 10e4b9b

File tree

1 file changed

+5
-14
lines changed
  • src/Distribution/Server/Packages

1 file changed

+5
-14
lines changed

src/Distribution/Server/Packages/Index.hs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -207,32 +207,23 @@ writeLegacy users =
207207
--
208208
-- This used to live in Distribution.Server.Util.Index.
209209
--
210-
-- NOTE: In order to mitigate the effects of
211-
-- https://github.com/haskell/cabal/issues/4624
212-
-- as a hack, this operation filters out .cabal files
213-
-- with cabal-version >= 2.
214210
writeLegacyAux :: Package pkg
215211
=> (pkg -> ByteString)
216212
-> (pkg -> Tar.Entry -> Tar.Entry)
217213
-> [Tar.Entry]
218214
-> PackageIndex pkg
219215
-> ByteString
220216
writeLegacyAux externalPackageRep updateEntry extras =
221-
Tar.write . (extras++) . mapMaybe entry . PackageIndex.allPackages
217+
Tar.write . (extras++) . map entry . PackageIndex.allPackages
222218
where
223219
-- entry :: pkg -> Maybe Tar.Entry
224-
entry pkg
225-
| specVerGEq2 = Nothing
226-
| otherwise = Just
227-
. updateEntry pkg
228-
. Tar.fileEntry tarPath
229-
$ cabalText
220+
entry pkg =
221+
updateEntry pkg
222+
. Tar.fileEntry tarPath
223+
$ cabalText
230224
where
231225
Right tarPath = Tar.toTarPath False fileName
232226
name = unPackageName $ packageName pkg
233227
fileName = name </> display (packageVersion pkg)
234228
</> name <.> "cabal"
235-
236-
-- TODO: Hack-alert! We want to do this in a more elegant way.
237-
specVerGEq2 = maybe False (>= CabalSpecV2_0) $ parseSpecVerLazy cabalText
238229
cabalText = externalPackageRep pkg

0 commit comments

Comments
 (0)