Skip to content

Commit

Permalink
Add b4 Kernel Source Modifier
Browse files Browse the repository at this point in the history
b4 patch modifier is a modifier for kernel source
installer. It accepts Message_id and apply the .mbx file using git
  • Loading branch information
adityagesh committed Dec 9, 2024
1 parent a72c30b commit 515fe92
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion lisa/transformers/kernel_source_installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from lisa.base_tools import Mv
from lisa.node import Node
from lisa.operating_system import CBLMariner, Redhat, Ubuntu
from lisa.tools import Cp, Echo, Git, Make, Sed, Uname
from lisa.tools import B4, Cp, Echo, Git, Make, Sed, Uname
from lisa.tools.gcc import Gcc
from lisa.tools.lscpu import Lscpu
from lisa.util import LisaException, field_metadata, subclasses
Expand Down Expand Up @@ -75,6 +75,12 @@ class PatchModifierSchema(BaseModifierSchema):
file_pattern: str = "*.patch"


@dataclass_json()
@dataclass
class B4PatchModifierSchema(BaseModifierSchema):
message_id: str = field(default="", metadata=field_metadata(required=True))


@dataclass_json()
@dataclass
class SourceInstallerSchema(BaseInstallerSchema):
Expand Down Expand Up @@ -489,3 +495,19 @@ def _get_code_path(path: str, node: Node, default_name: str) -> PurePath:
code_path = node.working_path / default_name

return code_path


class B4PatchModifier(BaseModifier):
@classmethod
def type_name(cls) -> str:
return "b4_patch"

@classmethod
def type_schema(cls) -> Type[schema.TypedSchema]:
return B4PatchModifierSchema

def modify(self) -> None:
runbook: B4PatchModifierSchema = self.runbook
b4 = self._node.tools[B4]
message_id = runbook.message_id
b4.apply(message_id=message_id, cwd=self._code_path)

0 comments on commit 515fe92

Please sign in to comment.