forked from Mirror/pmbootstrap
pmb.aportgen: Use Arch in more places (MR 2432)
This commit is contained in:
parent
bf9f758691
commit
37a0bd02ee
6 changed files with 18 additions and 9 deletions
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import os
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.core.context import get_context
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path
|
||||
from pmb.helpers import logging
|
||||
|
@ -16,13 +17,17 @@ from pmb.types import PmbArgs
|
|||
import pmb.helpers.cli
|
||||
|
||||
|
||||
def get_cross_package_arches(pkgname):
|
||||
def get_cross_package_arches(pkgname: str) -> str:
|
||||
"""
|
||||
Get the arches for which we want to build cross packages.
|
||||
|
||||
:param pkgname: package name, e.g. "gcc-aarch64", "gcc-x86_64"
|
||||
|
||||
:returns: string of architecture(s) (space separated)
|
||||
:returns: string of architecture(s) (space separated). It doesn't
|
||||
necessarily make sense to use Arch here given that this value gets
|
||||
used to write APKBUILD files, where the ``arch`` field can have values
|
||||
that aren't necessarily valid arches like "!armhf", "noarch", or
|
||||
"x86 x86_64".
|
||||
|
||||
"""
|
||||
if pkgname.endswith("-x86_64"):
|
||||
|
|
|
@ -8,11 +8,12 @@ import pmb.chroot.apk_static
|
|||
import pmb.helpers.run
|
||||
import pmb.parse.apkindex
|
||||
from pmb.core import Chroot
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
def generate(pkgname: str) -> None:
|
||||
arch = pkgname.split("-")[2]
|
||||
arch = Arch.from_str(pkgname.split("-")[2])
|
||||
context = get_context()
|
||||
|
||||
# Parse version from APKINDEX
|
||||
|
|
|
@ -6,6 +6,7 @@ import re
|
|||
import pmb.helpers.git
|
||||
import pmb.helpers.run
|
||||
import pmb.helpers.args
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
|
@ -160,7 +161,7 @@ def rewrite(
|
|||
handle.truncate()
|
||||
|
||||
|
||||
def get_upstream_aport(pkgname: str, arch=None):
|
||||
def get_upstream_aport(pkgname: str, arch: Arch | None = None):
|
||||
"""
|
||||
Perform a git checkout of Alpine's aports and get the path to the aport.
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# Copyright 2023 Oliver Smith
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
import pmb.aportgen.core
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.core.context import get_context
|
||||
from pmb.core.pkgrepo import pkgrepo_default_path
|
||||
import pmb.helpers.git
|
||||
|
@ -10,7 +11,7 @@ import pmb.helpers.run
|
|||
def generate(pkgname: str):
|
||||
# Copy original aport
|
||||
prefix = pkgname.split("-")[0]
|
||||
arch = pkgname.split("-")[1]
|
||||
arch = Arch.from_str(pkgname.split("-")[1])
|
||||
context = get_context()
|
||||
if prefix == "gcc":
|
||||
upstream = pmb.aportgen.core.get_upstream_aport("gcc", arch)
|
||||
|
@ -51,7 +52,7 @@ def generate(pkgname: str):
|
|||
|
||||
below_header = (
|
||||
"CTARGET_ARCH="
|
||||
+ arch
|
||||
+ str(arch)
|
||||
+ """
|
||||
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
|
||||
LANG_D=false
|
||||
|
|
|
@ -13,7 +13,7 @@ from pmb.core.context import get_context
|
|||
|
||||
|
||||
def generate(pkgname):
|
||||
arch = "x86"
|
||||
arch = Arch.x86
|
||||
if pkgname != "grub-efi-x86":
|
||||
raise RuntimeError("only grub-efi-x86 is available")
|
||||
package_data = pmb.parse.apkindex.package("grub")
|
||||
|
|
|
@ -8,11 +8,12 @@ import pmb.chroot.apk_static
|
|||
import pmb.helpers.run
|
||||
import pmb.parse.apkindex
|
||||
from pmb.core import Chroot
|
||||
from pmb.core.arch import Arch
|
||||
from pmb.core.context import get_context
|
||||
|
||||
|
||||
def generate(pkgname):
|
||||
arch = pkgname.split("-")[1]
|
||||
def generate(pkgname: str) -> None:
|
||||
arch = Arch.from_str(pkgname.split("-")[1])
|
||||
|
||||
# Parse musl version from APKINDEX
|
||||
package_data = pmb.parse.apkindex.package("musl")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue