Compare commits
4 Commits
d2efb504b9
...
de66b92631
| Author | SHA1 | Date | |
|---|---|---|---|
| de66b92631 | |||
| fee3984bf7 | |||
| b953c8fd30 | |||
| 24e4c3a19b |
29
HACKING.md
Normal file
29
HACKING.md
Normal file
@ -0,0 +1,29 @@
|
||||
# HACKING
|
||||
|
||||
## Design decisions
|
||||
|
||||
### Using [Excepts](https://hackage.haskell.org/package/haskus-utils-variant-3.0/docs/Haskus-Utils-Variant-Excepts.html) as a beefed up ExceptT
|
||||
|
||||
This is an open variant, similar to [plucky](https://hackage.haskell.org/package/plucky) or [oops](https://github.com/i-am-tom/oops) and allows us to combine different error types. Maybe it is too much and it's a little bit [unergonomic](https://github.com/haskus/packages/issues/32) at times. If it really hurts maintenance, it will be removed. It was more of an experiment.
|
||||
|
||||
### No use of filepath or directory
|
||||
|
||||
Filepath and directory have two fundamental problems: 1. they use String as filepath (see [AFPP](https://gitlab.haskell.org/ghc/ghc/-/wikis/proposal/abstract-file-path) as to why this is wrong) and 2. they try very hard to be cross-platform at the expense of low-level correctness. Instead, we use the [hpath](https://github.com/hasufell/hpath) libraries for file and filepath related stuff, which also gives us stronger filepath types.
|
||||
|
||||
### No use of haskell-TLS
|
||||
|
||||
I consider haskell-TLS an interesting experiment, but not a battle-tested and peer-reviewed crypto implementation. There is little to no research about what the intricacies of using haskell for low-level crypto are and how vulnerable such binaries are. Instead, we use either curl the binary (for FreeBSD and mac) or http-io-streams, which works with OpenSSL bindings.
|
||||
|
||||
### Optics instead of lens
|
||||
|
||||
They're a little safer (less Monoid weirdness with view) and have better error messages. Consider: `view (_Just . to (++ "abc")) Nothing` (lens) vs `view (_Just % to (++ "abc")) Nothing` (optics). The latter does not compile (good).
|
||||
|
||||
### Strict and StrictData on by default
|
||||
|
||||
Kazu Yamamoto [explained it in his PR](https://github.com/yesodweb/wai/pull/752#issuecomment-501531386) very well. I like to agree with him. The instances where we need non-strict behavior, we annotate it.
|
||||
|
||||
## Code style and formatting
|
||||
|
||||
1. Brittany
|
||||
2. mtl-style preferred
|
||||
3. no overly pointfree style
|
||||
11
RELEASING.md
Normal file
11
RELEASING.md
Normal file
@ -0,0 +1,11 @@
|
||||
# RELEASING
|
||||
|
||||
1. update `GHCup.Version` module. `ghcupURL` must only be updated if we change the `_toolRequirements` type or the JSON representation of it. The version of the json represents the change increments. `ghcUpVer` is the current application version.
|
||||
|
||||
2. Add/fix downloads to `GHCupDownloads` module, then run `ghcup-gen gen` to generate the new json and validate it via `ghcup-gen check`.
|
||||
|
||||
3. Commit and git push with tag. Wait for tests to succeed.
|
||||
|
||||
4. Upload the new `ghcup-<ver>.json` to `webhost.haskell.org/ghcup/data/`.
|
||||
|
||||
5. Build ghcup releases for Linux (fully static), mac (with `-fcurl`) and FreeBSD (with `-fcurl`). Upload to `webhost.haskell.org/ghcup/bin/` and update symlinks.
|
||||
@ -986,30 +986,30 @@ cabal_3200_64_darwin = DownloadInfo
|
||||
|
||||
ghcup_010_64_linux :: DownloadInfo
|
||||
ghcup_010_64_linux = DownloadInfo
|
||||
[uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-linux-ghcup-0.1.0|]
|
||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0|]
|
||||
Nothing
|
||||
"e2e124903193551df84679887a5741021f0d67df45442c9d3d2429e83b95aad1"
|
||||
"b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1"
|
||||
|
||||
|
||||
ghcup_010_64_freebsd :: DownloadInfo
|
||||
ghcup_010_64_freebsd = DownloadInfo
|
||||
[uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0|]
|
||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0|]
|
||||
Nothing
|
||||
"c6024c7f2849b6ed83cd683bb0a0e3d5b559aee3fba2ee78ada4f0c9804dbe36"
|
||||
"d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431"
|
||||
|
||||
|
||||
ghcup_010_64_darwin10_13 :: DownloadInfo
|
||||
ghcup_010_64_darwin10_13 = DownloadInfo
|
||||
[uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0|]
|
||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0|]
|
||||
Nothing
|
||||
"39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58"
|
||||
"3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32"
|
||||
|
||||
|
||||
ghcup_010_64_darwin10_14 :: DownloadInfo
|
||||
ghcup_010_64_darwin10_14 = DownloadInfo
|
||||
[uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0|]
|
||||
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0|]
|
||||
Nothing
|
||||
"adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54"
|
||||
"f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9"
|
||||
|
||||
|
||||
|
||||
|
||||
@ -2118,38 +2118,38 @@
|
||||
"A_64": {
|
||||
"FreeBSD": {
|
||||
"unknown_versioning": {
|
||||
"dlHash": "c6024c7f2849b6ed83cd683bb0a0e3d5b559aee3fba2ee78ada4f0c9804dbe36",
|
||||
"dlHash": "d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0"
|
||||
}
|
||||
},
|
||||
"Darwin": {
|
||||
"unknown_versioning": {
|
||||
"dlHash": "39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58",
|
||||
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
||||
},
|
||||
"10.14": {
|
||||
"dlHash": "adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54",
|
||||
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
||||
},
|
||||
"10.13": {
|
||||
"dlHash": "39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58",
|
||||
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
|
||||
},
|
||||
"10.15": {
|
||||
"dlHash": "adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54",
|
||||
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
|
||||
}
|
||||
},
|
||||
"Linux_UnknownLinux": {
|
||||
"unknown_versioning": {
|
||||
"dlHash": "e2e124903193551df84679887a5741021f0d67df45442c9d3d2429e83b95aad1",
|
||||
"dlHash": "b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1",
|
||||
"dlSubdir": null,
|
||||
"dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-linux-ghcup-0.1.0"
|
||||
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ import Prelude hiding ( abs
|
||||
)
|
||||
import System.IO.Error
|
||||
import System.Posix.FilePath ( getSearchPath )
|
||||
import System.Posix.Files.ByteString
|
||||
|
||||
import qualified Data.ByteString as B
|
||||
import qualified Data.Map.Strict as Map
|
||||
@ -694,6 +695,11 @@ upgradeGHCup dls mtarget = do
|
||||
tmp <- lift withGHCupTmpDir
|
||||
let fn = [rel|ghcup|]
|
||||
p <- liftE $ download dli tmp (Just fn)
|
||||
let fileMode' =
|
||||
newFilePerms
|
||||
`unionFileModes` ownerExecuteMode
|
||||
`unionFileModes` groupExecuteMode
|
||||
`unionFileModes` otherExecuteMode
|
||||
case mtarget of
|
||||
Nothing -> do
|
||||
dest <- liftIO $ ghcupBinDir
|
||||
@ -701,11 +707,13 @@ upgradeGHCup dls mtarget = do
|
||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
||||
(dest </> fn)
|
||||
Overwrite
|
||||
liftIO $ setFileMode (toFilePath (dest </> fn)) fileMode'
|
||||
Just fullDest -> do
|
||||
liftIO $ hideError NoSuchThing $ deleteFile fullDest
|
||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
|
||||
fullDest
|
||||
Overwrite
|
||||
liftIO $ setFileMode (toFilePath fullDest) fileMode'
|
||||
pure latestVer
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user