diff options
author | Peter Mounce <petermounce@improbable.io> | 2017-03-21 13:22:06 +0000 |
---|---|---|
committer | Yue Gan <yueg@google.com> | 2017-03-22 10:52:59 +0000 |
commit | 8bd552261833a1887a281401c56d269c6594f8ef (patch) | |
tree | 571517ecf3b7dfbc132c7df167c6136c4f6090e0 /scripts/packages | |
parent | 184f3c8dfc57490c2d34e490641dcb12ea78c4d3 (diff) |
Parse params via a built-in, and lock msys2 version
@laszlocsomor - This addresses https://github.com/bazelbuild/bazel/issues/2449#issuecomment-278059161.
Note - this is _not_ in the 0.4.5 package, since I was waiting for that release to go out prior to this.
Closes #2690.
--
Reviewed-on: https://github.com/bazelbuild/bazel/pull/2690
PiperOrigin-RevId: 150745085
MOS_MIGRATED_REVID=150745085
Diffstat (limited to 'scripts/packages')
-rw-r--r-- | scripts/packages/chocolatey/bazel.nuspec.template | 5 | ||||
-rw-r--r-- | scripts/packages/chocolatey/tools/chocolateyinstall.ps1 | 33 |
2 files changed, 6 insertions, 32 deletions
diff --git a/scripts/packages/chocolatey/bazel.nuspec.template b/scripts/packages/chocolatey/bazel.nuspec.template index 9b673a5528..bf787eb075 100644 --- a/scripts/packages/chocolatey/bazel.nuspec.template +++ b/scripts/packages/chocolatey/bazel.nuspec.template @@ -58,7 +58,7 @@ Bazel has built-in support for building both client and server software, includi ## Package parameters -Supply like `--params="/option:value ..."` ([see docs for --params](https://github.com/chocolatey/choco/wiki/CommandsInstall#options-and-switches)) +Supply like `--params="/option:'value' ..."` ([see docs for --params](https://github.com/chocolatey/choco/wiki/CommandsInstall#options-and-switches)) * `msys2Path` (optional, defaults to c:\tools\msys64) - override this if msys2 is installed elsewhere. </description> @@ -75,8 +75,9 @@ Supply like `--params="/option:value ..."` ([see docs for --params](https://gith <dependency id="chocolatey-uninstall.extension" /> </dependencies>--> <dependencies> + <dependency id="chocolatey-core.extension" version="1.0.7"/> <dependency id="jdk8" version="[8.0.102,)"/> - <dependency id="msys2" version="[20160719.1,)"/> + <dependency id="msys2" version="[20160719.1.0,20160719.1.1]"/> <dependency id="python2" version="[2.7.11,3.0)"/> </dependencies> <!-- chocolatey-uninstall.extension - If supporting 0.9.9.x (or below) and including a chocolateyUninstall.ps1 file to uninstall an EXE/MSI, you probably want to include chocolatey-uninstall.extension as a dependency. Please verify whether you are using a helper function from that package. --> diff --git a/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 b/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 index dcfa0a6cf7..46d22b3f9c 100644 --- a/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 +++ b/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 @@ -19,42 +19,15 @@ Install-ChocolateyZipPackage -PackageName "$packageName" ` -UnzipLocation "$packageDir" write-host "Ensure that msys2 dll is present in PATH to allow bazel to be run from non-msys2 shells" - -# from docs: https://github.com/chocolatey/choco/wiki/How-To-Parse-PackageParameters-Argument -$msys2Path = "c:\tools\msys64" -if ($packageParameters) -{ - $match_pattern = "\/(?<option>([a-zA-Z]+)):(?<value>([`"'])?([a-zA-Z0-9- _\\:\.]+)([`"'])?)|\/(?<option>([a-zA-Z]+))" - $option_name = 'option' - $value_name = 'value' - - if ($packageParameters -match $match_pattern) - { - $results = $packageParameters | Select-String $match_pattern -AllMatches - $results.matches | % { - $arguments.Add( - $_.Groups[$option_name].Value.Trim(), - $_.Groups[$value_name].Value.Trim()) - } - } - else - { - Throw "Package Parameters were found but were invalid (REGEX Failure)" - } - - if ($arguments.ContainsKey("msys2Path")) { - $msys2Path = $arguments["msys2Path"] - Write-Host "msys2Path Argument Found: $msys2Path" - } -} -Install-ChocolateyPath -PathToInstall "$msys2Path\usr\bin" -PathType "Machine" +$pp = Get-PackageParameters $env:chocolateyPackageParameters +Install-ChocolateyPath -PathToInstall "$($pp.msys2Path)\usr\bin" -PathType "Machine" $addToMsysPath = ($packageDir -replace '^([a-zA-Z]):\\(.*)','/$1/$2') -replace '\\','/' write-host @" bazel installed to $packageDir To use it in powershell or cmd, you should ensure your PATH environment variable contains - $($msys2Path)\usr\bin + $($pp.msys2Path)\usr\bin BEFORE both c:\windows\system32 (because bash-on-windows' bash.exe will be found here, if it's installed) any references to msysgit (like c:\program files (x86)\git\bin or c:\program files (x86)\git\cmd) (because git's vendored version of msys2 will interfere with the real msys2) |