Skip to content

Commit d94ce2a

Browse files
committed
Merge branch 'issue-1213'
2 parents ecd41e0 + e017d93 commit d94ce2a

File tree

29 files changed

+151
-111
lines changed

29 files changed

+151
-111
lines changed

.github/workflows/release.yaml

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,6 @@ jobs:
9292
strategy:
9393
matrix:
9494
include:
95-
- os: [self-hosted, Linux, ARM64, maerwald]
96-
ARTIFACT: "armv7-linux-ghcup"
97-
GHC_VER: 9.2.8
98-
ARCH: ARM
99-
DISTRO: Debian
10095
- os: [self-hosted, Linux, ARM64, maerwald]
10196
ARTIFACT: "aarch64-linux-ghcup"
10297
GHC_VER: 9.8.4
@@ -113,21 +108,6 @@ jobs:
113108
with:
114109
submodules: 'true'
115110

116-
- if: matrix.ARCH == 'ARM'
117-
uses: docker://hasufell/arm32v7-debian-haskell:10
118-
name: Run build (armv7 linux)
119-
with:
120-
args: sh .github/scripts/build.sh
121-
env:
122-
ARTIFACT: ${{ matrix.ARTIFACT }}
123-
ARCH: ${{ matrix.ARCH }}
124-
GHC_VER: ${{ matrix.GHC_VER }}
125-
DISTRO: ${{ matrix.DISTRO }}
126-
AWS_SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }}
127-
AWS_ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }}
128-
S3_HOST: ${{ env.S3_HOST }}
129-
LD: ld.gold
130-
131111
- if: matrix.ARCH == 'ARM64'
132112
uses: docker://hasufell/arm64v8-alpine-haskell:3.20
133113
name: Run build (aarch64 linux)
@@ -367,11 +347,6 @@ jobs:
367347
strategy:
368348
matrix:
369349
include:
370-
- os: [self-hosted, Linux, ARM64, maerwald]
371-
ARTIFACT: "armv7-linux-ghcup"
372-
GHC_VER: 9.2.8
373-
ARCH: ARM
374-
DISTRO: Debian
375350
- os: [self-hosted, Linux, ARM64, maerwald]
376351
ARTIFACT: "aarch64-linux-ghcup"
377352
GHC_VER: 9.8.4
@@ -389,18 +364,6 @@ jobs:
389364
name: artifacts
390365
path: ./out
391366

392-
- if: matrix.ARCH == 'ARM'
393-
uses: docker://hasufell/arm32v7-debian-haskell:10
394-
name: Run test (armv7 linux)
395-
with:
396-
args: sh .github/scripts/test.sh
397-
env:
398-
ARTIFACT: ${{ matrix.ARTIFACT }}
399-
ARCH: ${{ matrix.ARCH }}
400-
GHC_VER: ${{ matrix.GHC_VER }}
401-
DISTRO: ${{ matrix.DISTRO }}
402-
LD: ld.gold
403-
404367
- if: matrix.ARCH == 'ARM64'
405368
uses: docker://hasufell/arm64v8-alpine-haskell:3.20
406369
name: Run test (aarch64 alpine)

cabal.project.release

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ package ghcup
1010
flags: +tui
1111

1212
if os(linux)
13+
package ghcup
14+
flags: +yaml-streamly
1315
constraints: xz -system-xz
1416
if arch(x86_64) || arch(i386)
1517
flags: -tar
@@ -20,10 +22,14 @@ if os(linux)
2022
else
2123
flags: -tar
2224
elif os(darwin)
25+
package ghcup
26+
flags: +yaml-streamly
2327
flags: -tar
2428
constraints: zlib +bundled-c-zlib,
2529
xz -system-xz
2630
elif os(mingw32)
31+
package ghcup
32+
flags: +yaml-streamly
2733
flags: -tar
2834
constraints: xz -system-xz
2935
elif os(freebsd)

ghcup.cabal

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ flag tar
7777
default: False
7878
manual: True
7979

80+
flag yaml-streamly
81+
description: Use yaml-streamly instead of yaml (based on conduit)
82+
default: False
83+
manual: True
84+
8085
common app-common-depends
8186
build-depends:
8287
, aeson >=1.4
@@ -111,7 +116,13 @@ common app-common-depends
111116
, utf8-string ^>=1.0
112117
, vector >=0.12 && <0.14
113118
, versions >=6.0.5 && <6.1
114-
, yaml ^>=0.11.0
119+
120+
if flag(yaml-streamly)
121+
build-depends:
122+
yaml-streamly ^>=0.12.5
123+
else
124+
build-depends:
125+
yaml ^>=0.11.0
115126

