diff options
Diffstat (limited to 'scripts/packages')
-rw-r--r-- | scripts/packages/chocolatey/build.ps1 | 21 | ||||
-rw-r--r-- | scripts/packages/chocolatey/test.ps1 | 7 | ||||
-rw-r--r-- | scripts/packages/chocolatey/tools/chocolateyinstall.ps1 | 18 |
3 files changed, 22 insertions, 24 deletions
diff --git a/scripts/packages/chocolatey/build.ps1 b/scripts/packages/chocolatey/build.ps1 index ae1d594163..2b196d9415 100644 --- a/scripts/packages/chocolatey/build.ps1 +++ b/scripts/packages/chocolatey/build.ps1 @@ -27,13 +27,17 @@ if ($mode -eq "release") { } if ($fixPackage -eq $true) { - $tvPackageFixVersion = "-$((get-date).tostring("yyyyMMdd-hhmmss"))" + $prefix = "-" + if ($mode -eq "release") { + $prefix = "." + } + $tvPackageFixVersion = "$($prefix)$((get-date).tostring("yyyyMMdd"))" } rm -force -ErrorAction SilentlyContinue ./*.nupkg rm -force -ErrorAction SilentlyContinue ./bazel.nuspec rm -force -ErrorAction SilentlyContinue ./tools/LICENSE -rm -force -ErrorAction SilentlyContinue ./tools/params.json rm -force -ErrorAction SilentlyContinue ./tools/*.orig +rm -force -ErrorAction SilentlyContinue "./tools/params.*" if ($checksum -eq "") { rm -force -ErrorAction SilentlyContinue ./*.zip } @@ -63,13 +67,10 @@ From: https://github.com/bazelbuild/bazel/blob/master/LICENSE add-content -value $licenseHeader -path "./tools/LICENSE" add-content -value (get-content "../../../LICENSE") -path "./tools/LICENSE" -$params = @{ - package = @{ - uri = $tvUri; - checksum = $tvChecksum; - checksumType = "sha256"; - } -} -add-content -value (ConvertTo-Json $params) -path "./tools/params.json" +$params = @" +$tvUri +$tvChecksum +"@ +add-content -value $params -path "./tools/params.txt" choco pack ./bazel.nuspec diff --git a/scripts/packages/chocolatey/test.ps1 b/scripts/packages/chocolatey/test.ps1 index febbc2f417..b561ba2a98 100644 --- a/scripts/packages/chocolatey/test.ps1 +++ b/scripts/packages/chocolatey/test.ps1 @@ -1,12 +1,13 @@ param( - [switch] $prerelease + [switch] $prerelease, + [string] $sources = "." ) choco uninstall bazel --force -y if ($prerelease) { - choco install bazel --verbose --debug --prerelease --force -y -s ".;https://chocolatey.org/api/v2/" + choco install bazel --verbose --debug --prerelease --force -y -s $sources } else { - choco install bazel --verbose --debug --force -y -s ".;https://chocolatey.org/api/v2/" + choco install bazel --verbose --debug --force -y -s $sources } if ($LASTEXITCODE -ne 0) diff --git a/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 b/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 index fbd3cc32b0..2690150391 100644 --- a/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 +++ b/scripts/packages/chocolatey/tools/chocolateyinstall.ps1 @@ -2,22 +2,18 @@ $ErrorActionPreference = 'Stop'; # stop on all errors $packageName = 'bazel' $toolsDir = Split-Path -parent $MyInvocation.MyCommand.Definition -$json = gc "$toolsDir\params.json" -$p = (($json) -join "`n") | convertfrom-json +$paramsText = get-content "$($toolsDir)\params.txt" +$p = $paramsText.Split("`n") $packageDir = Split-Path -parent $toolsDir -$binRoot = (Get-ToolsLocation) -replace "\\", "/" -write-host "Read params from json" -write-host (convertto-json $p) +write-host "Read params from text file" +write-host $p Install-ChocolateyZipPackage -PackageName "$packageName" ` - -Url "$($p.package.uri)" ` - -Checksum "$($p.package.checksum)" ` - -ChecksumType "$($p.package.checksumType)" ` - -Url64bit "$($p.package.uri)" ` - -Checksum64 "$($p.package.checksum)" ` - -Checksum64Type "$($p.package.checksumType)" ` + -Url64bit "$($p[0])" ` + -Checksum64 "$($p[1])" ` + -Checksum64Type "sha256" ` -UnzipLocation "$packageDir" write-host "Ensure that msys2 dll is present in PATH to allow bazel to be run from non-msys2 shells" |