Compare commits

..

No commits in common. "de66b92631385ea70dbe0ed1c47fcb28c2c49fd6" and "d2efb504b937738ecf3df27c835001f4e6e17d19" have entirely different histories.

5 changed files with 20 additions and 68 deletions

View File

@ -1,29 +0,0 @@
# 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

View File

@ -1,11 +0,0 @@
# 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.

View File

@ -986,30 +986,30 @@ cabal_3200_64_darwin = DownloadInfo
ghcup_010_64_linux :: DownloadInfo ghcup_010_64_linux :: DownloadInfo
ghcup_010_64_linux = DownloadInfo ghcup_010_64_linux = DownloadInfo
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0|] [uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-linux-ghcup-0.1.0|]
Nothing Nothing
"b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1" "e2e124903193551df84679887a5741021f0d67df45442c9d3d2429e83b95aad1"
ghcup_010_64_freebsd :: DownloadInfo ghcup_010_64_freebsd :: DownloadInfo
ghcup_010_64_freebsd = DownloadInfo ghcup_010_64_freebsd = DownloadInfo
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0|] [uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0|]
Nothing Nothing
"d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431" "c6024c7f2849b6ed83cd683bb0a0e3d5b559aee3fba2ee78ada4f0c9804dbe36"
ghcup_010_64_darwin10_13 :: DownloadInfo ghcup_010_64_darwin10_13 :: DownloadInfo
ghcup_010_64_darwin10_13 = DownloadInfo ghcup_010_64_darwin10_13 = DownloadInfo
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0|] [uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0|]
Nothing Nothing
"3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32" "39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58"
ghcup_010_64_darwin10_14 :: DownloadInfo ghcup_010_64_darwin10_14 :: DownloadInfo
ghcup_010_64_darwin10_14 = DownloadInfo ghcup_010_64_darwin10_14 = DownloadInfo
[uri|https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0|] [uri|https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0|]
Nothing Nothing
"f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9" "adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54"

View File

@ -2118,38 +2118,38 @@
"A_64": { "A_64": {
"FreeBSD": { "FreeBSD": {
"unknown_versioning": { "unknown_versioning": {
"dlHash": "d300e36beb63eb5199169b669cc0550e581d871f404f2ce1a2581829c1d2f431", "dlHash": "c6024c7f2849b6ed83cd683bb0a0e3d5b559aee3fba2ee78ada4f0c9804dbe36",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-portbld-freebsd-ghcup-0.1.0"
} }
}, },
"Darwin": { "Darwin": {
"unknown_versioning": { "unknown_versioning": {
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32", "dlHash": "39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
}, },
"10.14": { "10.14": {
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9", "dlHash": "adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
}, },
"10.13": { "10.13": {
"dlHash": "3f8fd787c25f6b9b990c968f79c423036155733d7ec8531a84e2cda874e26a32", "dlHash": "39b96cd984b6e8393bcb93eaeab2f4648e7ef4e4547afe623283774643eede58",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.13-ghcup-0.1.0"
}, },
"10.15": { "10.15": {
"dlHash": "f89fadbecabae0aeb97ed33687c133845dffc0530a9a71a408024e6bbebf46c9", "dlHash": "adfcf500f0414951685e53f72bbc9c1e3b2f41c06e562ed3f63fbd645bf61e54",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-apple-darwin-10.14-ghcup-0.1.0"
} }
}, },
"Linux_UnknownLinux": { "Linux_UnknownLinux": {
"unknown_versioning": { "unknown_versioning": {
"dlHash": "b2dc576926c74336805a30c647056eeb1b4204742bcfc5c51680d4e7c34b87a1", "dlHash": "e2e124903193551df84679887a5741021f0d67df45442c9d3d2429e83b95aad1",
"dlSubdir": null, "dlSubdir": null,
"dlUri": "https://github.com/hasufell/ghcup-hs/releases/download/v0.1.0/x86_64-linux-ghcup-0.1.0" "dlUri": "https://www.haskell.org/ghcup/bin/0.1.0/x86_64-linux-ghcup-0.1.0"
} }
} }
} }

View File

@ -53,7 +53,6 @@ import Prelude hiding ( abs
) )
import System.IO.Error import System.IO.Error
import System.Posix.FilePath ( getSearchPath ) import System.Posix.FilePath ( getSearchPath )
import System.Posix.Files.ByteString
import qualified Data.ByteString as B import qualified Data.ByteString as B
import qualified Data.Map.Strict as Map import qualified Data.Map.Strict as Map
@ -695,11 +694,6 @@ upgradeGHCup dls mtarget = do
tmp <- lift withGHCupTmpDir tmp <- lift withGHCupTmpDir
let fn = [rel|ghcup|] let fn = [rel|ghcup|]
p <- liftE $ download dli tmp (Just fn) p <- liftE $ download dli tmp (Just fn)
let fileMode' =
newFilePerms
`unionFileModes` ownerExecuteMode
`unionFileModes` groupExecuteMode
`unionFileModes` otherExecuteMode
case mtarget of case mtarget of
Nothing -> do Nothing -> do
dest <- liftIO $ ghcupBinDir dest <- liftIO $ ghcupBinDir
@ -707,13 +701,11 @@ upgradeGHCup dls mtarget = do
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
(dest </> fn) (dest </> fn)
Overwrite Overwrite
liftIO $ setFileMode (toFilePath (dest </> fn)) fileMode'
Just fullDest -> do Just fullDest -> do
liftIO $ hideError NoSuchThing $ deleteFile fullDest liftIO $ hideError NoSuchThing $ deleteFile fullDest
handleIO (throwE . CopyError . show) $ liftIO $ copyFile p handleIO (throwE . CopyError . show) $ liftIO $ copyFile p
fullDest fullDest
Overwrite Overwrite
liftIO $ setFileMode (toFilePath fullDest) fileMode'
pure latestVer pure latestVer