aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools
diff options
context:
space:
mode:
authorManoj Gupta <manojgupta@google.com>2020-04-01 17:43:39 -0700
committerManoj Gupta <manojgupta@chromium.org>2020-04-02 16:04:36 +0000
commit5a1fd9fb57f00498eb301b5e2c685f0509367e56 (patch)
tree48ae73841a21147530e76341bde53064fc82e3de /llvm_tools
parentd3c078a39da8d4fabd9d3466311e084ee1783e76 (diff)
downloadtoolchain-utils-5a1fd9fb57f00498eb301b5e2c685f0509367e56.tar.gz
llvm_tools: Add feature to specify a terminating commit message
Allow sepcifying a terminating commit message. This will be useful to specify CL dependency information e.g. "Cq-Depend: chromium:NNN". BUG=chromium:1067029 TEST=unit tests Change-Id: I2dfa751b28f64df50169cd424d39a3f3f4f1de6a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2133241 Tested-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org>
Diffstat (limited to 'llvm_tools')
-rwxr-xr-xllvm_tools/modify_a_tryjob.py12
-rwxr-xr-xllvm_tools/update_chromeos_llvm_hash.py18
-rwxr-xr-xllvm_tools/update_chromeos_llvm_hash_unittest.py11
-rwxr-xr-xllvm_tools/update_packages_and_run_tryjobs.py12
4 files changed, 40 insertions, 13 deletions
diff --git a/llvm_tools/modify_a_tryjob.py b/llvm_tools/modify_a_tryjob.py
index 96478321..5d04e7f4 100755
--- a/llvm_tools/modify_a_tryjob.py
+++ b/llvm_tools/modify_a_tryjob.py
@@ -118,9 +118,15 @@ def GetCLAfterUpdatingPackages(packages, git_hash, svn_version, chroot_path,
"""Updates the packages' LLVM_NEXT."""
change_list = update_chromeos_llvm_hash.UpdatePackages(
- packages, update_chromeos_llvm_hash.LLVMVariant.next, git_hash,
- svn_version, chroot_path, patch_metadata_file,
- FailureModes.DISABLE_PATCHES, svn_option)
+ packages,
+ update_chromeos_llvm_hash.LLVMVariant.next,
+ git_hash,
+ svn_version,
+ chroot_path,
+ patch_metadata_file,
+ FailureModes.DISABLE_PATCHES,
+ svn_option,
+ extra_commit_msg=None)
print('\nSuccessfully updated packages to %d' % svn_version)
print('Gerrit URL: %s' % change_list.url)
diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py
index d29b605d..916eb67b 100755
--- a/llvm_tools/update_chromeos_llvm_hash.py
+++ b/llvm_tools/update_chromeos_llvm_hash.py
@@ -616,7 +616,8 @@ def StagePackagesPatchResultsForCommit(package_info_dict, commit_messages):
def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path,
- patch_metadata_file, mode, git_hash_source):
+ patch_metadata_file, mode, git_hash_source,
+ extra_commit_msg):
"""Updates an LLVM hash and uprevs the ebuild of the packages.
A temporary repo is created for the changes. The changes are
@@ -700,6 +701,9 @@ def UpdatePackages(packages, llvm_variant, git_hash, svn_version, chroot_path,
commit_messages = StagePackagesPatchResultsForCommit(
package_info_dict, commit_messages)
+ if extra_commit_msg:
+ commit_messages.append(extra_commit_msg)
+
change_list = UploadChanges(repo_path, branch, commit_messages)
finally:
@@ -728,9 +732,15 @@ def main():
git_hash, svn_version = GetLLVMHashAndVersionFromSVNOption(git_hash_source)
change_list = UpdatePackages(
- args_output.update_packages, llvm_variant, git_hash, svn_version,
- args_output.chroot_path, args_output.patch_metadata_file,
- FailureModes(args_output.failure_mode), git_hash_source)
+ args_output.update_packages,
+ llvm_variant,
+ git_hash,
+ svn_version,
+ args_output.chroot_path,
+ args_output.patch_metadata_file,
+ FailureModes(args_output.failure_mode),
+ git_hash_source,
+ extra_commit_msg=None)
print('Successfully updated packages to %s (%d)' % (git_hash, svn_version))
print('Gerrit URL: %s' % change_list.url)
diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py
index 13cdedd1..b29b0784 100755
--- a/llvm_tools/update_chromeos_llvm_hash_unittest.py
+++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py
@@ -821,13 +821,15 @@ class UpdateLLVMHashTest(unittest.TestCase):
patch_metadata_file = 'PATCHES.json'
git_hash_source = 'google3'
branch = 'update-LLVM_NEXT_HASH-a123testhash4'
+ extra_commit_msg = None
# Verify exception is raised when an exception is thrown within
# the 'try' block by UprevEbuild function.
with self.assertRaises(ValueError) as err:
update_chromeos_llvm_hash.UpdatePackages(
packages_to_update, llvm_variant, git_hash, svn_version, chroot_path,
- patch_metadata_file, FailureModes.FAIL, git_hash_source)
+ patch_metadata_file, FailureModes.FAIL, git_hash_source,
+ extra_commit_msg)
self.assertEqual(str(err.exception), 'Failed to uprev the ebuild.')
@@ -953,10 +955,12 @@ class UpdateLLVMHashTest(unittest.TestCase):
patch_metadata_file = 'PATCHES.json'
git_hash_source = 'tot'
branch = 'update-LLVM_NEXT_HASH-a123testhash5'
+ extra_commit_msg = '\ncommit-message-end'
change_list = update_chromeos_llvm_hash.UpdatePackages(
packages_to_update, llvm_variant, git_hash, svn_version, chroot_path,
- patch_metadata_file, FailureModes.DISABLE_PATCHES, git_hash_source)
+ patch_metadata_file, FailureModes.DISABLE_PATCHES, git_hash_source,
+ extra_commit_msg)
self.assertEqual(change_list.url,
'https://some_name/path/to/commit/+/12345')
@@ -978,7 +982,8 @@ class UpdateLLVMHashTest(unittest.TestCase):
'The following packages have been updated:', 'path/to',
'\nFor the package path/to:',
'The patch metadata file PATCHES.json was modified',
- 'The following patches were disabled:', 'fix_stdout.patch'
+ 'The following patches were disabled:', 'fix_stdout.patch',
+ '\ncommit-message-end'
]
mock_update_package_metadata_file.assert_called_once()
diff --git a/llvm_tools/update_packages_and_run_tryjobs.py b/llvm_tools/update_packages_and_run_tryjobs.py
index c609fcfd..9cb6cfad 100755
--- a/llvm_tools/update_packages_and_run_tryjobs.py
+++ b/llvm_tools/update_packages_and_run_tryjobs.py
@@ -287,9 +287,15 @@ def main():
update_chromeos_llvm_hash.verbose = args_output.verbose
change_list = update_chromeos_llvm_hash.UpdatePackages(
- update_packages, update_chromeos_llvm_hash.LLVMVariant.next, git_hash,
- svn_version, args_output.chroot_path, patch_metadata_file,
- FailureModes.DISABLE_PATCHES, svn_option)
+ update_packages,
+ update_chromeos_llvm_hash.LLVMVariant.next,
+ git_hash,
+ svn_version,
+ args_output.chroot_path,
+ patch_metadata_file,
+ FailureModes.DISABLE_PATCHES,
+ svn_option,
+ extra_commit_msg=None)
print('Successfully updated packages to %d' % svn_version)
print('Gerrit URL: %s' % change_list.url)