Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Few improvements to source installer #3249

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
source installed: add ability to amend config values
Add ability to enable/disable config entry or set it to 'm'.

Signed-off-by: Konstantin Olshanov <kolshanov@cloudlinux.com>
  • Loading branch information
Konstantin Olshanov committed Apr 4, 2024
commit 7a8474d76fc6262f4f71f127effbb8a140105049
47 changes: 45 additions & 2 deletions lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
@@ -104,6 +104,12 @@ class SourceInstallerSchema(BaseInstallerSchema):
),
)

# Config options
kernel_config_enable: List[str] = field(default_factory=list)
kernel_config_disable: List[str] = field(default_factory=list)
kernel_config_module: List[str] = field(default_factory=list)


class SourceInstaller(BaseInstaller):
_code_path: PurePath

@@ -191,9 +197,13 @@ def install(self) -> str:

kconfig_file = runbook.kernel_config_file
local_version = runbook.kernel_local_version
kconfig_enable = runbook.kernel_config_enable
kconfig_disable = runbook.kernel_config_disable
kconfig_module = runbook.kernel_config_module
self._build_code(
node=node, code_path=self._code_path, kconfig_file=kconfig_file,
local_version=local_version
local_version=local_version, kconfig_enable=kconfig_enable,
kconfig_disable=kconfig_disable, kconfig_module=kconfig_module,
)

self._install_build(node=node, code_path=self._code_path)
@@ -274,7 +284,16 @@ def _modify_code(self, node: Node, code_path: PurePath) -> None:
self._log.debug(f"modifying code by {modifier.type_name()}")
modifier.modify()

def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str, local_version: str) -> None:
def _build_code(
self,
node: Node,
code_path: PurePath,
kconfig_file: str,
local_version: str,
kconfig_enable: list[str],
kconfig_disable: list[str],
kconfig_module: list[str],
) -> None:
self._log.info("building code...")

uname = node.tools[Uname]
@@ -340,6 +359,30 @@ def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str, local_
)
result.assert_exit_code()

for config_option in kconfig_enable:
result = node.execute(
f"scripts/config --enable {config_option}",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

for config_option in kconfig_disable:
result = node.execute(
f"scripts/config --disable {config_option}",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

for config_option in kconfig_module:
result = node.execute(
f"scripts/config --module {config_option}",
cwd=code_path,
shell=True,
)
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"])
Loading
Oops, something went wrong.