forked from Mirror/pmbootstrap
chroot: replace arch.from_chroot_suffix() with chroot.arch (MR 2252)
Another usage of args dropped! Although the device_arch variable thing is not very ideal... Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
8526631589
commit
fa804c9453
9 changed files with 29 additions and 19 deletions
|
@ -72,6 +72,23 @@ class Chroot:
|
|||
return Path(pmb.config.work, self.dirname)
|
||||
|
||||
|
||||
@property
|
||||
# FIXME: make an Arch type
|
||||
def arch(self) -> str:
|
||||
if self.type == ChrootType.NATIVE:
|
||||
return pmb.config.arch_native
|
||||
if self.type == ChrootType.BUILDROOT:
|
||||
return self.name()
|
||||
# FIXME: this is quite delicate as it will only be valid
|
||||
# for certain pmbootstrap commands... It was like this
|
||||
# before but it should be fixed.
|
||||
arch = pmb.core.get_context().device_arch
|
||||
if arch is not None:
|
||||
return arch
|
||||
|
||||
raise ValueError(f"Invalid chroot suffix: {self}"
|
||||
" (wrong device chosen in 'init' step?)")
|
||||
|
||||
def __eq__(self, other: object) -> bool:
|
||||
if isinstance(other, str):
|
||||
return str(self) == other or self.path == Path(other) or self.name() == other
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue