summaryrefslogtreecommitdiff
path: root/chromium/tools/infra/clobber_cache_utils.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/tools/infra/clobber_cache_utils.py
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/tools/infra/clobber_cache_utils.py')
-rw-r--r--chromium/tools/infra/clobber_cache_utils.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/chromium/tools/infra/clobber_cache_utils.py b/chromium/tools/infra/clobber_cache_utils.py
index be957234485..ba180373d22 100644
--- a/chromium/tools/infra/clobber_cache_utils.py
+++ b/chromium/tools/infra/clobber_cache_utils.py
@@ -9,6 +9,7 @@ from __future__ import print_function
import os
import subprocess
import sys
+import textwrap
_SRC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..'))
_SWARMING_CLIENT = os.path.join(_SRC_ROOT, 'tools', 'swarming_client',
@@ -48,16 +49,26 @@ def _trigger_clobber(swarming_server, pool, cache, bot, mount_rel_path,
'-d',
'id',
bot,
+ '--cipd-package',
+ 'cpython:infra/python/cpython/${platform}:latest',
'--named-cache',
cache,
mount_rel_path,
'--priority=10',
'--raw-cmd',
'--',
- # TODO(jbudorick): Generalize this for windows.
- '/bin/rm',
- '-rf',
- mount_rel_path,
+ 'cpython/bin/python${EXECUTABLE_SUFFIX}',
+ '-c',
+ textwrap.dedent('''\
+ import os, shutil, stat
+
+ def remove_readonly(func, path, _):
+ "Clear the readonly bit and reattempt the removal"
+ os.chmod(path, stat.S_IWRITE)
+ func(path)
+
+ shutil.rmtree({mount_rel_path!r}, onerror=remove_readonly)
+ '''.format(mount_rel_path=mount_rel_path)),
]
if dry_run:
print('Would run `%s`' % ' '.join(cmd))