args.arch_native: remove (MR 2130)

Replace "args.arch_native" with the direct function call in order to
avoid passing "args" to all functions. This is a step to get rid of this
args-passed-to-all-functions pattern in pmbootstrap.
This commit is contained in:
bo41 2021-10-16 18:33:27 +02:00 committed by Oliver Smith
parent f2966e62ae
commit caf7973e24
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
24 changed files with 57 additions and 64 deletions

View File

@ -15,7 +15,7 @@ def generate(args, pkgname):
fields = { fields = {
"pkgname": pkgname, "pkgname": pkgname,
"pkgdesc": f"Tools necessary to build programs for {arch} targets", "pkgdesc": f"Tools necessary to build programs for {arch} targets",
"arch": args.arch_native, "arch": pmb.config.arch_native,
"makedepends_build": "", "makedepends_build": "",
"makedepends_host": "", "makedepends_host": "",
"makedepends": "gettext libtool autoconf automake bison texinfo", "makedepends": "gettext libtool autoconf automake bison texinfo",

View File

@ -47,7 +47,7 @@ def generate(args, pkgname):
url="http://busybox.net" url="http://busybox.net"
license="GPL2" license="GPL2"
arch="{args.arch_native}" arch="{pmb.config.arch_native}"
options="!check !strip" options="!check !strip"
pkgdesc="Statically linked Busybox for $_arch" pkgdesc="Statically linked Busybox for $_arch"
_target="$(arch_to_hostspec $_arch)" _target="$(arch_to_hostspec $_arch)"

View File

@ -28,7 +28,7 @@ def generate(args, pkgname):
fields = { fields = {
"pkgname": pkgname, "pkgname": pkgname,
"pkgdesc": f"Stage2 cross-compiler for {arch}", "pkgdesc": f"Stage2 cross-compiler for {arch}",
"arch": args.arch_native, "arch": pmb.config.arch_native,
"depends": f"isl binutils-{arch} mpc1", "depends": f"isl binutils-{arch} mpc1",
"makedepends_build": "gcc g++ bison flex texinfo gawk zip" "makedepends_build": "gcc g++ bison flex texinfo gawk zip"
" gmp-dev mpfr-dev mpc1-dev zlib-dev", " gmp-dev mpfr-dev mpc1-dev zlib-dev",

View File

@ -43,7 +43,7 @@ def generate(args, pkgname):
pkgdesc="GRUB $_arch EFI files for every architecture" pkgdesc="GRUB $_arch EFI files for every architecture"
url="https://www.gnu.org/software/grub/" url="https://www.gnu.org/software/grub/"
license="GPL-3.0-or-later" license="GPL-3.0-or-later"
arch="{args.arch_native}" arch="{pmb.config.arch_native}"
source="grub-efi-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk::$_mirror/{mirrordir}/main/$_arch/grub-efi-$pkgver-r$pkgrel.apk" source="grub-efi-$pkgver-r$pkgrel-$_arch-{mirrordir}.apk::$_mirror/{mirrordir}/main/$_arch/grub-efi-$pkgver-r$pkgrel.apk"
package() {{ package() {{

View File

@ -42,7 +42,7 @@ def generate(args, pkgname):
pkgname={pkgname} pkgname={pkgname}
pkgver={pkgver} pkgver={pkgver}
pkgrel={pkgrel} pkgrel={pkgrel}
arch="{args.arch_native}" arch="{pmb.config.arch_native}"
subpackages="musl-dev-{arch}:package_dev" subpackages="musl-dev-{arch}:package_dev"
_arch="{arch}" _arch="{arch}"

View File

@ -196,7 +196,7 @@ def init_buildenv(args, apkbuild, arch, strict=False, force=False, cross=None,
depends_arch = arch depends_arch = arch
if cross == "native": if cross == "native":
depends_arch = args.arch_native depends_arch = pmb.config.arch_native
# Build dependencies # Build dependencies
depends, built = build_depends(args, apkbuild, depends_arch, strict) depends, built = build_depends(args, apkbuild, depends_arch, strict)
@ -236,7 +236,7 @@ def get_gcc_version(args, arch):
:returns: a string like "6.4.0-r5" :returns: a string like "6.4.0-r5"
""" """
return pmb.parse.apkindex.package(args, "gcc-" + arch, return pmb.parse.apkindex.package(args, "gcc-" + arch,
args.arch_native)["version"] pmb.config.arch_native)["version"]
def get_pkgver(original_pkgver, original_source=False, now=None): def get_pkgver(original_pkgver, original_source=False, now=None):
@ -493,7 +493,7 @@ def package(args, pkgname, arch=None, force=False, strict=False,
output path relative to the packages folder ("armhf/ab-1-r2.apk") output path relative to the packages folder ("armhf/ab-1-r2.apk")
""" """
# Once per session is enough # Once per session is enough
arch = arch or args.arch_native arch = arch or pmb.config.arch_native
if skip_already_built(args, pkgname, arch): if skip_already_built(args, pkgname, arch):
return return
@ -505,7 +505,7 @@ def package(args, pkgname, arch=None, force=False, strict=False,
# Detect the build environment (skip unnecessary builds) # Detect the build environment (skip unnecessary builds)
if not check_build_for_arch(args, pkgname, arch): if not check_build_for_arch(args, pkgname, arch):
return return
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch) suffix = pmb.build.autodetect.suffix(apkbuild, arch)
cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix) cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix)
if not init_buildenv(args, apkbuild, arch, strict, force, cross, suffix, if not init_buildenv(args, apkbuild, arch, strict, force, cross, suffix,
skip_init_buildenv, src): skip_init_buildenv, src):

View File

@ -50,8 +50,10 @@ def arch(args, pkgname):
apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD") apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
arches = apkbuild["arch"] arches = apkbuild["arch"]
if "noarch" in arches or "all" in arches or args.arch_native in arches: if ("noarch" in arches or
return args.arch_native "all" in arches or
pmb.config.arch_native in arches):
return pmb.config.arch_native
arch_device = args.deviceinfo["arch"] arch_device = args.deviceinfo["arch"]
if arch_device in arches: if arch_device in arches:
@ -63,8 +65,8 @@ def arch(args, pkgname):
return None return None
def suffix(args, apkbuild, arch): def suffix(apkbuild, arch):
if arch == args.arch_native: if arch == pmb.config.arch_native:
return "native" return "native"
if "pmb:cross-native" in apkbuild["options"]: if "pmb:cross-native" in apkbuild["options"]:
@ -79,7 +81,7 @@ def crosscompile(args, apkbuild, arch, suffix):
""" """
if not args.cross: if not args.cross:
return None return None
if not pmb.parse.arch.cpu_emulation_required(args, arch): if not pmb.parse.arch.cpu_emulation_required(arch):
return None return None
if suffix == "native": if suffix == "native":
return "native" return "native"

View File

@ -142,7 +142,7 @@ def run_abuild(args, pkgname, arch, apkbuild_path, kbuild_out):
# Create the apk package # Create the apk package
env = {"CARCH": arch, env = {"CARCH": arch,
"CHOST": arch, "CHOST": arch,
"CBUILD": args.arch_native, "CBUILD": pmb.config.arch_native,
"SUDO_APK": "abuild-apk --no-progress"} "SUDO_APK": "abuild-apk --no-progress"}
cmd = ["abuild", "rootpkg"] cmd = ["abuild", "rootpkg"]
pmb.chroot.user(args, cmd, working_dir=build_path, env=env) pmb.chroot.user(args, cmd, working_dir=build_path, env=env)
@ -177,11 +177,11 @@ def package_kernel(args):
else: else:
function_body = pmb.parse.function_body(aport + "/APKBUILD", "package") function_body = pmb.parse.function_body(aport + "/APKBUILD", "package")
kbuild_out = find_kbuild_output_dir(function_body) kbuild_out = find_kbuild_output_dir(function_body)
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch) suffix = pmb.build.autodetect.suffix(apkbuild, arch)
# Install package dependencies # Install package dependencies
depends, _ = pmb.build._package.build_depends( depends, _ = pmb.build._package.build_depends(
args, apkbuild, args.arch_native, strict=False) args, apkbuild, pmb.config.arch_native, strict=False)
pmb.build.init(args, suffix) pmb.build.init(args, suffix)
pmb.chroot.apk.install(args, depends, suffix) pmb.chroot.apk.install(args, depends, suffix)

View File

@ -91,7 +91,7 @@ def menuconfig(args, pkgname, use_oldconfig):
aport = pmb.helpers.pmaports.find(args, pkgname) aport = pmb.helpers.pmaports.find(args, pkgname)
apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD") apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
arch = args.arch or get_arch(apkbuild) arch = args.arch or get_arch(apkbuild)
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch) suffix = pmb.build.autodetect.suffix(apkbuild, arch)
cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix) cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix)
hostspec = pmb.parse.arch.alpine_to_hostspec(arch) hostspec = pmb.parse.arch.alpine_to_hostspec(arch)

View File

@ -141,7 +141,7 @@ def download(args, file):
""" """
channel_cfg = pmb.config.pmaports.read_config_channel(args) channel_cfg = pmb.config.pmaports.read_config_channel(args)
mirrordir = channel_cfg["mirrordir_alpine"] mirrordir = channel_cfg["mirrordir_alpine"]
base_url = f"{args.mirror_alpine}{mirrordir}/main/{args.arch_native}" base_url = f"{args.mirror_alpine}{mirrordir}/main/{pmb.config.arch_native}"
return pmb.helpers.http.download(args, f"{base_url}/{file}", file) return pmb.helpers.http.download(args, f"{base_url}/{file}", file)

View File

@ -43,7 +43,7 @@ def mark_in_chroot(args, suffix="native"):
def setup_qemu_emulation(args, suffix): def setup_qemu_emulation(args, suffix):
arch = pmb.parse.arch.from_chroot_suffix(args, suffix) arch = pmb.parse.arch.from_chroot_suffix(args, suffix)
if not pmb.parse.arch.cpu_emulation_required(args, arch): if not pmb.parse.arch.cpu_emulation_required(arch):
return return
chroot = f"{args.work}/chroot_{suffix}" chroot = f"{args.work}/chroot_{suffix}"

View File

@ -90,6 +90,6 @@ def shutdown(args, only_install_related=False):
# Clean up the rest # Clean up the rest
for arch in pmb.config.build_device_architectures: for arch in pmb.config.build_device_architectures:
if pmb.parse.arch.cpu_emulation_required(args, arch): if pmb.parse.arch.cpu_emulation_required(arch):
pmb.chroot.binfmt.unregister(args, arch) pmb.chroot.binfmt.unregister(args, arch)
logging.debug("Shutdown complete") logging.debug("Shutdown complete")

View File

@ -158,7 +158,9 @@ def zap_pkgs_online_mismatch(args, confirm=True, dry=False):
# Iterate over existing apk caches # Iterate over existing apk caches
for path in paths: for path in paths:
arch = os.path.basename(path).split("_", 2)[2] arch = os.path.basename(path).split("_", 2)[2]
suffix = "native" if arch == args.arch_native else f"buildroot_{arch}" suffix = f"buildroot_{arch}"
if arch == pmb.config.arch_native:
suffix = "native"
# Clean the cache with apk # Clean the cache with apk
logging.info(f"({suffix}) apk -v cache clean") logging.info(f"({suffix}) apk -v cache clean")

View File

@ -2,6 +2,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
import multiprocessing import multiprocessing
import os import os
import pmb.parse.arch
import sys import sys
# #
@ -18,6 +19,7 @@ from pmb.config.merge_with_args import merge_with_args
version = "1.38.0" version = "1.38.0"
pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..") pmb_src = os.path.normpath(os.path.realpath(__file__) + "/../../..")
apk_keys_path = pmb_src + "/pmb/data/keys" apk_keys_path = pmb_src + "/pmb/data/keys"
arch_native = pmb.parse.arch.alpine_native()
# apk-tools minimum version # apk-tools minimum version
# https://pkgs.alpinelinux.org/packages?name=apk-tools&branch=edge # https://pkgs.alpinelinux.org/packages?name=apk-tools&branch=edge

View File

@ -31,15 +31,7 @@ import pmb.helpers.git
args.device ("samsung-i9100", "qemu-amd64" etc.) args.device ("samsung-i9100", "qemu-amd64" etc.)
args.work ("/home/user/.local/var/pmbootstrap", override with --work) args.work ("/home/user/.local/var/pmbootstrap", override with --work)
3. Shortcuts 3. Cache
Long variables or function calls that always return the same information
may have a shortcut defined, to make the code more readable (see
add_shortcuts() below).
Example:
args.arch_native ("x86_64" etc.)
4. Cache
pmbootstrap uses this dictionary to save the result of expensive pmbootstrap uses this dictionary to save the result of expensive
results, so they work a lot faster the next time they are needed in the results, so they work a lot faster the next time they are needed in the
same session. Usually the cache is written to and read from in the same same session. Usually the cache is written to and read from in the same
@ -54,7 +46,7 @@ import pmb.helpers.git
See add_cache() below for details. See add_cache() below for details.
5. Parsed configs 4. Parsed configs
Similar to the cache above, specific config files get parsed and added Similar to the cache above, specific config files get parsed and added
to args, so they can get accessed quickly (without parsing the configs to args, so they can get accessed quickly (without parsing the configs
over and over). These configs are not only used in one specific over and over). These configs are not only used in one specific
@ -116,11 +108,6 @@ def replace_placeholders(args):
setattr(args, key, os.path.expanduser(getattr(args, key))) setattr(args, key, os.path.expanduser(getattr(args, key)))
def add_shortcuts(args):
""" Add convenience shortcuts """
setattr(args, "arch_native", pmb.parse.arch.alpine_native())
def add_cache(args): def add_cache(args):
""" Add a caching dict (caches parsing of files etc. for the current """ Add a caching dict (caches parsing of files etc. for the current
session) """ session) """
@ -142,7 +129,7 @@ def add_deviceinfo(args):
""" Add and verify the deviceinfo (only after initialization) """ """ Add and verify the deviceinfo (only after initialization) """
setattr(args, "deviceinfo", pmb.parse.deviceinfo(args)) setattr(args, "deviceinfo", pmb.parse.deviceinfo(args))
arch = args.deviceinfo["arch"] arch = args.deviceinfo["arch"]
if (arch != args.arch_native and if (arch != pmb.config.arch_native and
arch not in pmb.config.build_device_architectures): arch not in pmb.config.build_device_architectures):
raise ValueError("Arch '" + arch + "' is not available in" raise ValueError("Arch '" + arch + "' is not available in"
" postmarketOS. If you would like to add it, see:" " postmarketOS. If you would like to add it, see:"
@ -154,7 +141,6 @@ def init(args):
fix_mirrors_postmarketos(args) fix_mirrors_postmarketos(args)
pmb.config.merge_with_args(args) pmb.config.merge_with_args(args)
replace_placeholders(args) replace_placeholders(args)
add_shortcuts(args)
add_cache(args) add_cache(args)
# Initialize logs (we could raise errors below) # Initialize logs (we could raise errors below)

View File

@ -507,7 +507,7 @@ def shutdown(args):
def stats(args): def stats(args):
# Chroot suffix # Chroot suffix
suffix = "native" suffix = "native"
if args.arch != args.arch_native: if args.arch != pmb.config.arch_native:
suffix = "buildroot_" + args.arch suffix = "buildroot_" + args.arch
# Install ccache and display stats # Install ccache and display stats

View File

@ -96,7 +96,7 @@ def apkindex_files(args, arch=None, user_repository=True, pmos=True,
:returns: list of absolute APKINDEX.tar.gz file paths :returns: list of absolute APKINDEX.tar.gz file paths
""" """
if not arch: if not arch:
arch = args.arch_native arch = pmb.config.arch_native
ret = [] ret = []
# Local user repository (for packages compiled with pmbootstrap) # Local user repository (for packages compiled with pmbootstrap)
@ -209,7 +209,7 @@ def alpine_apkindex_path(args, repo="main", arch=None):
raise RuntimeError("Invalid Alpine repository: " + repo) raise RuntimeError("Invalid Alpine repository: " + repo)
# Download the file # Download the file
arch = arch or args.arch_native arch = arch or pmb.config.arch_native
update(args, arch) update(args, arch)
# Find it on disk # Find it on disk

View File

@ -282,7 +282,7 @@ def providers(args, package, arch=None, must_exist=True, indexes=None):
""" """
if not indexes: if not indexes:
arch = arch or args.arch_native arch = arch or pmb.config.arch_native
indexes = pmb.helpers.repo.apkindex_files(args, arch) indexes = pmb.helpers.repo.apkindex_files(args, arch)
for operator in [">", ">=", "=", "<=", "<", "~"]: for operator in [">", ">=", "=", "<=", "<", "~"]:

View File

@ -1,7 +1,8 @@
# Copyright 2021 Oliver Smith # Copyright 2021 Oliver Smith
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
import platform
import fnmatch import fnmatch
import platform
import pmb.parse.arch
def alpine_native(): def alpine_native():
@ -22,7 +23,7 @@ def alpine_native():
def from_chroot_suffix(args, suffix): def from_chroot_suffix(args, suffix):
if suffix == "native": if suffix == "native":
return args.arch_native return pmb.config.arch_native
if suffix in [f"rootfs_{args.device}", f"installer_{args.device}"]: if suffix in [f"rootfs_{args.device}", f"installer_{args.device}"]:
return args.deviceinfo["arch"] return args.deviceinfo["arch"]
if suffix.startswith("buildroot_"): if suffix.startswith("buildroot_"):
@ -95,9 +96,9 @@ def alpine_to_hostspec(arch):
" to the right hostspec value") " to the right hostspec value")
def cpu_emulation_required(args, arch): def cpu_emulation_required(arch):
# Obvious case: host arch is target arch # Obvious case: host arch is target arch
if args.arch_native == arch: if pmb.config.arch_native == arch:
return False return False
# Other cases: host arch on the left, target archs on the right # Other cases: host arch on the left, target archs on the right
@ -106,8 +107,8 @@ def cpu_emulation_required(args, arch):
"armv7": ["armel", "armhf"], "armv7": ["armel", "armhf"],
"aarch64": ["armel", "armhf", "armv7"], "aarch64": ["armel", "armhf", "armv7"],
} }
if args.arch_native in not_required: if pmb.config.arch_native in not_required:
if arch in not_required[args.arch_native]: if arch in not_required[pmb.config.arch_native]:
return False return False
# No match: then it's required # No match: then it's required

View File

@ -416,7 +416,7 @@ def arguments_newapkbuild(subparser):
def arguments_kconfig(subparser): def arguments_kconfig(subparser):
# Allowed architectures # Allowed architectures
arch_native = pmb.parse.arch.alpine_native() arch_native = pmb.config.arch_native
arch_choices = set(pmb.config.build_device_architectures + [arch_native]) arch_choices = set(pmb.config.build_device_architectures + [arch_native])
# Kconfig subparser # Kconfig subparser
@ -476,7 +476,7 @@ def arguments_repo_missing(subparser):
if argcomplete: if argcomplete:
package.completer = package_completer package.completer = package_completer
ret.add_argument("--arch", choices=pmb.config.build_device_architectures, ret.add_argument("--arch", choices=pmb.config.build_device_architectures,
default=pmb.parse.arch.alpine_native()) default=pmb.config.arch_native)
ret.add_argument("--built", action="store_true", ret.add_argument("--built", action="store_true",
help="include packages which exist in the binary repos") help="include packages which exist in the binary repos")
ret.add_argument("--overview", action="store_true", ret.add_argument("--overview", action="store_true",
@ -523,7 +523,7 @@ def add_packages_arg(subparser, name="packages", *args, **kwargs):
def arguments(): def arguments():
parser = argparse.ArgumentParser(prog="pmbootstrap") parser = argparse.ArgumentParser(prog="pmbootstrap")
arch_native = pmb.parse.arch.alpine_native() arch_native = pmb.config.arch_native
arch_choices = set(pmb.config.build_device_architectures + [arch_native]) arch_choices = set(pmb.config.build_device_architectures + [arch_native])
mirrors_pmos_default = pmb.config.defaults["mirrors_postmarketos"] mirrors_pmos_default = pmb.config.defaults["mirrors_postmarketos"]

View File

@ -108,7 +108,7 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
# QEMU mach-virt's max CPU count is 8, limit it so it will work correctly # QEMU mach-virt's max CPU count is 8, limit it so it will work correctly
# on systems with more than 8 CPUs # on systems with more than 8 CPUs
if arch != args.arch_native and ncpus > 8: if arch != pmb.config.arch_native and ncpus > 8:
ncpus = 8 ncpus = 8
if args.host_qemu: if args.host_qemu:
@ -130,7 +130,7 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
rootfs_native + "/usr/share"}) rootfs_native + "/usr/share"})
command = [] command = []
if args.arch_native in ["aarch64", "armv7"]: if pmb.config.arch_native in ["aarch64", "armv7"]:
# Workaround for QEMU failing on aarch64 asymetric multiprocessor # Workaround for QEMU failing on aarch64 asymetric multiprocessor
# arch (big/little architecture # arch (big/little architecture
# https://en.wikipedia.org/wiki/ARM_big.LITTLE) see # https://en.wikipedia.org/wiki/ARM_big.LITTLE) see
@ -141,12 +141,12 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
logging.info("QEMU will run on big/little architecture on the" logging.info("QEMU will run on big/little architecture on the"
f" first {ncpus} cores (from /proc/cpuinfo)") f" first {ncpus} cores (from /proc/cpuinfo)")
command += [rootfs_native + "/lib/ld-musl-" + command += [rootfs_native + "/lib/ld-musl-" +
args.arch_native + ".so.1"] pmb.config.arch_native + ".so.1"]
command += [rootfs_native + "/usr/bin/taskset"] command += [rootfs_native + "/usr/bin/taskset"]
command += ["-c", "0-" + str(ncpus - 1)] command += ["-c", "0-" + str(ncpus - 1)]
command += [rootfs_native + "/lib/ld-musl-" + command += [rootfs_native + "/lib/ld-musl-" +
args.arch_native + ".so.1"] pmb.config.arch_native + ".so.1"]
command += ["--library-path=" + rootfs_native + "/lib:" + command += ["--library-path=" + rootfs_native + "/lib:" +
rootfs_native + "/usr/lib:" + rootfs_native + "/usr/lib:" +
rootfs_native + "/usr/lib/pulseaudio"] rootfs_native + "/usr/lib/pulseaudio"]
@ -189,7 +189,7 @@ def command_qemu(args, arch, img_path, img_path_2nd=None):
" yet.") " yet.")
# Kernel Virtual Machine (KVM) support # Kernel Virtual Machine (KVM) support
native = args.arch_native == args.deviceinfo["arch"] native = pmb.config.arch_native == args.deviceinfo["arch"]
if args.qemu_kvm and native and os.path.exists("/dev/kvm"): if args.qemu_kvm and native and os.path.exists("/dev/kvm"):
command += ["-enable-kvm"] command += ["-enable-kvm"]
command += ["-cpu", "host"] command += ["-cpu", "host"]

