Skip to content

Commit

Permalink
jetson-common: update to bspversion dump
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodong-Yang committed Jun 14, 2024
1 parent aa0b5fb commit baf6fee
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/otaclient/app/boot_control/_jetson_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,9 @@ def parse(cls, _in: str | BSPVersion | Any) -> Self:
return cls(int(major_ver), int(major_rev), int(minor_rev))
raise ValueError(f"expect str or BSPVersion instance, get {type(_in)}")

@staticmethod
def dump(to_export: BSPVersion) -> str:
def dump(self) -> str:
"""Dump BSPVersion to string as "Rxx.yy.z"."""
return f"R{to_export.major_ver}.{to_export.major_rev}.{to_export.minor_rev}"
return f"R{self.major_ver}.{self.major_rev}.{self.minor_rev}"


BSPVersionStr = Annotated[
Expand Down
2 changes: 1 addition & 1 deletion src/otaclient/app/boot_control/_jetson_uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def write_firmware_update_hint_file(
Schema: <slot_id>,<bsp_version>
"""
write_str_to_file_sync(hint_fpath, f"{slot_id},{BSPVersion.dump(bsp_version)}")
write_str_to_file_sync(hint_fpath, f"{slot_id},{bsp_version.dump()}")

@staticmethod
def parse_firmware_update_hint_file(
Expand Down
3 changes: 1 addition & 2 deletions tests/test_otaclient/test_boot_control/test_jetson_cboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import pytest

from otaclient.app.boot_control import _jetson_cboot
from otaclient.app.boot_control._jetson_cboot import _CBootControl
from otaclient.app.boot_control._jetson_common import (
BSPVersion,
FirmwareBSPVersion,
Expand Down Expand Up @@ -70,7 +69,7 @@ def test_parse(self, _in: str, expected: BSPVersion):
),
)
def test_dump(self, _in: BSPVersion, expected: str):
assert BSPVersion.dump(_in) == expected
assert _in.dump() == expected


@pytest.mark.parametrize(
Expand Down

0 comments on commit baf6fee

Please sign in to comment.