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
|
# Copyright 2023 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
import os
|
import os
|
||||||
|
from pmb.core.arch import Arch
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
from pmb.core.pkgrepo import pkgrepo_default_path
|
from pmb.core.pkgrepo import pkgrepo_default_path
|
||||||
from pmb.helpers import logging
|
from pmb.helpers import logging
|
||||||
|
@ -16,13 +17,17 @@ from pmb.types import PmbArgs
|
||||||
import pmb.helpers.cli
|
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.
|
Get the arches for which we want to build cross packages.
|
||||||
|
|
||||||
:param pkgname: package name, e.g. "gcc-aarch64", "gcc-x86_64"
|
: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"):
|
if pkgname.endswith("-x86_64"):
|
||||||
|
|
|
@ -8,11 +8,12 @@ import pmb.chroot.apk_static
|
||||||
import pmb.helpers.run
|
import pmb.helpers.run
|
||||||
import pmb.parse.apkindex
|
import pmb.parse.apkindex
|
||||||
from pmb.core import Chroot
|
from pmb.core import Chroot
|
||||||
|
from pmb.core.arch import Arch
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
|
|
||||||
|
|
||||||
def generate(pkgname: str) -> None:
|
def generate(pkgname: str) -> None:
|
||||||
arch = pkgname.split("-")[2]
|
arch = Arch.from_str(pkgname.split("-")[2])
|
||||||
context = get_context()
|
context = get_context()
|
||||||
|
|
||||||
# Parse version from APKINDEX
|
# Parse version from APKINDEX
|
||||||
|
|
|
@ -6,6 +6,7 @@ import re
|
||||||
import pmb.helpers.git
|
import pmb.helpers.git
|
||||||
import pmb.helpers.run
|
import pmb.helpers.run
|
||||||
import pmb.helpers.args
|
import pmb.helpers.args
|
||||||
|
from pmb.core.arch import Arch
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
|
|
||||||
|
|
||||||
|
@ -160,7 +161,7 @@ def rewrite(
|
||||||
handle.truncate()
|
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.
|
Perform a git checkout of Alpine's aports and get the path to the aport.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Copyright 2023 Oliver Smith
|
# Copyright 2023 Oliver Smith
|
||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
import pmb.aportgen.core
|
import pmb.aportgen.core
|
||||||
|
from pmb.core.arch import Arch
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
from pmb.core.pkgrepo import pkgrepo_default_path
|
from pmb.core.pkgrepo import pkgrepo_default_path
|
||||||
import pmb.helpers.git
|
import pmb.helpers.git
|
||||||
|
@ -10,7 +11,7 @@ import pmb.helpers.run
|
||||||
def generate(pkgname: str):
|
def generate(pkgname: str):
|
||||||
# Copy original aport
|
# Copy original aport
|
||||||
prefix = pkgname.split("-")[0]
|
prefix = pkgname.split("-")[0]
|
||||||
arch = pkgname.split("-")[1]
|
arch = Arch.from_str(pkgname.split("-")[1])
|
||||||
context = get_context()
|
context = get_context()
|
||||||
if prefix == "gcc":
|
if prefix == "gcc":
|
||||||
upstream = pmb.aportgen.core.get_upstream_aport("gcc", arch)
|
upstream = pmb.aportgen.core.get_upstream_aport("gcc", arch)
|
||||||
|
@ -51,7 +52,7 @@ def generate(pkgname: str):
|
||||||
|
|
||||||
below_header = (
|
below_header = (
|
||||||
"CTARGET_ARCH="
|
"CTARGET_ARCH="
|
||||||
+ arch
|
+ str(arch)
|
||||||
+ """
|
+ """
|
||||||
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
|
CTARGET="$(arch_to_hostspec ${CTARGET_ARCH})"
|
||||||
LANG_D=false
|
LANG_D=false
|
||||||
|
|
|
@ -13,7 +13,7 @@ from pmb.core.context import get_context
|
||||||
|
|
||||||
|
|
||||||
def generate(pkgname):
|
def generate(pkgname):
|
||||||
arch = "x86"
|
arch = Arch.x86
|
||||||
if pkgname != "grub-efi-x86":
|
if pkgname != "grub-efi-x86":
|
||||||
raise RuntimeError("only grub-efi-x86 is available")
|
raise RuntimeError("only grub-efi-x86 is available")
|
||||||
package_data = pmb.parse.apkindex.package("grub")
|
package_data = pmb.parse.apkindex.package("grub")
|
||||||
|
|
|
@ -8,11 +8,12 @@ import pmb.chroot.apk_static
|
||||||
import pmb.helpers.run
|
import pmb.helpers.run
|
||||||
import pmb.parse.apkindex
|
import pmb.parse.apkindex
|
||||||
from pmb.core import Chroot
|
from pmb.core import Chroot
|
||||||
|
from pmb.core.arch import Arch
|
||||||
from pmb.core.context import get_context
|
from pmb.core.context import get_context
|
||||||
|
|
||||||
|
|
||||||
def generate(pkgname):
|
def generate(pkgname: str) -> None:
|
||||||
arch = pkgname.split("-")[1]
|
arch = Arch.from_str(pkgname.split("-")[1])
|
||||||
|
|
||||||
# Parse musl version from APKINDEX
|
# Parse musl version from APKINDEX
|
||||||
package_data = pmb.parse.apkindex.package("musl")
|
package_data = pmb.parse.apkindex.package("musl")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue