Skip to content

Commit 386d539

Browse files
committed
Fix #5543 Filter all LTSs to yield supported LTSs
Currently, `Stack.Init.getRecommendedSnapshots` yields all the snapshots at https://s3.amazonaws.com/haddock.stackage.org/snapshots.json. This pull request filters out the LTS that stack documents that it does not support.
1 parent 403068f commit 386d539

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Stack/Init.hs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,21 @@ checkBundleResolver initOpts snapshotLoc snapCandidate pkgDirs = do
477477
getRecommendedSnapshots :: Snapshots -> NonEmpty SnapName
478478
getRecommendedSnapshots snapshots =
479479
-- in order - Latest LTS, Latest Nightly, all LTS most recent first
480-
case NonEmpty.nonEmpty ltss of
480+
case NonEmpty.nonEmpty supportedLtss of
481481
Just (mostRecent :| older)
482482
-> mostRecent :| (nightly : older)
483483
Nothing
484484
-> nightly :| []
485485
where
486486
ltss = map (uncurry LTS) (IntMap.toDescList $ snapshotsLts snapshots)
487+
supportedLtss = filter (>= minSupportedLts) ltss
487488
nightly = Nightly (snapshotsNightly snapshots)
488489

490+
-- |Yields the minimum LTS supported by stack.
491+
minSupportedLts :: SnapName
492+
minSupportedLts = LTS 3 0 -- See https://github.com/commercialhaskell/stack/blob/master/ChangeLog.md
493+
-- under stack version 2.1.1.
494+
489495
data InitOpts = InitOpts
490496
{ searchDirs :: ![T.Text]
491497
-- ^ List of sub directories to search for .cabal files

0 commit comments

Comments
 (0)