116127
if flag(tar)
117128
cpp-options: -DTAR
@@ -242,9 +253,15 @@ library
242253
, vector >=0.12 && <0.14
243254
, versions >=6.0.5 && <6.1
244255
, word8 ^>=0.1.3
245-
, yaml ^>=0.11.0
246256
, zlib ^>=0.6.2.2 || ^>=0.7
247257

258+
if flag(yaml-streamly)
259+
build-depends:
260+
yaml-streamly ^>=0.12.5
261+
else
262+
build-depends:
263+
yaml ^>=0.11.0
264+
248265
if flag(tar)
249266
cpp-options: -DTAR
250267
build-depends:
@@ -451,6 +468,7 @@ test-suite ghcup-test
451468
GHCup.Prelude.File.Posix.TraversalsSpec
452469
GHCup.Types.JSONSpec
453470
GHCup.Utils.FileSpec
471+
GHCup.ParserSpec
454472
Spec
455473

456474
default-language: Haskell2010
@@ -477,6 +495,7 @@ test-suite ghcup-test
477495
, ghcup
478496
, hspec >=2.7.10 && <2.12
479497
, hspec-golden-aeson ^>=0.9
498+
, megaparsec >=8.0.0 && <9.8
480499
, QuickCheck ^>=2.14.1 || ^>=2.15
481500
, quickcheck-arbitrary-adt ^>=0.3.1.0
482501
, text ^>=2.0 || ^>=2.1

lib-opt/GHCup/OptParse/Compile.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,7 @@ type GHCEffects = '[ AlreadyInstalled
479479
, BuildFailed
480480
, UninstallFailed
481481
, MergeFileTreeError
482+
, URIParseError
482483
]
483484
type HLSEffects = '[ AlreadyInstalled
484485
, BuildFailed
@@ -501,6 +502,7 @@ type HLSEffects = '[ AlreadyInstalled
501502
, ArchiveResult
502503
, UninstallFailed
503504
, MergeFileTreeError
505+
, URIParseError
504506
]
505507

506508

lib-opt/GHCup/OptParse/Install.hs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ type InstallEffects = '[ AlreadyInstalled
259259
, UninstallFailed
260260
, MergeFileTreeError
261261
, InstallSetError
262+
, URIParseError
262263
]
263264

264265

@@ -300,6 +301,7 @@ type InstallGHCEffects = '[ AlreadyInstalled
300301
, UnsupportedSetupCombo
301302
, DistroNotFound
302303
, NoCompatibleArch
304+
, URIParseError
303305
]
304306

305307
runInstGHC :: AppState
@@ -355,7 +357,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
355357
"...waiting for 5 seconds, you can still abort..."
356358
liftIO $ threadDelay 5000000 -- give the user a sec to intervene
357359
liftE $ runBothE' (installGHCBindist
358-
(DownloadInfo uri (Just $ RegexDir "ghc-.*") "" Nothing Nothing Nothing)
360+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) (Just $ RegexDir "ghc-.*") "" Nothing Nothing Nothing)
359361
v
360362
(maybe GHCupInternal IsolateDir isolateDir)
361363
forceInstall
@@ -435,7 +437,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
435437
"...waiting for 5 seconds, you can still abort..."
436438
liftIO $ threadDelay 5000000 -- give the user a sec to intervene
437439
liftE $ runBothE' (installCabalBindist
438-
(DownloadInfo uri Nothing "" Nothing Nothing Nothing)
440+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) Nothing "" Nothing Nothing Nothing)
439441
v
440442
(maybe GHCupInternal IsolateDir isolateDir)
441443
forceInstall
@@ -495,7 +497,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
495497
liftIO $ threadDelay 5000000 -- give the user a sec to intervene
496498
-- TODO: support legacy
497499
liftE $ runBothE' (installHLSBindist
498-
(DownloadInfo uri (if isWindows then Nothing else Just (RegexDir "haskell-language-server-*")) "" Nothing Nothing Nothing)
500+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) (if isWindows then Nothing else Just (RegexDir "haskell-language-server-*")) "" Nothing Nothing Nothing)
499501
v
500502
(maybe GHCupInternal IsolateDir isolateDir)
501503
forceInstall
@@ -554,7 +556,7 @@ install installCommand settings getAppState' runLogger = case installCommand of
554556
"...waiting for 5 seconds, you can still abort..."
555557
liftIO $ threadDelay 5000000 -- give the user a sec to intervene
556558
liftE $ runBothE' (installStackBindist
557-
(DownloadInfo uri Nothing "" Nothing Nothing Nothing)
559+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) Nothing "" Nothing Nothing Nothing)
558560
v
559561
(maybe GHCupInternal IsolateDir isolateDir)
560562
forceInstall

