@@ -32,6 +32,7 @@ import qualified Data.Conduit.List as CL
3232import qualified Data.HashMap.Strict as HashMap
3333import qualified Data.Map as Map
3434import qualified Data.Set as Set
35+ import Data.Time (toGregorian )
3536import qualified Data.Text as T
3637import Data.Text.Encoding (encodeUtf8 )
3738import Data.Yaml (decodeFileEither , ParseException (AesonException ))
@@ -686,10 +687,9 @@ findPackage platform compilerVersion (gpd, loc, localLoc) = do
686687 where
687688 PackageIdentifier name _version = fromCabalPackageIdentifier $ C. package $ C. packageDescription gpd
688689
689- -- | Some hard-coded fixes for build plans, hopefully to be irrelevant over
690- -- time.
690+ -- | Some hard-coded fixes for build plans, only for hysterical raisins.
691691snapshotDefFixes :: SnapshotDef -> SnapshotDef
692- snapshotDefFixes sd | isStackage (sdResolver sd) = sd
692+ snapshotDefFixes sd | isOldStackage (sdResolver sd) = sd
693693 { sdFlags = Map. unionWith Map. union overrides $ sdFlags sd
694694 }
695695 where
@@ -698,8 +698,12 @@ snapshotDefFixes sd | isStackage (sdResolver sd) = sd
698698 , ($ (mkPackageName " yaml" ), Map. singleton $ (mkFlagName " system-libyaml" ) False )
699699 ]
700700
701- isStackage (ResolverSnapshot _) = True
702- isStackage _ = False
701+ -- Only apply this hack to older Stackage snapshots. In
702+ -- particular, nightly-2018-03-13 did not contain these two
703+ -- packages.
704+ isOldStackage (ResolverSnapshot (LTS major _)) = major < 11
705+ isOldStackage (ResolverSnapshot (Nightly (toGregorian -> (year, _, _)))) = year < 2018
706+ isOldStackage _ = False
703707snapshotDefFixes sd = sd
704708
705709-- | Convert a global 'LoadedPackageInfo' to a snapshot one by
0 commit comments