aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/llvm_patch_management.py
diff options
context:
space:
mode:
authorJian Cai <jiancai@google.com>2020-04-15 17:53:41 -0700
committerJian Cai <jiancai@google.com>2020-04-17 01:17:18 +0000
commitc16daa1eb92cba9781a557798b065747128acfb1 (patch)
tree66b489e45c1227bc89be29a6fc20bee885e3256f /llvm_tools/llvm_patch_management.py
parent9258b055847fcefb635c0aa74d5be08e699ab37c (diff)
downloadtoolchain-utils-c16daa1eb92cba9781a557798b065747128acfb1.tar.gz
llvm_tools: move common functions into standalone modules
Move common functions into separate modules and update dependencies accordingly. BUG=chromium:1057428 TEST=local tests. Change-Id: I40f1b613f0a41f1fc478c811379c851479aff7c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2151708 Reviewed-by: Manoj Gupta <manojgupta@chromium.org> Reviewed-by: George Burgess <gbiv@chromium.org> Tested-by: Jian Cai <jiancai@google.com>
Diffstat (limited to 'llvm_tools/llvm_patch_management.py')
-rwxr-xr-xllvm_tools/llvm_patch_management.py26
1 files changed, 12 insertions, 14 deletions
diff --git a/llvm_tools/llvm_patch_management.py b/llvm_tools/llvm_patch_management.py
index ef8b65c8..90f9a5c0 100755
--- a/llvm_tools/llvm_patch_management.py
+++ b/llvm_tools/llvm_patch_management.py
@@ -3,23 +3,21 @@
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+#
+# pylint: disable=global-statement
"""Creates the arguments for the patch manager for LLVM."""
from __future__ import print_function
import argparse
-import get_llvm_hash
import os
-import patch_manager
-from assert_not_in_chroot import VerifyOutsideChroot
from failure_modes import FailureModes
-from get_llvm_hash import CreateTempLLVMRepo
-from get_llvm_hash import GetGoogle3LLVMVersion
-from get_llvm_hash import LLVMHash
-from subprocess_helpers import ChrootRunCommand
-from subprocess_helpers import ExecCommandAndCaptureOutput
+import chroot
+import get_llvm_hash
+import patch_manager
+import subprocess_helpers
# If set to `True`, then the contents of `stdout` after executing a command will
# be displayed to the terminal.
@@ -123,7 +121,7 @@ def GetPathToFilesDirectory(chroot_path, package):
raise ValueError('Invalid chroot provided: %s' % chroot_path)
# Get the absolute chroot path to the ebuild.
- chroot_ebuild_path = ChrootRunCommand(
+ chroot_ebuild_path = subprocess_helpers.ChrootRunCommand(
chroot_path, ['equery', 'w', package], verbose=verbose)
# Get the absolute chroot path to $FILESDIR's parent directory.
@@ -180,7 +178,7 @@ def _MoveSrcTreeHEADToGitHash(src_path, git_hash):
move_head_cmd = ['git', '-C', src_path, 'checkout', git_hash]
- ExecCommandAndCaptureOutput(move_head_cmd, verbose=verbose)
+ subprocess_helpers.ExecCommandAndCaptureOutput(move_head_cmd, verbose=verbose)
def UpdatePackagesPatchMetadataFile(chroot_path, svn_version,
@@ -206,10 +204,10 @@ def UpdatePackagesPatchMetadataFile(chroot_path, svn_version,
# that has information on the patches.
package_info = {}
- llvm_hash = LLVMHash()
+ llvm_hash = get_llvm_hash.LLVMHash()
with llvm_hash.CreateTempDirectory() as temp_dir:
- with CreateTempLLVMRepo(temp_dir) as src_path:
+ with get_llvm_hash.CreateTempLLVMRepo(temp_dir) as src_path:
# Ensure that 'svn_version' exists in the chromiumum mirror of LLVM by
# finding its corresponding git hash.
git_hash = get_llvm_hash.GetGitHashFrom(src_path, svn_version)
@@ -247,14 +245,14 @@ def main():
AssertionError: The script was run inside the chroot.
"""
- VerifyOutsideChroot()
+ chroot.VerifyOutsideChroot()
args_output = GetCommandLineArgs()
# Get the google3 LLVM version if a LLVM version was not provided.
llvm_version = args_output.llvm_version
if llvm_version in ('', 'google3', 'google3-unstable'):
- llvm_version = GetGoogle3LLVMVersion(
+ llvm_version = get_llvm_hash.GetGoogle3LLVMVersion(
stable=llvm_version != 'google3-unstable')
UpdatePackagesPatchMetadataFile(args_output.chroot_path, llvm_version,