diff options
author | Denis Nikitin <denik@chromium.org> | 2022-10-02 23:11:14 -0700 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-10-06 16:37:26 +0000 |
commit | 69ee77f678ba58ee69d0dc6f82183171aeaee796 (patch) | |
tree | 19d9efa57e40c00be0a0bdb4d171f7e6a0c3153d /llvm_tools/update_chromeos_llvm_hash.py | |
parent | b41250738164926d6bf32af054637c5aa9bb88e7 (diff) | |
download | toolchain-utils-69ee77f678ba58ee69d0dc6f82183171aeaee796.tar.gz |
llvm_tools: Fix manifest update
Usually we don't need the manifest update with llvm-next
because pgo is not default there.
Remove default manifest packages from llvm-next.
Add unit test for main.
BUG=None
TEST=unit test
Change-Id: I1ef78be8184985e047db8ae68eda2f01c989a7a5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3932864
Tested-by: Denis Nikitin <denik@chromium.org>
Commit-Queue: Denis Nikitin <denik@chromium.org>
Reviewed-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'llvm_tools/update_chromeos_llvm_hash.py')
-rwxr-xr-x | llvm_tools/update_chromeos_llvm_hash.py | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/llvm_tools/update_chromeos_llvm_hash.py b/llvm_tools/update_chromeos_llvm_hash.py index 31a10867..c52c7328 100755 --- a/llvm_tools/update_chromeos_llvm_hash.py +++ b/llvm_tools/update_chromeos_llvm_hash.py @@ -17,7 +17,7 @@ import os from pathlib import Path import re import subprocess -from typing import Dict, List +from typing import Dict, Iterable import chroot import failure_modes @@ -99,7 +99,7 @@ def GetCommandLineArgs(): parser.add_argument( "--manifest_packages", - default=",".join(DEFAULT_MANIFEST_PACKAGES), + default="", help="Comma-separated ebuilds to update manifests for " "(default: %(default)s)", ) @@ -506,7 +506,7 @@ def StagePackagesPatchResultsForCommit(package_info_dict, commit_messages): return commit_messages -def UpdateManifests(packages: List[str], chroot_path: Path): +def UpdateManifests(packages: Iterable[str], chroot_path: Path): """Updates manifest files for packages. Args: @@ -524,8 +524,8 @@ def UpdateManifests(packages: List[str], chroot_path: Path): def UpdatePackages( - packages, - manifest_packages: List[str], + packages: Iterable[str], + manifest_packages: Iterable[str], llvm_variant, git_hash, svn_version, @@ -672,7 +672,7 @@ def EnsurePackageMaskContains(chroot_path, git_hash): def UpdatePackagesPatchMetadataFile( chroot_path: Path, svn_version: int, - packages: List[str], + packages: Iterable[str], mode: failure_modes.FailureModes, ) -> Dict[str, patch_utils.PatchInfo]: """Updates the packages metadata file. @@ -761,8 +761,14 @@ def main(): git_hash_source ) - packages = args_output.update_packages.split(",") - manifest_packages = args_output.manifest_packages.split(",") + # Filter out empty strings. For example "".split{",") returns [""]. + packages = set(p for p in args_output.update_packages.split(",") if p) + manifest_packages = set( + p for p in args_output.manifest_packages.split(",") if p + ) + if not manifest_packages and not args_output.is_llvm_next: + # Set default manifest packages only for the current llvm. + manifest_packages = set(DEFAULT_MANIFEST_PACKAGES) change_list = UpdatePackages( packages=packages, manifest_packages=manifest_packages, |