From 22d36737aa2a37edecf6c855e61f82df3c79596b Mon Sep 17 00:00:00 2001 From: Peter Mounce Date: Tue, 11 Oct 2016 09:21:09 +0000 Subject: [PATCH] Changes necessary for releasing 0.3.2 chocolatey package. Note - the chocolatey package to satisfy this has not yet been released, but it _will_ be according to [this trail](https://github.com/userzimmermann/choco-packages/issues/7#issuecomment-252605193) Closes #1905. -- Reviewed-on: https://github.com/bazelbuild/bazel/pull/1905 MOS_MIGRATED_REVID=135774603 --- scripts/packages/chocolatey/.gitignore | 1 + .../packages/chocolatey/bazel.nuspec.template | 2 +- scripts/packages/chocolatey/build.ps1 | 25 +++++++++++-------- .../chocolatey/chocolateyinstall.ps1.template | 3 ++- scripts/packages/chocolatey/test.ps1 | 2 +- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/scripts/packages/chocolatey/.gitignore b/scripts/packages/chocolatey/.gitignore index 1959b85442095d..12bcf8228a9192 100644 --- a/scripts/packages/chocolatey/.gitignore +++ b/scripts/packages/chocolatey/.gitignore @@ -2,5 +2,6 @@ *.zip bazel.nuspec chocolateyinstall.ps1 +chocolateyuninstall.ps1 tools/*.exe tools/LICENSE.txt diff --git a/scripts/packages/chocolatey/bazel.nuspec.template b/scripts/packages/chocolatey/bazel.nuspec.template index 583ce93987b169..7c81c9a9f70fc6 100644 --- a/scripts/packages/chocolatey/bazel.nuspec.template +++ b/scripts/packages/chocolatey/bazel.nuspec.template @@ -76,7 +76,7 @@ Supply like `--params="/option:value ..."` ([see docs for --params](https://gith --> - + diff --git a/scripts/packages/chocolatey/build.ps1 b/scripts/packages/chocolatey/build.ps1 index daa24e12ce4155..032c6c82499199 100644 --- a/scripts/packages/chocolatey/build.ps1 +++ b/scripts/packages/chocolatey/build.ps1 @@ -1,10 +1,10 @@ param( - [string] $version = "0.3.1", + [string] $version = "0.3.2", [switch] $isRelease ) $tvVersion = $version -$tvFilename = "bazel_$($version)_windows_x86_64.zip" +$tvFilename = "bazel-$($version)-windows-x86_64.zip" if ($isRelease) { $tvUri = "https://github.com/bazelbuild/bazel/releases/download/$($version)/$($tvFilename)" } else { @@ -17,14 +17,19 @@ rm -force -ErrorAction SilentlyContinue ./*.zip rm -force -ErrorAction SilentlyContinue ./bazel.nuspec rm -force -ErrorAction SilentlyContinue ./tools/chocolateyinstall.ps1 -Add-Type -A System.IO.Compression.FileSystem -$outputDir = "$pwd/../../../output" -$zipFile = "$pwd/$($tvFilename)" -write-host "Creating zip package with $outputDir/bazel.exe: $zipFile" -Compress-Archive -Path "$outputDir/bazel.exe" -DestinationPath $zipFile -$tvChecksum = (get-filehash $zipFile -algorithm sha256).Hash -write-host "zip sha256: $tvChecksum" - +if ($isRelease) { + Invoke-WebRequest "$($tvUri).sha256" -UseBasicParsing -passthru -outfile sha256.txt + $tvChecksum = (gc sha256.txt).split(' ')[0] + rm sha256.txt +} else { + Add-Type -A System.IO.Compression.FileSystem + $outputDir = "$pwd/../../../output" + $zipFile = "$pwd/$($tvFilename)" + write-host "Creating zip package with $outputDir/bazel.exe: $zipFile" + Compress-Archive -Path "$outputDir/bazel.exe" -DestinationPath $zipFile + $tvChecksum = (get-filehash $zipFile -algorithm sha256).Hash + write-host "zip sha256: $tvChecksum" +} $nuspecTemplate = get-content "bazel.nuspec.template" | out-string $nuspecExpanded = $ExecutionContext.InvokeCommand.ExpandString($nuspecTemplate) add-content -value $nuspecExpanded -path bazel.nuspec diff --git a/scripts/packages/chocolatey/chocolateyinstall.ps1.template b/scripts/packages/chocolatey/chocolateyinstall.ps1.template index 595631e88bbb87..4d12ed270f6e5e 100644 --- a/scripts/packages/chocolatey/chocolateyinstall.ps1.template +++ b/scripts/packages/chocolatey/chocolateyinstall.ps1.template @@ -54,11 +54,12 @@ if (ps_var_packageParameters) } Install-ChocolateyPath -PathToInstall "ps_var_msys2Path\usr\bin" -PathType "Machine" +ps_var_addToMsysPath = (ps_var_packageDir -replace 'c:\\','/c/') -replace '\\','/' write-host @" bazel installed to ps_var_packageDir To use it in msys2, you should add that to your msys2 PATH: - export PATH=ps_var_(ps_var_packageDir):escape_charps_var_PATH + export PATH=ps_var_(ps_var_addToMsysPath):escape_charps_var_PATH You also need, in your msys2 environment: export JAVA_HOME="escape_charps_var_(ls -d C:/Program\ Files/Java/jdk* | sort | tail -n 1)escape_char" diff --git a/scripts/packages/chocolatey/test.ps1 b/scripts/packages/chocolatey/test.ps1 index c6561bdec77574..642cd2b05ea537 100644 --- a/scripts/packages/chocolatey/test.ps1 +++ b/scripts/packages/chocolatey/test.ps1 @@ -1,5 +1,5 @@ param( - [string] $version = "0.3.1" + [string] $version = "0.3.2" ) choco uninstall bazel --force -y