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
diff --git a/scripts/packages/chocolatey/bazel.nuspec.template b/scripts/packages/chocolatey/bazel.nuspec.template
index c192fc0..23ce5dc 100644
--- a/scripts/packages/chocolatey/bazel.nuspec.template
+++ b/scripts/packages/chocolatey/bazel.nuspec.template
@@ -25,7 +25,7 @@
     <!-- 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 570af1b..0123d31 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 @@
 } 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 @@
   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"