
download_from_google_storage leaves archive data on disk, near .sha1 files. As we move those hooks to native DEPS, we no longer need to do that. Old checkouts will still have archive files around, and removing just .gitignore entry can be confusing to our users as it will show up as untracked file. This CL adds a hook runs that cleans up stale files left by download_from_google_storage (and anything else in the future). This change also removes .gitignore entry for test_fonts.tar.gz. R=bjoyce@chromium.org Bug: 336625018 Change-Id: Id40b7f30d3353e4fa57a4c0dd172414838b483af Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5523918 Commit-Queue: Thomas Anderson <thomasanderson@chromium.org> Reviewed-by: Benjamin Joyce (Ben) <bjoyce@chromium.org> Auto-Submit: Josip Sokcevic <sokcevic@chromium.org> Reviewed-by: Dirk Pranke <dpranke@google.com> Reviewed-by: Thomas Anderson <thomasanderson@chromium.org> Cr-Commit-Position: refs/heads/main@{#1298764}
24 lines
601 B
Python
Executable File
24 lines
601 B
Python
Executable File
#!/usr/bin/env python
|
|
# Copyright 2024 The Chromium Authors
|
|
# Use of this source code is governed by a BSD-style license that can be
|
|
# found in the LICENSE file.
|
|
|
|
import os
|
|
import sys
|
|
|
|
|
|
def RemoveAllStaleFiles(paths):
|
|
"""Check if any stale files (e.g. old GCS archives) are on filesystem, and
|
|
remove them."""
|
|
for path in paths:
|
|
try:
|
|
if os.path.exists(path) and not os.path.isdir(path):
|
|
os.remove(path)
|
|
except OSError:
|
|
# Wrap OS calls in try/except in case another process touched this file.
|
|
pass
|
|
|
|
|
|
if __name__ == '__main__':
|
|
RemoveAllStaleFiles(sys.argv[1:])
|