forked from Mirror/pmbootstrap
core: add an Arch type (MR 2252)
Move pmb/parse/arch.py over to core and refactor it as an Arch type, similar to how Chroot was done. Fix all the uses (that I can find) of arch in the codebase that need adjusting. The new Arch type is an Enum, making it clear what architectures can be represented and making it much easier to reason about. Since we support ~5 (kinda) different representations of an Architecture (Alpine, Kernel, target triple, platform, and QEMU), we now formalise that the Alpine format is what we represent internally, with methods to convert to any of the others as-needed. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
505165dc13
commit
866e5bcfab
42 changed files with 389 additions and 303 deletions
|
@ -2,6 +2,7 @@
|
|||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import json
|
||||
from typing import List, Sequence, Tuple
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.helpers import logging
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
@ -67,7 +68,7 @@ def _parse_suffix(args: PmbArgs) -> Chroot:
|
|||
if args.buildroot == "device":
|
||||
return Chroot.buildroot(pmb.parse.deviceinfo().arch)
|
||||
else:
|
||||
return Chroot.buildroot(args.buildroot)
|
||||
return Chroot.buildroot(Arch.from_str(args.buildroot))
|
||||
elif args.suffix:
|
||||
(_t, s) = args.suffix.split("_")
|
||||
t: ChrootType = ChrootType(_t)
|
||||
|
@ -550,7 +551,7 @@ def shutdown(args: PmbArgs):
|
|||
def stats(args: PmbArgs):
|
||||
# Chroot suffix
|
||||
chroot = Chroot.native()
|
||||
if args.arch != pmb.config.arch_native:
|
||||
if args.arch != Arch.native():
|
||||
chroot = Chroot.buildroot(args.arch)
|
||||
|
||||
# Install ccache and display stats
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue