Skip to content

Commit

Permalink
source_installer: handle devtoolset in build_deps
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Boldin <[email protected]>
  • Loading branch information
paboldin committed Aug 10, 2024
1 parent 518ca35 commit 648f442
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,6 @@ def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str) -> Non
)
result.assert_exit_code()

# the gcc version of Redhat 7.x is too old. Upgrade it.
if isinstance(node.os, Redhat) and node.os.information.version < "8.0.0":
node.os.install_packages(["devtoolset-8"])
node.tools[Mv].move("/bin/gcc", "/bin/gcc_back", overwrite=True, sudo=True)
result.assert_exit_code()
result = node.execute(
"ln -s /opt/rh/devtoolset-8/root/usr/bin/gcc /bin/gcc", sudo=True
)
result.assert_exit_code()

make = node.tools[Make]
make.make(arguments="olddefconfig", cwd=code_path)

Expand All @@ -325,6 +315,23 @@ def _install_build_tools(self, node: Node, build_deps: list[str]) -> None:
os.install_packages(package)
os.group_install_packages("Development Tools")

# if the kernel requires devtoolset, install its gcc
devtoolsets = [
pkg
for pkg in build_deps
if pkg.startswith("devtoolset")
]
if devtoolsets:
assert len(devtoolsets) == 1, f"only one devtoolset can be given, instead of {devtoolsets}"
devtoolset = devtoolsets[0]
node.os.install_packages(devtoolset)
node.tools[Mv].move("/bin/gcc", "/bin/gcc_back", overwrite=True, sudo=True)
result.assert_exit_code()
result = node.execute(
f"ln -s /opt/rh/{devtoolset}/root/usr/bin/gcc /bin/gcc", sudo=True
)
result.assert_exit_code(f"can not link {devtoolset} to gcc")

if os.information.version < "8.0.0":
# git from default CentOS/RedHat 7.x does not support git tag format
# syntax temporarily use a community repo, then remove it
Expand Down

0 comments on commit 648f442

Please sign in to comment.