lib-opt/GHCup/OptParse/Prefetch.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ type PrefetchEffects = '[ TagNotFound
162162
, JSONError
163163
, FileDoesNotExistError
164164
, StackPlatformDetectError
165+
, URIParseError
165166
]
166167

167168

lib-opt/GHCup/OptParse/Run.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ type RunEffects = '[ AlreadyInstalled
193193
, UnsupportedSetupCombo
194194
, DistroNotFound
195195
, NoCompatibleArch
196+
, URIParseError
196197
]
197198

198199
runLeanRUN :: (MonadUnliftIO m, MonadIO m)
@@ -370,6 +371,7 @@ run RunOptions{..} runAppState leanAppstate runLogger = do
370371
, UnsupportedSetupCombo
371372
, DistroNotFound
372373
, NoCompatibleArch
374+
, URIParseError
373375
] (ResourceT (ReaderT AppState m)) ()
374376
installToolChainFull Toolchain{..} tmp = do
375377
case ghcVer of

lib-opt/GHCup/OptParse/Test.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import GHCup.Errors
2121
import GHCup.Types
2222
import GHCup.Utils.Dirs
2323
import GHCup.Utils.Parsers (fromVersion, uriParser)
24+
import GHCup.Prelude
2425
import GHCup.Prelude.Logger
2526
import GHCup.Prelude.String.QQ
2627

@@ -142,6 +143,7 @@ type TestGHCEffects = [ DigestError
142143
, TagNotFound
143144
, DayNotFound
144145
, NoToolVersionSet
146+
, URIParseError
145147
]
146148

147149
runTestGHC :: AppState
@@ -174,7 +176,7 @@ test testCommand settings getAppState' runLogger = case testCommand of
174176
Just uri -> do
175177
runTestGHC s'{ settings = settings {noVerify = True}} $ do
176178
(v, vi) <- liftE $ fromVersion testVer GHC
177-
liftE $ testGHCBindist (DownloadInfo uri (Just $ RegexDir ".*/.*") "" Nothing Nothing Nothing) v addMakeArgs
179+
liftE $ testGHCBindist (DownloadInfo ((decUTF8Safe . serializeURIRef') uri) (Just $ RegexDir ".*/.*") "" Nothing Nothing Nothing) v addMakeArgs
178180
pure vi
179181
)
180182
>>= \case

lib-opt/GHCup/OptParse/Upgrade.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ type UpgradeEffects = '[ DigestError
9797
, CopyError
9898
, DownloadFailed
9999
, ToolShadowed
100+
, URIParseError
100101
]
101102

102103

lib-tui/GHCup/Brick/Actions.hs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ installWithOptions opts (_, ListResult {..}) = do
225225
, DistroNotFound
226226
, NoCompatibleArch
227227
, InstallSetError
228+
, URIParseError
228229
]
229230

