aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools
diff options
context:
space:
mode:
authorSalud Lemus <saludlemus@google.com>2019-08-22 14:44:39 -0700
committerSalud Lemus <saludlemus@google.com>2019-08-22 23:46:47 +0000
commit36a9ee41bfa691c593217670576d0991ae5a7492 (patch)
tree80f72c98300debd1f3f2277a6216f4976f9ba200 /llvm_tools
parent39385f9275505753ba34a45aa9dde6051b513ac0 (diff)
downloadtoolchain-utils-36a9ee41bfa691c593217670576d0991ae5a7492.tar.gz
LLVM tools: Display to stdout when the log level is 'verbose'
BUG=None TEST=Ran the 'update_chromeos_llvm_next_hash.py' with log level set to 'none' and then with 'verbose'. It correctly displayed to stdout for 'verbose'. Change-Id: Ib6b3bba44ccdb78a0d000f51287ffc7b0b5670d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1766581 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Tested-by: Salud Lemus <saludlemus@google.com>
Diffstat (limited to 'llvm_tools')
-rwxr-xr-xllvm_tools/llvm_patch_management.py13
-rwxr-xr-xllvm_tools/update_chromeos_llvm_next_hash.py26
2 files changed, 28 insertions, 11 deletions
diff --git a/llvm_tools/llvm_patch_management.py b/llvm_tools/llvm_patch_management.py
index ac8adc83..4812627a 100755
--- a/llvm_tools/llvm_patch_management.py
+++ b/llvm_tools/llvm_patch_management.py
@@ -121,7 +121,7 @@ def GetPathToFilesDirectory(chroot_path, package):
ret, chroot_ebuild_path, err = ce.ChrootRunCommandWOutput(
chromeos_root=chroot_path,
command='equery w %s' % package,
- print_to_console=False)
+ print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # Failed to get the absolute chroot path to package's ebuild.
raise ValueError(
@@ -182,7 +182,8 @@ def _MoveSrcTreeHEADToGitHash(src_path, git_hash):
move_head_cmd = 'git -C %s checkout %s' % (quote(src_path), git_hash)
- ret, _, err = ce.RunCommandWOutput(move_head_cmd, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ move_head_cmd, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # Failed to checkout to 'git_hash'.
raise ValueError('Failed to moved HEAD in %s to %s: %s' % (quote(src_path),
@@ -269,6 +270,14 @@ def main():
args_output.patch_metadata_file, args_output.packages,
FailureModes(args_output.failure_mode))
+ # Only 'disable_patches' and 'remove_patches' can potentially modify the patch
+ # metadata file.
+ if args_output.failure_mode == FailureModes.DISABLE_PATCHES.value or \
+ args_output.failure_mode == FailureModes.REMOVE_PATCHES.value:
+ print('The patch file %s has been modified for the packages:' %
+ args_output.patch_metadata_file)
+ print('\n'.join(args_output.packages))
+
if __name__ == '__main__':
main()
diff --git a/llvm_tools/update_chromeos_llvm_next_hash.py b/llvm_tools/update_chromeos_llvm_next_hash.py
index e2586a36..aa63b76c 100755
--- a/llvm_tools/update_chromeos_llvm_next_hash.py
+++ b/llvm_tools/update_chromeos_llvm_next_hash.py
@@ -131,7 +131,9 @@ def GetChrootBuildPaths(chromeos_root, package_list):
# Find the chroot path for the package.
ret, chroot_path, err = ce.ChrootRunCommandWOutput(
- chromeos_root=chromeos_root, command=equery_cmd, print_to_console=False)
+ chromeos_root=chromeos_root,
+ command=equery_cmd,
+ print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to get the chroot path
raise ValueError('Failed to get chroot path for the package (%s): %s' %
@@ -268,7 +270,8 @@ def UpdateBuildLLVMNextHash(ebuild_path, llvm_hash, llvm_version):
# Stage the changes.
ret, _, err = ce.RunCommandWOutput(
- 'git -C %s add %s' % (parent_dir, ebuild_path), print_to_console=False)
+ 'git -C %s add %s' % (parent_dir, ebuild_path),
+ print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to stage the changes
raise ValueError('Failed to stage the ebuild for commit: %s' % err)
@@ -332,7 +335,7 @@ def UprevEbuild(symlink):
# Stage the new symlink for commit.
ret, _, err = ce.RunCommandWOutput(
'git -C %s mv %s %s' % (path_to_symlink_dir, symlink, new_symlink),
- print_to_console=False)
+ print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to stage the symlink for commit
raise ValueError('Failed to stage the symlink for commit: %s' % err)
@@ -358,7 +361,8 @@ def _CreateRepo(path_to_repo_dir, llvm_hash):
'repo start llvm-next-update-%s' % llvm_hash,
])
- ret, _, err = ce.RunCommandWOutput(create_repo_cmd, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ create_repo_cmd, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to create a repo for the changes
raise ValueError('Failed to create the repo (llvm-next-update-%s): %s' %
@@ -385,7 +389,8 @@ def _DeleteRepo(path_to_repo_dir, llvm_hash):
'git branch -D llvm-next-update-%s' % llvm_hash
])
- ret, _, err = ce.RunCommandWOutput(delete_repo_cmd, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ delete_repo_cmd, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to delete the repo
raise ValueError('Failed to delete the repo (llvm-next-update-%s): %s' %
@@ -443,7 +448,8 @@ def UploadChanges(path_to_repo_dir, llvm_hash, commit_messages):
commit_cmd = 'cd %s && git commit %s' % (path_to_repo_dir, commit_messages)
- ret, _, err = ce.RunCommandWOutput(commit_cmd, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ commit_cmd, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to commit the changes
raise ValueError('Failed to create a commit for the changes: %s' % err)
@@ -453,7 +459,8 @@ def UploadChanges(path_to_repo_dir, llvm_hash, commit_messages):
'yes | repo upload --br=llvm-next-update-%s --no-verify' % (
path_to_repo_dir, llvm_hash)
- ret, _, err = ce.RunCommandWOutput(upload_change_cmd, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ upload_change_cmd, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # failed to upload the changes for review
raise ValueError('Failed to upload changes for review: %s' % err)
@@ -499,7 +506,7 @@ def RemovePatchesFromFilesDir(patches_to_remove):
for cur_patch in patches_to_remove:
ret, _, err = ce.RunCommandWOutput(
'git -C %s rm -f %s' % (os.path.dirname(cur_patch), cur_patch),
- print_to_console=False)
+ print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # Failed to remove the patch in $FILESDIR.
raise ValueError(
@@ -525,7 +532,8 @@ def StagePatchMetadataFileForCommit(patch_metadata_file_path):
stage_patch_file = 'git -C %s add %s' % (
os.path.dirname(patch_metadata_file_path), patch_metadata_file_path)
- ret, _, err = ce.RunCommandWOutput(stage_patch_file, print_to_console=False)
+ ret, _, err = ce.RunCommandWOutput(
+ stage_patch_file, print_to_console=ce.GetLogLevel() == 'verbose')
if ret: # Failed to stage the patch metadata file for commit.
raise ValueError('Failed to stage patch metadata file %s for commit: %s' %