View File

@ -315,7 +315,7 @@ def test_finish(args, monkeypatch):
assert "Package not found" in str(e.value) assert "Package not found" in str(e.value)
# Existing output path # Existing output path
func(args, apkbuild, args.arch_native, output) func(args, apkbuild, pmb.config.arch_native, output)
def test_package(args): def test_package(args):
@ -362,7 +362,7 @@ def test_build_depends_high_level(args, monkeypatch):
# Remove hello-world # Remove hello-world
pmb.helpers.run.root(args, ["rm", output_hello_outside]) pmb.helpers.run.root(args, ["rm", output_hello_outside])
pmb.build.index_repo(args, args.arch_native) pmb.build.index_repo(args, pmb.config.arch_native)
args.cache["built"] = {} args.cache["built"] = {}
# Ask to build the wrapper. It should not build the wrapper (it exists, not # Ask to build the wrapper. It should not build the wrapper (it exists, not
@ -414,7 +414,7 @@ def test_build_local_source_high_level(args, tmpdir):
# Test native arch and foreign arch chroot # Test native arch and foreign arch chroot
channel = pmb.config.pmaports.read_config(args)["channel"] channel = pmb.config.pmaports.read_config(args)["channel"]
for arch in [args.arch_native, "armhf"]: for arch in [pmb.config.arch_native, "armhf"]:
# Delete all hello-world --src packages # Delete all hello-world --src packages
pattern = f"{args.work}/packages/{channel}/{arch}/hello-world-*_p*.apk" pattern = f"{args.work}/packages/{channel}/{arch}/hello-world-*_p*.apk"
for path in glob.glob(pattern): for path in glob.glob(pattern):
@ -432,5 +432,5 @@ def test_build_local_source_high_level(args, tmpdir):
pmb.helpers.run.root(args, ["rm", paths[0]]) pmb.helpers.run.root(args, ["rm", paths[0]])
# Clean up: update index, delete temp folder # Clean up: update index, delete temp folder
pmb.build.index_repo(args, args.arch_native) pmb.build.index_repo(args, pmb.config.arch_native)
pmb.helpers.run.root(args, ["rm", "-r", tmpdir]) pmb.helpers.run.root(args, ["rm", "-r", tmpdir])

