diff options
author | 2016-11-24 14:19:32 +0000 | |
---|---|---|
committer | 2016-11-24 14:37:39 +0000 | |
commit | bcab9cbf0a8473ef1d960351e2f5ca9821e0e546 (patch) | |
tree | 0dbb25cabf0dfefb5919d31022bba1083433886c /scripts/packages | |
parent | e208428a607bbaa35eaf68b484bb3185403781ce (diff) |
Support choco package fixes
I've used this to create https://chocolatey.org/packages/bazel/0.4.1-rc2-20161124-122858 which is in the queue for automated validation.
That package is built with #2134.
Closes #2135.
--
Reviewed-on: https://github.com/bazelbuild/bazel/pull/2135
MOS_MIGRATED_REVID=140131036
Diffstat (limited to 'scripts/packages')
-rw-r--r-- | scripts/packages/chocolatey/bazel.nuspec.template | 2 | ||||
-rw-r--r-- | scripts/packages/chocolatey/build.ps1 | 18 |
2 files changed, 7 insertions, 13 deletions
diff --git a/scripts/packages/chocolatey/bazel.nuspec.template b/scripts/packages/chocolatey/bazel.nuspec.template index c192fc0414..23ce5dcb69 100644 --- a/scripts/packages/chocolatey/bazel.nuspec.template +++ b/scripts/packages/chocolatey/bazel.nuspec.template @@ -25,7 +25,7 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe <!-- version should MATCH as closely as possible with the underlying software --> <!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages --> <!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. --> - <version>$tvVersion</version> + <version>$($tvVersion)$($tvPackageFixVersion)</version> <!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>--> <packageSourceUrl>https://github.com/bazelbuild/bazel/tree/master/scripts/packages/chocolatey</packageSourceUrl> <!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. --> diff --git a/scripts/packages/chocolatey/build.ps1 b/scripts/packages/chocolatey/build.ps1 index 570af1b4f7..0123d314a1 100644 --- a/scripts/packages/chocolatey/build.ps1 +++ b/scripts/packages/chocolatey/build.ps1 @@ -1,6 +1,7 @@ param( [string] $version = "0.3.2", [int] $rc = 0, + [switch] $fixPackage, [string] $mode = "local", [string] $checksum = "" ) @@ -21,6 +22,10 @@ if ($mode -eq "release") { } else { throw "mode parameter '$mode' unsupported. Please use local, rc, or release." } + +if ($fixPackage -eq $true) { + $tvPackageFixVersion = "-$((get-date).tostring("yyyyMMdd-hhmmss"))" +} rm -force -ErrorAction SilentlyContinue ./*.nupkg rm -force -ErrorAction SilentlyContinue ./bazel.nuspec rm -force -ErrorAction SilentlyContinue ./tools/LICENSE.txt @@ -29,21 +34,10 @@ if ($checksum -eq "") { rm -force -ErrorAction SilentlyContinue ./*.zip } -if ($mode -eq "release") { +if (($mode -eq "release") -or ($mode -eq "rc")) { Invoke-WebRequest "$($tvUri).sha256" -UseBasicParsing -passthru -outfile sha256.txt $tvChecksum = (gc sha256.txt).split(' ')[0] rm sha256.txt -} elseif ($mode -eq "rc") { - if (-not(test-path $tvFilename)) { - Invoke-WebRequest "$($tvUri)" -UseBasicParsing -passthru -outfile $tvFilename - } - if ($checksum -eq "") { - write-host "calculating checksum" - $tvChecksum = (get-filehash $tvFilename -algorithm sha256).Hash - } else { - write-host "using passed checksum" - $tvChecksum = $checksum - } } elseif ($mode -eq "local") { Add-Type -A System.IO.Compression.FileSystem $outputDir = "$pwd/../../../output" |