Skip to content

Commit

Permalink
source installer: add local version
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Olshanov <[email protected]>
  • Loading branch information
Konstantin Olshanov committed Oct 25, 2024
1 parent 53b68ed commit ed269b6
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ class SourceInstallerSchema(BaseInstallerSchema):
# Additional build dependencies
build_deps: List[str] = field(default_factory=list)

# Kernel local version
kernel_local_version: str = field(
default="",
metadata=field_metadata(
required=False,
),
)

class SourceInstaller(BaseInstaller):
_code_path: PurePath
Expand Down Expand Up @@ -162,8 +169,10 @@ def install(self) -> str:
self._modify_code(node=node, code_path=self._code_path)

kconfig_file = runbook.kernel_config_file
local_version = runbook.kernel_local_version
self._build_code(
node=node, code_path=self._code_path, kconfig_file=kconfig_file
node=node, code_path=self._code_path, kconfig_file=kconfig_file,
local_version=local_version
)

self._install_build(node=node, code_path=self._code_path)
Expand Down Expand Up @@ -230,7 +239,7 @@ 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) -> None:
def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str, local_version: str) -> None:
self._log.info("building code...")

uname = node.tools[Uname]
Expand Down Expand Up @@ -264,6 +273,13 @@ def _build_code(self, node: Node, code_path: PurePath, kconfig_file: str) -> Non
sudo=True,
)

result = node.execute(
f"scripts/config --set-str LOCALVERSION '{local_version}'",
cwd=code_path,
shell=True,
)
result.assert_exit_code()

# workaround failures.
#
# make[1]: *** No rule to make target 'debian/canonical-certs.pem',
Expand Down

0 comments on commit ed269b6

Please sign in to comment.