Skip to content

Commit fc0514f

Browse files
zmodemChromium LUCI CQ
authored andcommitted
Reland "Clang update.py: Don't set mtime based on the archive metadata"
This is a reland of commit 9a05872, adding follow_symlinks=False to the utime() call to avoid failing if the extracted archive contains broken symlinks, as seems to be the case on Mac. I think it makes sense not to follow symlinks here anyway: we want to set the mtime on the link itself. If the target is in the archive, it will get set separately. Original change's description: > Clang update.py: Don't set mtime based on the archive metadata > > We want the extracted files to have mtimes that reflect when they > were extracted. > > The build system relies on mtimes information to detect when > dependencies change. > > Since we want update.py to work with system python on macOS (3.9.6), > we can't use the extractall filter mechanism, but instead update > the mtimes ourselves. > > Bug: 450551220 > Change-Id: Ie6baa486520e85e0e48106c5ea43bd844baa3cb1 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7046440 > Reviewed-by: Nico Weber <[email protected]> > Commit-Queue: Hans Wennborg <[email protected]> > Cr-Commit-Position: refs/heads/main@{#1531327} Bug: 450551220 Change-Id: Ib0d2246be5cb9dd30921deb57ddb2f403abea8ca Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7062434 Auto-Submit: Hans Wennborg <[email protected]> Reviewed-by: Nico Weber <[email protected]> Commit-Queue: Hans Wennborg <[email protected]> Cr-Commit-Position: refs/heads/main@{#1532375}
1 parent 0880976 commit fc0514f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/clang/scripts/update.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,18 @@ def DownloadAndUnpack(url, output_dir, path_prefixes=None, is_known_zip=False):
191191
zipfile.ZipFile(f).extractall(path=output_dir)
192192
else:
193193
t = tarfile.open(mode='r:*', fileobj=f)
194-
members = None
194+
members = t.getmembers()
195195
if path_prefixes is not None:
196196
members = [m for m in t.getmembers()
197197
if any(m.name.startswith(p) for p in path_prefixes)]
198198
t.extractall(path=output_dir, members=members)
199199

200+
# Don't set mtime based on the archive metadata; see crbug.com/450551220
201+
# The nicest way to do this would be by passing a filter to extractall,
202+
# but that functionality is not available in macOS system Python (3.9.6).
203+
for m in members:
204+
os.utime(os.path.join(output_dir, m.name), follow_symlinks=False)
205+
200206

201207
def GetPlatformUrlPrefix(host_os):
202208
_HOST_OS_URL_MAP = {

0 commit comments

Comments
 (0)