View File

@ -27,8 +27,8 @@ def test_keys(args):
# Get the alpine-keys apk filename # Get the alpine-keys apk filename
pmb.chroot.init(args) pmb.chroot.init(args)
version = pmb.parse.apkindex.package(args, "alpine-keys")["version"] version = pmb.parse.apkindex.package(args, "alpine-keys")["version"]
pattern = (args.work + "/cache_apk_" + args.arch_native + "/alpine-keys-" + pattern = (args.work + "/cache_apk_" + pmb.config.arch_native +
version + ".*.apk") "/alpine-keys-" + version + ".*.apk")
filename = os.path.basename(glob.glob(pattern)[0]) filename = os.path.basename(glob.glob(pattern)[0])
# Extract it to a temporary folder # Extract it to a temporary folder

View File

@ -142,7 +142,7 @@ def test_pkgrel_bump_high_level(args, tmpdir):
# Delete package with previous soname (--auto-dry exits with >0 now) # Delete package with previous soname (--auto-dry exits with >0 now)
channel = pmb.config.pmaports.read_config(args)["channel"] channel = pmb.config.pmaports.read_config(args)["channel"]
arch = args.arch_native arch = pmb.config.arch_native
apk_path = f"{tmpdir}/packages/{channel}/{arch}/testlib-1.0-r0.apk" apk_path = f"{tmpdir}/packages/{channel}/{arch}/testlib-1.0-r0.apk"
pmb.helpers.run.root(args, ["rm", apk_path]) pmb.helpers.run.root(args, ["rm", apk_path])
pmbootstrap(args, tmpdir, ["index"]) pmbootstrap(args, tmpdir, ["index"])