mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
build: Add logic to use default extensions if none are found
Currently, the Bazel build may fail if symlinks to the Bazel extension files are not linked to the proper locations. To make sure the build always works (falling back on default extensions), configure the script to create the symlinks to the default files in case they don't exist or are broken symlinks. Change-Id: Ie385e4ede912d0f40026ef6c78a9c2fb60ca8924 Signed-off-by: John Moon <quic_johmoo@quicinc.com>
This commit is contained in:
parent
77e6e012b8
commit
20ed5f73a6
|
|
@ -3,6 +3,7 @@
|
|||
# Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
|
||||
import argparse
|
||||
import errno
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
|
|
@ -13,6 +14,10 @@ CPU = "aarch64"
|
|||
HOST_CROSSTOOL = "@bazel_tools//tools/cpp:toolchain"
|
||||
HOST_TARGETS = ["dtc"]
|
||||
DEFAULT_SKIP_LIST = ["abi", "test_mapping"]
|
||||
MSM_EXTENSIONS = "build/msm_kernel_extensions.bzl"
|
||||
ABL_EXTENSIONS = "build/abl_extensions.bzl"
|
||||
DEFAULT_MSM_EXTENSIONS_SRC = "../msm-kernel/msm_kernel_extensions.bzl"
|
||||
DEFAULT_ABL_EXTENSIONS_SRC = "../bootable/bootloader/edk2/abl_extensions.bzl"
|
||||
|
||||
|
||||
class BazelBuilder:
|
||||
|
|
@ -33,6 +38,7 @@ class BazelBuilder:
|
|||
self.skip_list = skip_list
|
||||
self.user_opts = user_opts
|
||||
self.process_list = []
|
||||
self.setup_extensions()
|
||||
|
||||
def __del__(self):
|
||||
for proc in self.process_list:
|
||||
|
|
@ -48,6 +54,29 @@ class BazelBuilder:
|
|||
"--host_crosstool_top={}".format(HOST_CROSSTOOL),
|
||||
]
|
||||
|
||||
def setup_extensions(self):
|
||||
"""Set up the extension files if needed"""
|
||||
for (ext, def_src) in [
|
||||
(MSM_EXTENSIONS, DEFAULT_MSM_EXTENSIONS_SRC),
|
||||
(ABL_EXTENSIONS, DEFAULT_ABL_EXTENSIONS_SRC),
|
||||
]:
|
||||
ext_path = os.path.join(self.workspace, ext)
|
||||
# If the file doesn't exist or is a dead link, link to the default
|
||||
try:
|
||||
os.stat(ext_path)
|
||||
except OSError as e:
|
||||
if e.errno == errno.ENOENT:
|
||||
logging.info(
|
||||
"%s does not exist or is a broken symlink... linking to default at %s",
|
||||
ext,
|
||||
def_src,
|
||||
)
|
||||
if os.path.islink(ext_path):
|
||||
os.unlink(ext_path)
|
||||
os.symlink(def_src, ext_path)
|
||||
else:
|
||||
raise e
|
||||
|
||||
def get_build_targets(self):
|
||||
"""Query for build targets"""
|
||||
logging.info("Querying build targets...")
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user