Skip to content

Commit

Permalink
boot_control: remove the API of get_standby_boot_dir, as since 202309…
Browse files Browse the repository at this point in the history
…07, actually this API always returns boot_dir as <standby_slot_mnt>/boot
  • Loading branch information
Bodong-Yang committed Dec 19, 2024
1 parent 4723777 commit 9291beb
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 42 deletions.
5 changes: 1 addition & 4 deletions src/otaclient/boot_control/_grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ def _cleanup_standby_ota_partition_folder(self):
def _copy_boot_files_from_standby_slot(self):
"""Copy boot files under <standby_slot_mp>/boot to standby ota-partition folder."""
standby_ota_partition_dir = self._ota_status_control.standby_ota_status_dir
for f in self._mp_control.standby_boot_dir.iterdir():
for f in (self._mp_control.standby_slot_mount_point / "boot").iterdir():
if f.is_file() and not f.is_symlink():
shutil.copy(f, standby_ota_partition_dir)

Expand All @@ -857,9 +857,6 @@ def _copy_boot_files_from_standby_slot(self):
def get_standby_slot_path(self) -> Path: # pragma: no cover
return self._mp_control.standby_slot_mount_point

def get_standby_boot_dir(self) -> Path: # pragma: no cover
return self._mp_control.standby_boot_dir

def load_version(self) -> str: # pragma: no cover
return self._ota_status_control.load_active_slot_version()

Expand Down
3 changes: 0 additions & 3 deletions src/otaclient/boot_control/_jetson_cboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,6 @@ def _firmware_update(self) -> bool | None:
def get_standby_slot_path(self) -> Path: # pragma: no cover
return self._mp_control.standby_slot_mount_point

def get_standby_boot_dir(self) -> Path: # pragma: no cover
return self._mp_control.standby_boot_dir

def pre_update(self, version: str, *, standby_as_ref: bool, erase_standby: bool):
try:
logger.info("jetson-cboot: pre-update ...")
Expand Down
3 changes: 0 additions & 3 deletions src/otaclient/boot_control/_jetson_uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,6 @@ def _firmware_update(self) -> bool:
def get_standby_slot_path(self) -> Path: # pragma: no cover
return self._mp_control.standby_slot_mount_point

def get_standby_boot_dir(self) -> Path: # pragma: no cover
return self._mp_control.standby_boot_dir

def pre_update(self, version: str, *, standby_as_ref: bool, erase_standby: bool):
try:
logger.info("jetson-uefi: pre-update ...")
Expand Down
3 changes: 0 additions & 3 deletions src/otaclient/boot_control/_rpi_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,6 @@ def _write_standby_fstab(self):
def get_standby_slot_path(self) -> Path: # pragma: no cover
return self._mp_control.standby_slot_mount_point

def get_standby_boot_dir(self) -> Path: # pragma: no cover
return self._mp_control.standby_boot_dir

def pre_update(self, version: str, *, standby_as_ref: bool, erase_standby: bool):
try:
logger.info("rpi_boot: pre-update setup...")
Expand Down
12 changes: 1 addition & 11 deletions src/otaclient/boot_control/_slot_mnt_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pathlib import Path

from otaclient.configs.cfg import cfg
from otaclient_common import cmdhelper, replace_root
from otaclient_common import cmdhelper
from otaclient_common.typing import StrOrPath

logger = logging.getLogger(__name__)
Expand All @@ -46,16 +46,6 @@ def __init__(
self.standby_slot_mount_point = Path(standby_slot_mount_point)
self.active_slot_mount_point = Path(active_slot_mount_point)

# standby slot /boot dir
# NOTE(20230907): this will always be <standby_slot_mp>/boot,
# in the future this attribute will not be used by
# standby slot creater.
self.standby_boot_dir = Path(
replace_root(
cfg.BOOT_DPATH, cfg.CANONICAL_ROOT, self.standby_slot_mount_point
)
)

# ensure the each mount points being umounted at termination
atexit.register(
partial(
Expand Down
18 changes: 0 additions & 18 deletions src/otaclient/boot_control/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
from pathlib import Path
from typing import Protocol

from typing_extensions import deprecated

from otaclient._types import OTAStatus


Expand All @@ -39,22 +37,6 @@ def get_booted_ota_status(self) -> OTAStatus:
def get_standby_slot_path(self) -> Path:
"""Get the Path points to the standby slot mount point."""

@deprecated(
"standby slot creator doesn't need to treat the files under /boot specially"
)
@abstractmethod
def get_standby_boot_dir(self) -> Path:
"""Get the Path points to the standby slot's boot folder.
NOTE(20230907): this will always return the path to
<standby_slots_mount_point>/boot.
DEPRECATED(20230907): standby slot creator doesn't need to
treat the files under /boot specially, it is
boot controller's responsibility to get the
kernel/initrd.img from standby slot and prepare
them to actual boot dir.
"""

@abstractmethod
def load_version(self) -> str:
"""Read the version info from the current slot."""
Expand Down

0 comments on commit 9291beb

Please sign in to comment.