230231
withNoVerify :: (MonadReader AppState m) => m a -> m a
@@ -248,7 +249,7 @@ installWithOptions opts (_, ListResult {..}) = do
248249
liftE $
249250
runBothE'
250251
(withNoVerify $ installGHCBindist
251-
(DownloadInfo uri (Just $ RegexDir "ghc-.*") "" Nothing Nothing Nothing)
252+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) (Just $ RegexDir "ghc-.*") "" Nothing Nothing Nothing)
252253
v
253254
shouldIsolate
254255
shouldForce
@@ -268,7 +269,7 @@ installWithOptions opts (_, ListResult {..}) = do
268269
Just uri -> do
269270
liftE $
270271
runBothE'
271-
(withNoVerify $ installCabalBindist (DownloadInfo uri Nothing "" Nothing Nothing Nothing) toolV shouldIsolate shouldForce)
272+
(withNoVerify $ installCabalBindist (DownloadInfo ((decUTF8Safe . serializeURIRef') uri) Nothing "" Nothing Nothing Nothing) toolV shouldIsolate shouldForce)
272273
(when (shouldSet && isNothing misolated) (liftE $ void $ setCabal toolV))
273274
pure (vi, dirs, ce)
274275

@@ -288,7 +289,7 @@ installWithOptions opts (_, ListResult {..}) = do
288289
liftE $
289290
runBothE'
290291
(withNoVerify $ installHLSBindist
291-
(DownloadInfo uri (if isWindows then Nothing else Just (RegexDir "haskell-language-server-*")) "" Nothing Nothing Nothing)
292+
(DownloadInfo ((decUTF8Safe . serializeURIRef') uri) (if isWindows then Nothing else Just (RegexDir "haskell-language-server-*")) "" Nothing Nothing Nothing)
292293
toolV
293294
shouldIsolate
294295
shouldForce)
@@ -307,7 +308,7 @@ installWithOptions opts (_, ListResult {..}) = do
307308
Just uri -> do
308309
liftE $
309310
runBothE'
310-
(withNoVerify $ installStackBindist (DownloadInfo uri Nothing "" Nothing Nothing Nothing) toolV shouldIsolate shouldForce)
311+
(withNoVerify $ installStackBindist (DownloadInfo ((decUTF8Safe . serializeURIRef') uri) Nothing "" Nothing Nothing Nothing) toolV shouldIsolate shouldForce)
311312
(when (shouldSet && isNothing misolated) (liftE $ void $ setStack toolV))
312313
pure (vi, dirs, ce)
313314

@@ -377,6 +378,7 @@ set' input@(_, ListResult {..}) = do
377378
, UnsupportedSetupCombo
378379
, DistroNotFound
379380
, NoCompatibleArch
381+
, URIParseError
380382
]
381383

382384
run (do
@@ -506,6 +508,7 @@ compileGHC compopts (_, lr@ListResult{lTool = GHC, ..}) = do
506508
, BuildFailed
507509
, UninstallFailed
508510
, MergeFileTreeError
511+
, URIParseError
509512
]
510513
compileResult <- run (do
511514
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask
@@ -595,6 +598,7 @@ compileHLS compopts (_, lr@ListResult{lTool = HLS, ..}) = do
595598
, ArchiveResult
596599
, UninstallFailed
597600
, MergeFileTreeError
601+
, URIParseError
598602
]
599603
compileResult <- run (do
600604
AppState { ghcupInfo = GHCupInfo { _ghcupDownloads = dls }} <- ask

lib/GHCup.hs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ fetchToolBindist :: ( MonadFail m
109109
, GPGError
110110
, DownloadFailed
111111
, NoDownload
112+
, URIParseError
112113
]
113114
m
114115
FilePath
@@ -302,6 +303,7 @@ upgradeGHCup :: ( MonadMask m
302303
, NoDownload
303304
, NoUpdate
304305
, ToolShadowed
306+
, URIParseError
305307
]
306308
m
307309
Version
@@ -342,6 +344,7 @@ upgradeGHCup' :: ( MonadMask m
342344
, NoDownload
343345
, NoUpdate
344346
, ToolShadowed
347+
, URIParseError
345348
]
346349
m
347350
Version
@@ -353,7 +356,8 @@ upgradeGHCup' mtarget force' fatal latestVer = do
353356
dli <- liftE $ getDownloadInfo GHCup latestVer
354357
tmp <- fromGHCupPath <$> lift withGHCupTmpDir
355358
let fn = "ghcup" <> exeExt
356-
p <- liftE $ download (_dlUri dli) Nothing (Just (_dlHash dli)) (_dlCSize dli) tmp (Just fn) False
359+
dlu <- lE $ parseURI' (_dlUri dli)
360+
p <- liftE $ download dlu Nothing (Just (_dlHash dli)) (_dlCSize dli) tmp (Just fn) False
357361
let destDir = takeDirectory destFile
358362
destFile = fromMaybe (binDir </> fn) mtarget
359363
lift $ logDebug $ "mkdir -p " <> T.pack destDir

lib/GHCup/Cabal.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ installCabalBindist :: ( MonadMask m
8989
, TarDirDoesNotExist
9090
, ArchiveResult
9191
, FileAlreadyExistsError
92+
, URIParseError
9293
]
9394
m
9495
()
@@ -193,6 +194,7 @@ installCabalBin :: ( MonadMask m
193194
, TarDirDoesNotExist
194195
, ArchiveResult
195196
, FileAlreadyExistsError
197+
, URIParseError
196198
]
197199
m
198200
()

0 commit comments

Comments
 (0)