Sha256: 284430ccdd4f668d20c5a81ee65727161f6148932f5681814596c61da183b04f

Contents?: true

Size: 1.95 KB

Versions: 16

Compression:

Stored size: 1.95 KB

Contents

# Copyright (c) 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

$myPath = Split-Path $MyInvocation.MyCommand.Path -Parent

function GetEnvVar([string] $key, [scriptblock] $defaultFn) {
    if (Test-Path "Env:\$key") {
        return Get-ChildItem $Env $key
    }
    return $defaultFn.Invoke()
}

$cipdClientVer = GetEnvVar "CIPD_CLIENT_VER" {
  Get-Content (Join-Path $myPath -ChildPath 'cipd_client_version') -TotalCount 1
}
$cipdClientSrv = GetEnvVar "CIPD_CLIENT_SRV" {
  "https://chrome-infra-packages.appspot.com"
}

$plat="windows"
if ([environment]::Is64BitOperatingSystem)  {
  $arch="amd64"
} else {
  $arch="386"
}

$url = "$cipdClientSrv/client?platform=$plat-$arch&version=$cipdClientVer"
$client = Join-Path $myPath -ChildPath ".cipd_client.exe"

try {
  $depot_tools_version = &git -C $myPath rev-parse HEAD 2>&1
  if ($LastExitCode -eq 0) {
    $user_agent = "depot_tools/$depot_tools_version"
  } else {
    $user_agent = "depot_tools/???"
  }
} catch [System.Management.Automation.CommandNotFoundException] {
  $user_agent = "depot_tools/no_git/???"
}

$Env:CIPD_HTTP_USER_AGENT_PREFIX = $user_agent

# Use a lock fle to prevent simultaneous processes from stepping on each other.
$cipd_lock = Join-Path $myPath -ChildPath '.cipd_client.lock'
while ($true) {
  $cipd_lock_file = $false
  try {
      $cipd_lock_file = [IO.File]::OpenWrite($cipd_lock)

      if (!(Test-Path $client)) {
          echo "Bootstrapping cipd client for $plat-$arch from $url..."

          $wc = (New-Object System.Net.WebClient)
          $wc.Headers.add('User-Agent', $user_agent)
          $wc.DownloadFile($url, $client)
      }
      break
  } catch {
      echo "CIPD lock is held, trying again after delay..."
      Start-Sleep -s 1
  } finally {
      if ($cipd_lock_file) {
          $cipd_lock_file.close()
      }
  }
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
libv8-6.7.288.46.1 vendor/depot_tools/cipd.ps1
libv8-6.7.288.46.0 vendor/depot_tools/cipd.ps1
libv8-6.7.288.46.1beta0 vendor/depot_tools/cipd.ps1
libv8-6.3.292.48.1 vendor/depot_tools/cipd.ps1
libv8-6.3.292.48.0 vendor/depot_tools/cipd.ps1
libv8-6.3.292.48.0beta2 vendor/depot_tools/cipd.ps1
libv8-6.3.292.48.0beta1 vendor/depot_tools/cipd.ps1
libv8-6.2.414.42.1 vendor/depot_tools/cipd.ps1
libv8-6.2.414.42.0 vendor/depot_tools/cipd.ps1
libv8-6.2.414.42.0beta1 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.3 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.2 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.1 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.0 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.0beta2 vendor/depot_tools/cipd.ps1
libv8-6.0.286.54.0beta1 vendor/depot_tools/cipd.ps1