Skip to content

Commit 6da33ca

Browse files
authored
Merge pull request commercialhaskell#5104 from ppzzppz/stable
fix "--resolver global " needs network
2 parents 9045157 + d9a7a8d commit 6da33ca

2 files changed

Lines changed: 12 additions & 8 deletions

File tree

ChangeLog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ Other enhancements:
1717

1818
Bug fixes:
1919

20+
* `--resolver global` doesn't retrieve snapshots list from the internet
21+
beause doesn't need it. See [#5103](https://github.com/commercialhaskell/stack/issues/5103)
22+
2023
* Fix using relative links in haddocks output. See
2124
[#4971](https://github.com/commercialhaskell/stack/issues/4971).
2225
* Do not include generated cabal file information in lock files. See

src/Stack/Config.hs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ makeConcreteResolver
146146
-> RIO env RawSnapshotLocation
147147
makeConcreteResolver (ARResolver r) = pure r
148148
makeConcreteResolver ar = do
149-
snapshots <- getSnapshots
150149
r <-
151150
case ar of
152151
ARResolver r -> assert False $ makeConcreteResolver (ARResolver r)
@@ -157,16 +156,18 @@ makeConcreteResolver ar = do
157156
iopc <- loadConfigYaml (parseProjectAndConfigMonoid (parent fp)) fp
158157
ProjectAndConfigMonoid project _ <- liftIO iopc
159158
return $ projectResolver project
160-
ARLatestNightly -> return $ nightlySnapshotLocation $ snapshotsNightly snapshots
161-
ARLatestLTSMajor x ->
159+
ARLatestNightly -> nightlySnapshotLocation . snapshotsNightly <$> getSnapshots
160+
ARLatestLTSMajor x -> do
161+
snapshots <- getSnapshots
162162
case IntMap.lookup x $ snapshotsLts snapshots of
163163
Nothing -> throwString $ "No LTS release found with major version " ++ show x
164164
Just y -> return $ ltsSnapshotLocation x y
165-
ARLatestLTS
166-
| IntMap.null $ snapshotsLts snapshots -> throwString "No LTS releases found"
167-
| otherwise ->
168-
let (x, y) = IntMap.findMax $ snapshotsLts snapshots
169-
in return $ ltsSnapshotLocation x y
165+
ARLatestLTS -> do
166+
snapshots <- getSnapshots
167+
if IntMap.null $ snapshotsLts snapshots
168+
then throwString "No LTS releases found"
169+
else let (x, y) = IntMap.findMax $ snapshotsLts snapshots
170+
in return $ ltsSnapshotLocation x y
170171
logInfo $ "Selected resolver: " <> display r
171172
return r
172173

0 commit comments

Comments
 (0)