|
|
|
@ -17,8 +17,6 @@ ROOT_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..'))
|
|
|
|
|
|
|
|
|
|
|
|
DEVNULL = open(os.devnull, 'w')
|
|
|
|
DEVNULL = open(os.devnull, 'w')
|
|
|
|
|
|
|
|
|
|
|
|
BAT_EXT = '.bat' if sys.platform.startswith('win') else ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _check_call(argv, **kwargs):
|
|
|
|
def _check_call(argv, **kwargs):
|
|
|
|
"""Wrapper for subprocess.check_call that adds logging."""
|
|
|
|
"""Wrapper for subprocess.check_call that adds logging."""
|
|
|
|
@ -45,6 +43,17 @@ def clean_up_old_git_installations(git_directory):
|
|
|
|
shutil.rmtree(full_entry, ignore_errors=True)
|
|
|
|
shutil.rmtree(full_entry, ignore_errors=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def bootstrap_cipd(cipd_directory, cipd_platform):
|
|
|
|
|
|
|
|
"""Bootstraps CIPD client into |cipd_directory|."""
|
|
|
|
|
|
|
|
_check_call([
|
|
|
|
|
|
|
|
sys.executable,
|
|
|
|
|
|
|
|
os.path.join(ROOT_DIR, 'recipe_modules', 'cipd', 'resources',
|
|
|
|
|
|
|
|
'bootstrap.py'),
|
|
|
|
|
|
|
|
'--platform', cipd_platform,
|
|
|
|
|
|
|
|
'--dest-directory', cipd_directory
|
|
|
|
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def cipd_install(args, dest_directory, package, version):
|
|
|
|
def cipd_install(args, dest_directory, package, version):
|
|
|
|
"""Installs CIPD |package| at |version| into |dest_directory|."""
|
|
|
|
"""Installs CIPD |package| at |version| into |dest_directory|."""
|
|
|
|
manifest_file = tempfile.mktemp()
|
|
|
|
manifest_file = tempfile.mktemp()
|
|
|
|
@ -95,6 +104,9 @@ def need_to_install_git(args, git_directory):
|
|
|
|
def install_git(args, git_version, git_directory):
|
|
|
|
def install_git(args, git_version, git_directory):
|
|
|
|
"""Installs |git_version| into |git_directory|."""
|
|
|
|
"""Installs |git_version| into |git_directory|."""
|
|
|
|
cipd_platform = 'windows-%s' % ('amd64' if args.bits == 64 else '386')
|
|
|
|
cipd_platform = 'windows-%s' % ('amd64' if args.bits == 64 else '386')
|
|
|
|
|
|
|
|
if not args.cipd_client:
|
|
|
|
|
|
|
|
bootstrap_cipd(ROOT_DIR, cipd_platform)
|
|
|
|
|
|
|
|
args.cipd_client = os.path.join(ROOT_DIR, 'cipd')
|
|
|
|
temp_dir = tempfile.mkdtemp()
|
|
|
|
temp_dir = tempfile.mkdtemp()
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
cipd_install(args,
|
|
|
|
cipd_install(args,
|
|
|
|
@ -160,9 +172,7 @@ def main(argv):
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
parser.add_argument('--bits', type=int, choices=(32,64), default=64,
|
|
|
|
parser.add_argument('--bits', type=int, choices=(32,64), default=64,
|
|
|
|
help='Bitness of the client to install.')
|
|
|
|
help='Bitness of the client to install.')
|
|
|
|
parser.add_argument('--cipd-client',
|
|
|
|
parser.add_argument('--cipd-client', help='Path to CIPD client binary.')
|
|
|
|
help='Path to CIPD client binary. default: %(default)s',
|
|
|
|
|
|
|
|
default=os.path.join(ROOT_DIR, 'cipd'+BAT_EXT))
|
|
|
|
|
|
|
|
parser.add_argument('--cipd-cache-directory',
|
|
|
|
parser.add_argument('--cipd-cache-directory',
|
|
|
|
help='Path to CIPD cache directory.')
|
|
|
|
help='Path to CIPD cache directory.')
|
|
|
|
parser.add_argument('--force', action='store_true',
|
|
|
|
parser.add_argument('--force', action='store_true',
|
|
|
|
|