From ea76144fa1f8701b3a5d065a5f7b1f71b2480ea2 Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Tue, 4 Jun 2024 23:58:17 +0200 Subject: [PATCH] chore: cherry-pick 22db6918bac9 from chromium (#42316) * chore: cherry-pick 22db6918bac9 from chromium Co-authored-by: Keeley Hammond * chore: update patches Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Keeley Hammond Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> --- patches/chromium/.patches | 1 + .../chromium/cherry-pick-22db6918bac9.patch | 78 +++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 patches/chromium/cherry-pick-22db6918bac9.patch diff --git a/patches/chromium/.patches b/patches/chromium/.patches index abac5b94cf0c..d0bf1c477808 100644 --- a/patches/chromium/.patches +++ b/patches/chromium/.patches @@ -129,3 +129,4 @@ cherry-pick-b2cc7b7ac538.patch partially_revert_is_newly_created_to_allow_for_browser_initiated.patch fix_use_app_launch_prefetch_namespace_for_subprocesstype.patch feat_add_support_for_missing_dialog_features_to_shell_dialogs.patch +cherry-pick-22db6918bac9.patch diff --git a/patches/chromium/cherry-pick-22db6918bac9.patch b/patches/chromium/cherry-pick-22db6918bac9.patch new file mode 100644 index 000000000000..d0382d2ad500 --- /dev/null +++ b/patches/chromium/cherry-pick-22db6918bac9.patch @@ -0,0 +1,78 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Josip Sokcevic +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 +Reviewed-by: Benjamin Joyce (Ben) +Auto-Submit: Josip Sokcevic +Reviewed-by: Dirk Pranke +Reviewed-by: Thomas Anderson +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:])