aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan R Abrahams-Whitehead <ajordanr@google.com>2023-07-21 17:40:49 +0000
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-07-25 18:27:18 +0000
commitcc7c8d148ca349366e4a5d124b8d8b8c1444b9ae (patch)
treee87c117df0d2c0f629d32c268304379a9ed8ce74
parent99e441aedcd071ecfb72f14a86b9566ee52bbda9 (diff)
downloadtoolchain-utils-cc7c8d148ca349366e4a5d124b8d8b8c1444b9ae.tar.gz
llvm_tools: Types for ConvertChrootPathsToAbsolutePaths
We'll use this later in the patch stack. Also do some minor formatting clean up while we're here. BUG=None TEST=None Change-Id: I6d0b06d2d9ffeb9c07a485382620e6a00824a543 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/4708692 Tested-by: Jordan Abrahams-Whitehead <ajordanr@google.com> Reviewed-by: George Burgess <gbiv@chromium.org> Reviewed-by: Ryan Beltran <ryanbeltran@chromium.org> Commit-Queue: Jordan Abrahams-Whitehead <ajordanr@google.com>
-rwxr-xr-xllvm_tools/chroot.py13
1 files changed, 5 insertions, 8 deletions
diff --git a/llvm_tools/chroot.py b/llvm_tools/chroot.py
index 2ec989c4..cb0ebc87 100755
--- a/llvm_tools/chroot.py
+++ b/llvm_tools/chroot.py
@@ -11,6 +11,7 @@ import collections
import os
from pathlib import Path
import subprocess
+from typing import List
CommitContents = collections.namedtuple("CommitContents", ["url", "cl_number"])
@@ -74,7 +75,10 @@ def GetChrootEbuildPaths(chromeos_root, packages):
return chroot_paths
-def ConvertChrootPathsToAbsolutePaths(chromeos_root, chroot_paths):
+def ConvertChrootPathsToAbsolutePaths(
+ chromeos_root: str,
+ chroot_paths: List[str],
+) -> List[str]:
"""Converts the chroot path(s) to absolute symlink path(s).
Args:
@@ -90,11 +94,8 @@ def ConvertChrootPathsToAbsolutePaths(chromeos_root, chroot_paths):
"""
abs_paths = []
-
chroot_prefix = "/mnt/host/source/"
-
# Iterate through the chroot paths.
- #
# For each chroot file path, remove '/mnt/host/source/' prefix
# and combine the chroot path with the result and add it to the list.
for chroot_path in chroot_paths:
@@ -102,12 +103,8 @@ def ConvertChrootPathsToAbsolutePaths(chromeos_root, chroot_paths):
raise ValueError(
"Invalid prefix for the chroot path: %s" % chroot_path
)
-
rel_path = chroot_path[len(chroot_prefix) :]
-
# combine the chromeos root path + '/src/...'
abs_path = os.path.join(chromeos_root, rel_path)
-
abs_paths.append(abs_path)
-
return abs_paths