Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIndows - update Install-Msys2.ps1 #906

Merged
merged 1 commit into from
May 21, 2020
Merged

Conversation

MSP-Greg
Copy link
Contributor

@MSP-Greg MSP-Greg commented May 20, 2020

Description

  1. Use 20200517 release from GitHub (https) instead of older 20190524 release (http)
  2. Git tar - change paths to full nix style
  3. Git tar - requires exe's from Git/mingw64/bin, set ENV

2 & 3 may not be needed, but if anything changes...

Script will run locally assuming one has Git for Windows installed. Since the base install is much newer, it requires fewer updates to be installed.

Check list

  • Related issue / work item is attached
  • Tests are written (if applicable)
  • Documentation is updated (if applicable)
  • Changes are tested and related VM images are successfully generated

@@ -11,21 +11,25 @@ $origPath = $env:PATH
$gitPath = "$env:ProgramFiles\Git"

# get info from https://sourceforge.net/projects/msys2/files/Base/x86_64/
$msys2Uri = "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20190524.tar.xz"
$msys2Uri = "https://github.com/msys2/msys2-installer/releases/download/2020-05-17/msys2-base-x86_64-20200517.tar.xz"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MSP-Greg , what do you think about reworking it to consume the latest release always?

$latestRelease = Invoke-RestMethod "https://api.github.com/repos/msys2/msys2-installer/releases/latest"
$downloadAsset = $latestRelease.assets | Where-Object { $_.name -match "x86_64" -and $_.name -match "tar.xz" }                         
$msys2Uri = $downloadAsset.browser_download_url

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. Used REST from a lot of languages, but never PS... Collapsed a bit, hate needing to horizontally scroll code windows...

Copy link

@1480c1 1480c1 May 20, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we should install nightly build to image.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two tarballs are the same exact files.

sha256sum msys2-base-x86_64-20200517.tar.xz msys2-base-x86_64-latest.tar.xz
c4443113497acb2d2e285d40b929fc55f33f8f669902595ecdf66a655b63dc60  msys2-base-x86_64-20200517.tar.xz
c4443113497acb2d2e285d40b929fc55f33f8f669902595ecdf66a655b63dc60  msys2-base-x86_64-latest.tar.xz

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two tarballs are the same exact files.

In a month that may not be the case. Although not common, there have been reversions in some packages. Whether that has happened with any 'base' packages, I don't recall. With the update code, both will yield the same set of packages?

@lazka sorry for the ping. For the starting msys2 package for Actions Windows images, would you suggest using

msys2-base-x86_64-20200517.tar.xz

or

msys2-base-x86_64-latest.tar.xz?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@1480c1,
I don't see msys2-base-x86_64-latest.tar.xz file in latest release: https://api.github.com/repos/msys2/msys2-installer/releases/latest
Is there any reason to use nightly-x86_64 tag instead of latest?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

msys2-base-x86_64-latest.tar.xz is in the nightly-x86_64 release

One reason to use nightly-x86_64 is to reduce the number of packages that would need to be updated, depending on how behind the latest release is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not familiar with MSYS2 release scheme but usually stable releases of tool are distributed as a separate GitHub releases, like this one: https://github.com/msys2/msys2-installer/releases/tag/2020-05-17
As I can see, Nightly builds are built based on master branch and just update the single release: https://github.com/msys2/msys2-installer/releases/tag/nightly-x86_64 (it means no changelog, no updates history)

And as it is mentioned in repository, those builds are not tested.
As author mentioned, they publish stable releases as separate tags after "manual testing".

It means that any bug introduced by new changes, will be picked up by nightly build and then will be consumed during image generation.

1. Use Invoke-RestMethod to retrieve most recent msys2 base
2. Git tar  - change paths to full nix style
3. Git tar - requires exe's from Git/mingw64/bin, set ENV

2 & 3 may not be needed, but if anything changes...
Comment on lines -22 to +29
$msys2FileU = "/$msys2File".replace(':', '')
# nix style path for tar
$msys2FileU = "/$msys2File".replace(':', '').replace('\', '/')

# Git tar needs exe's from mingw64\bin
$env:PATH = "$gitPath\usr\bin;$gitPath\mingw64\bin;$origPath"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is 7z available by this time? You can use 7z x to extract the tarball (although not at once like tar)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if one pipes to STDOUT, 7z will extract easily.

But, given that the tar was created by MSYS2 tar, and Git tar is MSYS2, might was well extract with GIT?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to you since both should result in the same output and the only reason why I mentioned 7z is that it supports windows style paths naturally without using msys2 style paths

@al-cheb
Copy link
Contributor

al-cheb commented May 21, 2020

@MSP-Greg,
Thank you for your contribution. We are planning merge the PR due to unblock Windows Server 2019 image generation process - https://github.visualstudio.com/virtual-environments/_build/results?buildId=69714&view=logs&j=011e1ec8-6569-5e69-4f06-baf193d1351e

According to msys2/MSYS2-packages#1965 (comment), we must installing the latest version of msys2 to resolve the current issue. I have checked your script on local machine and it works ax expected.

@maxim-lobanov
Copy link
Contributor

I will merge PR as @al-cheb mentioned, feel free to raise separate issue and discussion about switching to nightly tag

@maxim-lobanov maxim-lobanov merged commit db70284 into actions:master May 21, 2020
@MSP-Greg MSP-Greg deleted the win-msys2 branch May 21, 2020 13:17
@MSP-Greg
Copy link
Contributor Author

@eine

From msys2/MSYS2-packages#1965 (comment), it would imply that lines 48-50 could be removed. Note that the current code in master is using 20200517...

@eine
Copy link

eine commented May 22, 2020

@MSP-Greg, the suggested procedure is two comments below: msys2/MSYS2-packages#1965 (comment) and it involves:

  • Removing 49, modifying 50, and modifying 48 accordingly.
  • Removing 56, modifying 57, and modifying 55 accordingly.

Also, 53 should be modified according to msys2/MSYS2-packages#1962 (comment), because "situation with leftover processes can change in the future".

@eine
Copy link

eine commented May 28, 2020

Ref #355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants