From 700aee769d3c155ffb430edfbfd3be26f15188b4 Mon Sep 17 00:00:00 2001 From: Stephanie Kim Date: Wed, 1 Jun 2022 19:58:30 +0000 Subject: [PATCH] Override cipd install mode for runhooks Currently cipd packages listed in src/DEPS are being created and installed in symlink mode (see bug for more info). This CL adds `$OverrideInstallMode copy` to the ensure files for cipd packages installed during gclient runhooks. `$OverrideInstallMode` was implemented here, https://chromium-review.googlesource.com/c/infra/luci/luci-go/+/3124202, so that every cipd package can be installed directly to the installation target, instead of being symlinked to an executable inside the cache/builder/.cipd dir. The added `$OverrideInstallMode copy` can be removed once all cipd packages themselves or the default mode is updated to be created in copy mode. Bug: 1329641 Change-Id: I68dc718e20f193c384d005c9b6b87603753943d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3673698 Reviewed-by: Josip Sokcevic Commit-Queue: Stephanie Kim --- gclient_scm.py | 5 ++++- tests/gclient_cipd_smoketest.py | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gclient_scm.py b/gclient_scm.py index 6a75af567..24c4bee92 100644 --- a/gclient_scm.py +++ b/gclient_scm.py @@ -1542,7 +1542,10 @@ class CipdRoot(object): @contextlib.contextmanager def _create_ensure_file(self): try: - contents = '$ParanoidMode CheckPresence\n\n' + contents = '$ParanoidMode CheckPresence\n' + # TODO(crbug/1329641): Remove once cipd packages have been updated + # to always be created in copy mode. + contents += '$OverrideInstallMode copy\n\n' for subdir, packages in sorted(self._packages_by_subdir.items()): contents += '@Subdir %s\n' % subdir for package in sorted(packages, key=lambda p: p.name): diff --git a/tests/gclient_cipd_smoketest.py b/tests/gclient_cipd_smoketest.py index 0d98b5038..289023fc3 100644 --- a/tests/gclient_cipd_smoketest.py +++ b/tests/gclient_cipd_smoketest.py @@ -35,6 +35,7 @@ class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase): tree.update({ '_cipd': '\n'.join([ '$ParanoidMode CheckPresence', + '$OverrideInstallMode copy', '', '@Subdir src/another_cipd_dep', 'package1 1.1-cr0', @@ -77,6 +78,7 @@ class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase): tree.update({ '_cipd': '\n'.join([ '$ParanoidMode CheckPresence', + '$OverrideInstallMode copy', '', '@Subdir src/repo12', 'foo 1.3', @@ -99,6 +101,7 @@ class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase): tree.update({ '_cipd': '\n'.join([ '$ParanoidMode CheckPresence', + '$OverrideInstallMode copy', '', '@Subdir src/repo12', 'foo 1.3', @@ -118,6 +121,7 @@ class GClientSmokeCipd(gclient_smoketest_base.GClientSmokeBase): tree.update({ '_cipd': '\n'.join([ '$ParanoidMode CheckPresence', + '$OverrideInstallMode copy', '', '@Subdir src/repo12', 'foo 1.3',