mirror of https://github.com/electron/electron
79 lines
2.7 KiB
Diff
79 lines
2.7 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Josip Sokcevic <sokcevic@chromium.org>
|
|
Date: Thu, 9 May 2024 18:45:52 +0000
|
|
Subject: Add hook to delete stale files
|
|
|
|
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}
|
|
|
|
diff --git a/DEPS b/DEPS
|
|
index b15e782d99659792fa03fea7cf7abf9df3425803..35690149aa76c7557a83f5d1291e41181708359b 100644
|
|
--- a/DEPS
|
|
+++ b/DEPS
|
|
@@ -4660,6 +4660,17 @@ hooks = [
|
|
'--disable',
|
|
],
|
|
},
|
|
+ {
|
|
+ # Ensure we remove any file from disk that is no longer needed (e.g. after
|
|
+ # hooks to native GCS deps migration).
|
|
+ 'name': 'remove_stale_files',
|
|
+ 'pattern': '.',
|
|
+ 'action': [
|
|
+ 'python3',
|
|
+ 'src/tools/remove_stale_files.py',
|
|
+ 'src/third_party/test_fonts/test_fonts.tar.gz', # Remove after 20240901
|
|
+ ],
|
|
+ },
|
|
{
|
|
# Ensure that we don't accidentally reference any .pyc files whose
|
|
# corresponding .py files have since been deleted.
|
|
diff --git a/tools/remove_stale_files.py b/tools/remove_stale_files.py
|
|
new file mode 100755
|
|
index 0000000000000000000000000000000000000000..5973fd57bc99e7e702346eb048985c599268c2b2
|
|
--- /dev/null
|
|
+++ b/tools/remove_stale_files.py
|
|
@@ -0,0 +1,23 @@
|
|
+#!/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:])
|