From 9833056b6060385e421a4efd0bb6bb945a17cde7 Mon Sep 17 00:00:00 2001 From: amesgen Date: Sat, 3 Jun 2023 12:03:13 +0200 Subject: [PATCH] Fix `preferred-versions` format Co-authored-by: Andrea Bedini --- app/Foliage/CmdBuild.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Foliage/CmdBuild.hs b/app/Foliage/CmdBuild.hs index cc70fe5..42805ae 100644 --- a/app/Foliage/CmdBuild.hs +++ b/app/Foliage/CmdBuild.hs @@ -320,8 +320,13 @@ getExtraEntries packageVersions = -- Calculate (by applying them chronologically) the effective `VersionRange` for the package group. effectiveRanges :: [(UTCTime, VersionRange)] effectiveRanges = NE.tail $ NE.scanl applyChangeToRange (posixSecondsToUTCTime 0, anyVersion) deprecationChanges + -- Create a `Tar.Entry` for the package group, its computed `VersionRange` and a timestamp. - createTarEntry (ts, effectiveRange) = mkTarEntry (BL.pack $ prettyShow effectiveRange) (IndexPkgPrefs pn) ts + createTarEntry (ts, effectiveRange) = mkTarEntry (BL.pack $ prettyShow dep) (IndexPkgPrefs pn) ts + where + -- Cabal uses `Dependency` to represent preferred versions, cf. + -- `parsePreferredVersions`. The (sub)libraries part is ignored. + dep = mkDependency pn effectiveRange mainLibSet in foldMap generateEntriesForGroup groupedPackageVersions -- TODO: the functions belows should be moved to Foliage.PreparedPackageVersion