|
1 | 1 | <div class="hidden-warning"><a href="https://docs.haskellstack.org/"><img src="https://cdn.jsdelivr.net/gh/commercialhaskell/stack/doc/img/hidden-warning.svg"></a></div>
|
2 | 2 |
|
3 |
| -# Upgrading msys |
| 3 | +# Upgrading MSYS2 |
4 | 4 |
|
5 | 5 | When installing GHC on Windows, Stack will also install
|
6 |
| -[msys2](http://www.msys2.org/) to provide a Unix shell and environment, |
7 |
| -necessary for such things as running configure scripts. This section explains |
8 |
| -the steps required to upgrade the msys2 version used by Stack. |
| 6 | +[MSYS2](http://www.msys2.org/). MSYS2 provides a Unix shell and environment, and |
| 7 | +is necessary for such things as running configure scripts. This section explains |
| 8 | +the steps required to upgrade the MSYS2 version used by Stack. |
9 | 9 |
|
10 |
| -1. Download latest installers from msys2's website. These installers are |
11 |
| - executables, versioned by date (YYYYMMDD), and are separate for `x86_64` |
12 |
| - and `i686`. You'll usually be upgrading both at the same time, which we'll |
13 |
| - assume here. |
| 10 | +1. Download latest installer(s) from MSYS2's website. Historically, there were |
| 11 | + separate installers for 32 bit (`i686`) and 64 bit (`x86_64`). On |
| 12 | + 17 May 2020, the MSYS2 project announced it did not plan to release any |
| 13 | + further `i686` installers. An installer is an executable, versioned by a |
| 14 | + date in the format YYYYMMDD - for example, `msys2-x86_64-20220503.exe`. |
14 | 15 |
|
15 |
| -2. Run the installer and install to the default location (`c:\msys64` and |
16 |
| - `c:\msys32`, respectively). |
| 16 | +2. Run the installer and install to the default location (`C:\msys64` for the |
| 17 | + 64 bit version; the location for the 32 bit version was `C:\msys32`). Do not |
| 18 | + use the installed version; it will create a `.bash_history` file if you do. |
17 | 19 |
|
18 |
| -3. Create tarballs for each directory: |
| 20 | +3. Create a tarball for each relevant directory (eg `C:\msys64`). That requires |
| 21 | + a version of [`tar`](https://www.gnu.org/software/tar/tar.html) that |
| 22 | + supports the compression option `--xz`. The version of `tar` that is |
| 23 | + supplied with Windows (`C:\Windows\System32\tar.exe`) does not support that |
| 24 | + option, but MSYS2 can supply a [version](https://packages.msys2.org/package/tar) |
| 25 | + that does (using its `pacman` tool). Using the existing Stack-supplied |
| 26 | + MSYS2, in PowerShell and located in a folder with write permissions (so the `.tar.xz` file can be created): |
19 | 27 |
|
20 | 28 | ```
|
21 |
| - $ cd /c/ |
22 |
| - $ tar cJf msys2-YYYYMMDD-x86_64.tar.xz msys64 |
23 |
| - $ tar cJf msys2-YYYYMMDD-i686.tar.xz msys32 |
| 29 | + > stack exec -- pacman -S tar |
| 30 | + > stack exec -- tar cJf msys2-YYYYMMDD-x86_64.tar.xz C:\msys64 |
24 | 31 | ```
|
25 | 32 |
|
26 |
| -4. Create a new release named `msys2-YYYYMMDD` on the |
27 |
| - [fpco/stackage-content](https://github.com/fpco/stackage-content) |
28 |
| - repo, and upload these two files. |
| 33 | +4. Create a new release tagged and named `msys2-YYYYMMDD` in the `master` |
| 34 | + branch of the [commercialhaskell/stackage-content](https://github.com/commericalhaskell/stackage-content) |
| 35 | + GitHub repository, uploading the tarball file(s) into that release. |
29 | 36 |
|
30 |
| -5. Create a PR for the [stack-setup-2.yaml file](https://github.com/fpco/stackage-content/blob/master/stack/stack-setup-2.yaml) |
31 |
| - to switch over to using the newly uploaded files. You should test this file locally first. |
| 37 | +5. Changes need to be made to the [stackage-content/stack/stack-setup-2.yaml](https://github.com/commercialhaskell/stackage-content/blob/master/stack/stack-setup-2.yaml) |
| 38 | + file, to switch over to using the newly uploaded files. For example |
| 39 | + (extract): |
| 40 | +
|
| 41 | + ~~~yaml |
| 42 | + # For upgrade instructions, see: https://github.com/commercialhaskell/stack/blob/stable/doc/maintainers/msys.md |
| 43 | + msys2: |
| 44 | + windows32: |
| 45 | + version: "20200517" |
| 46 | + url: "https://github.com/fpco/stackage-content/releases/download/20200517/msys2-20200517-i686.tar.xz" |
| 47 | + content-length: 79049224 |
| 48 | + sha256: 9152ddf50c6bacfae33c1436338235f8db4b10d73aaea63adefd96731fb0bceb |
| 49 | + windows64: |
| 50 | + version: "20220503" |
| 51 | + url: "https://github.com/commercialhaskell/stackage-content/releases/download/msys2-20220503/msys2-20220503-x86_64.tar.xz" |
| 52 | + content-length: 93835868 |
| 53 | + sha256: c918f66e984f70add313ee3a5c5b101132cd93d5a3f8e3555e129e2d3dcb3718 |
| 54 | + ~~~ |
| 55 | +
|
| 56 | + The `content-length:` key's value is the size of the file in bytes. It can |
| 57 | + be obtained from the `Length` field of the `dir` command. The `sha256:` |
| 58 | + key's value can be obtained from the command (in PowerShell): |
| 59 | +
|
| 60 | + ~~~ |
| 61 | + ❯ (Get-FileHash msys2-YYYYMMDD-x86_64.tar.xz -Algorithm SHA256).Hash.ToLower() |
| 62 | + ~~~ |
| 63 | +
|
| 64 | + The `sha256:` key only accepts lowercase hash results as values. |
| 65 | +
|
| 66 | +6. The changed `stack-setup-2.yaml` file should be tested locally. This can be |
| 67 | + done by: |
| 68 | +
|
| 69 | + * temporarily disabling the existing local copy of MSYS2 by changing the |
| 70 | + name of the `msys2-YYYYMMDD.installed` file in the `stack path --programs` directory; and |
| 71 | +
|
| 72 | + * executing the command: |
| 73 | +
|
| 74 | + ~~~ |
| 75 | + > stack setup --setup-info-yaml <path to local copy of stack-setup-2.yaml> |
| 76 | + ~~~ |
| 77 | +
|
| 78 | + If all is well, the command should proceed to download the updated version |
| 79 | + of MSYS2 that has been specified. |
| 80 | +
|
| 81 | +7. Raise a pull request on `commercialhaskell/stackage-contents` for the |
| 82 | + changes to the locally-tested `stack-setup-2.yaml` file. |
0 commit comments