aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYi Kong <yikong@google.com>2024-04-09 13:58:58 +0900
committerYi Kong <yikong@google.com>2024-04-09 13:58:58 +0900
commitdc1354b9101b1c6c351b24a369fc7dceb0eb9b90 (patch)
treec56285841eb12646d887767f32299ef95783b5d6
parent9ddac58ae9f7ec9913ea9c70027aa21bcc6a249e (diff)
downloadllvm_android-dc1354b9101b1c6c351b24a369fc7dceb0eb9b90.tar.gz
Fix profile upload logic
This only worked when uploading linux prebuilt only. Need to chdir to the profile directory first. Test: manual Change-Id: I9933fdf236b32359d71aedcbff2a351e398d0b9c
-rwxr-xr-xupdate-prebuilts.py38
1 files changed, 20 insertions, 18 deletions
diff --git a/update-prebuilts.py b/update-prebuilts.py
index cd9fd04..aa587b1 100755
--- a/update-prebuilts.py
+++ b/update-prebuilts.py
@@ -19,6 +19,7 @@
"""Update the prebuilt clang from the build server."""
import argparse
+import contextlib
import glob
import inspect
import logging
@@ -315,24 +316,25 @@ def install_clang_directory(extract_subdir: str, install_subdir: str, overwrite:
def update_profiles(download_dir, build_number, bug):
profiles_dir = paths.PREBUILTS_DIR / 'clang' / 'host' / 'linux-x86' / 'profiles'
- # First, delete the old profiles.
- for f in glob.glob(f'{profiles_dir}/{PGO_PROFILE_PATTERN}'):
- os.remove(f)
- for f in glob.glob(f'{profiles_dir}/{BOLT_PROFILE_PATTERN}'):
- os.remove(f)
-
- # Replace with the downloaded new profiles.
- shutil.copy(glob.glob(f'{download_dir}/{PGO_PROFILE_PATTERN}')[0], str(profiles_dir))
- shutil.copy(glob.glob(f'{download_dir}/{BOLT_PROFILE_PATTERN}')[0], str(profiles_dir))
-
- utils.check_call(['git', 'add', profiles_dir])
- message_lines = [f'Check in profiles from build {build_number}']
- if bug is not None:
- message_lines.append('')
- message_lines.append(f'Bug: {format_bug(bug)}')
- message_lines.append('Test: N/A')
- message = '\n'.join(message_lines)
- utils.check_call(['git', 'commit', '-m', message])
+ with contextlib.chdir(profiles_dir):
+ # First, delete the old profiles.
+ for f in glob.glob(PGO_PROFILE_PATTERN):
+ os.remove(f)
+ for f in glob.glob(BOLT_PROFILE_PATTERN):
+ os.remove(f)
+
+ # Replace with the downloaded new profiles.
+ shutil.copy(glob.glob(f'{download_dir}/{PGO_PROFILE_PATTERN}')[0], '.')
+ shutil.copy(glob.glob(f'{download_dir}/{BOLT_PROFILE_PATTERN}')[0], '.')
+
+ utils.check_call(['git', 'add', '.'])
+ message_lines = [f'Check in profiles from build {build_number}']
+ if bug is not None:
+ message_lines.append('')
+ message_lines.append(f'Bug: {format_bug(bug)}')
+ message_lines.append('Test: N/A')
+ message = '\n'.join(message_lines)
+ utils.check_call(['git', 'commit', '-m', message])
def main():