From 91741eff3e30e47b613d26bcb38b5d5c520c425b Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 13 Dec 2024 11:45:03 -0800 Subject: [PATCH 1/3] Delete stale package_config.json in gclient sync hook --- tools/pub_get_offline.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index 2bf6b8ace54a0..0b3ee3ddcbce7 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -127,6 +127,16 @@ def find_unlisted_packages(): return unlisted +def deleteConfigFiles(): + # Find all package_config.json that are not under version control. + gitCmd = ['git', 'ls-files', '-o', '**/.dart_tool/package_config.json'] + filesToDelete = subprocess.check_output( + gitCmd, cwd=ENGINE_DIR, stderr=subprocess.STDOUT, text=True + ).splitlines() + for file in filesToDelete: + os.remove(os.path.join(ENGINE_DIR, file)) + + def main(): # Intentionally use the Dart SDK prebuilt instead of the Flutter prebuilt # (i.e. prebuilts/{platform}/dart-sdk/bin/dart) because the script has to run @@ -135,6 +145,10 @@ def main(): SRC_ROOT, 'flutter', 'third_party', 'dart', 'tools', 'sdks', 'dart-sdk', 'bin' ) + # Delete all package_config.json files. These may be stale. + # Required ones will be regenerated fresh below. + deleteConfigFiles() + # Ensure all relevant packages are listed in ALL_PACKAGES. unlisted = find_unlisted_packages() if len(unlisted) > 0: From 6e6e025c8ef197ab91e7230a9d3a2fcda0075955 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 13 Dec 2024 12:59:14 -0800 Subject: [PATCH 2/3] fix pylints --- tools/pub_get_offline.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index 0b3ee3ddcbce7..e66d8e68e8256 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -127,13 +127,13 @@ def find_unlisted_packages(): return unlisted -def deleteConfigFiles(): +def delete_config_files(): # Find all package_config.json that are not under version control. - gitCmd = ['git', 'ls-files', '-o', '**/.dart_tool/package_config.json'] - filesToDelete = subprocess.check_output( - gitCmd, cwd=ENGINE_DIR, stderr=subprocess.STDOUT, text=True + gitcmd = ['git', 'ls-files', '-o', '**/.dart_tool/package_config.json'] + files_to_delete = subprocess.check_output( + gitcmd, cwd=ENGINE_DIR, stderr=subprocess.STDOUT, text=True ).splitlines() - for file in filesToDelete: + for file in files_to_delete: os.remove(os.path.join(ENGINE_DIR, file)) @@ -147,7 +147,7 @@ def main(): # Delete all package_config.json files. These may be stale. # Required ones will be regenerated fresh below. - deleteConfigFiles() + delete_config_files() # Ensure all relevant packages are listed in ALL_PACKAGES. unlisted = find_unlisted_packages() From c0e85fe1f3b4a4e7e37f5a6eec2dcd4cc5898079 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Fri, 13 Dec 2024 14:05:01 -0800 Subject: [PATCH 3/3] add log --- tools/pub_get_offline.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/pub_get_offline.py b/tools/pub_get_offline.py index e66d8e68e8256..154c08e6d55c0 100644 --- a/tools/pub_get_offline.py +++ b/tools/pub_get_offline.py @@ -134,6 +134,7 @@ def delete_config_files(): gitcmd, cwd=ENGINE_DIR, stderr=subprocess.STDOUT, text=True ).splitlines() for file in files_to_delete: + print('Deleting %s...' % file) os.remove(os.path.join(ENGINE_DIR, file))