Пример #1
0
 def testGetCIPDFromCache(self):
     """Check GetCIPDFromCache behavior."""
     self.PatchObject(path_util, 'GetCacheDir', return_value=self.tempdir)
     path = cipd.GetCIPDFromCache()
     # This is more about making sure the func doesn't crash than inspecting the
     # internal caching logic (which is handled by lib.cache_unittest already).
     self.assertTrue(path.startswith(self.tempdir))
Пример #2
0
def _GetCipdBinary(pkg_name, bin_name, instance_id):
    """Returns a local path to the given binary fetched from cipd."""
    cache_dir = os.path.join(path_util.GetCacheDir(), 'cipd', 'packages')
    path = cipd.InstallPackage(cipd.GetCIPDFromCache(),
                               pkg_name,
                               instance_id,
                               destination=cache_dir)

    return os.path.join(path, bin_name)
 def _BuildCIPDPackage(self, package_path, package, staging_dir):
   """Build CIPD package."""
   logging.info('Building CIPD package %s', package)
   cipd.BuildPackage(
       cipd_path=cipd.GetCIPDFromCache(),
       package=(_CIPD_PACKAGE_PREFIX + package),
       in_dir=staging_dir,
       outfile=package_path,
   )
 def _RegisterPackage(self, package):
   """Register CIPD package."""
   logging.info('Registering CIPD package %s', package)
   cipd.RegisterPackage(
       cipd_path=cipd.GetCIPDFromCache(),
       package_file=_GetPackagePath(self.archive_path, package),
       tags={'version': self._VersionString()},
       refs=['latest'],
       cred_path=_CRED_FILE,
   )
Пример #5
0
def _GetAuthUtil(instance_id='latest'):
    """Returns a path to the authutil binary.

  This will download and install the authutil package if it is not already
  deployed.

  Args:
    instance_id: The instance-id of the package to install. Defaults to 'latest'

  Returns:
    the path to the authutil binary.
  """
    cache_dir = os.path.join(path_util.GetCacheDir(), 'cipd/packages')
    path = cipd.InstallPackage(cipd.GetCIPDFromCache(),
                               'infra/tools/authutil/linux-amd64',
                               instance_id,
                               destination=cache_dir)

    return os.path.join(path, 'authutil')
Пример #6
0
def GetLuciAuth(
    instance_id='git_revision:fd059ace316e4dbcaa5afdcec9ed4a855c4f3c65'):
  """Returns a path to the luci-auth binary.

  This will download and install the luci-auth package if it is not already
  deployed.

  Args:
    instance_id: The instance-id of the package to install. Defaults to
    'git_revision:fd059ace316e4dbcaa5afdcec9ed4a855c4f3c65' which is the last
    SHA1 version.

  Returns:
    the path to the luci-auth binary.
  """
  cache_dir = os.path.join(path_util.GetCacheDir(), 'cipd/packages')
  path = cipd.InstallPackage(
      cipd.GetCIPDFromCache(),
      'infra/tools/luci-auth/linux-amd64',
      instance_id,
      destination=cache_dir)

  return os.path.join(path, 'luci-auth')