Fix #90: noarch: create symlinks for all supported architectures
* The supported architectures are inside the config now * Symlinks get created for that list of supported architectures now. * During initialization, the architecture from the selected device gets checked against the list of supported architectures. When it is not included, a meaningful exception gets raised. * the aportgen and (cross-compiler) build tests make use of the new variable now (they had armhf and aarch64 hardcoded previously).
This commit is contained in:
parent
9ab3270b2a
commit
1adeee70b6
|
@ -129,18 +129,17 @@ def symlink_noarch_package(args, arch_apk):
|
||||||
:param arch_apk: for example: x86_64/mypackage-1.2.3-r0.apk
|
:param arch_apk: for example: x86_64/mypackage-1.2.3-r0.apk
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Create the arch folder
|
for arch in pmb.config.build_device_architectures:
|
||||||
device_arch = args.deviceinfo["arch"]
|
# Create the arch folder
|
||||||
device_repo = args.work + "/packages/" + device_arch
|
arch_folder = "/home/user/packages/user/" + arch
|
||||||
if not os.path.exists(device_repo):
|
arch_folder_outside = args.work + "/packages/" + arch
|
||||||
pmb.chroot.user(args, ["mkdir", "-p", "/home/user/packages/user/" +
|
if not os.path.exists(arch_folder_outside):
|
||||||
device_arch])
|
pmb.chroot.user(args, ["mkdir", "-p", arch_folder])
|
||||||
|
|
||||||
# Add symlink, rewrite index
|
# Add symlink, rewrite index
|
||||||
device_repo_chroot = "/home/user/packages/user/" + device_arch
|
pmb.chroot.user(args, ["ln", "-sf", "../" + arch_apk, "."],
|
||||||
pmb.chroot.user(args, ["ln", "-sf", "../" + arch_apk, "."],
|
working_dir=arch_folder)
|
||||||
working_dir=device_repo_chroot)
|
index_repo(args, arch)
|
||||||
index_repo(args, device_arch)
|
|
||||||
|
|
||||||
|
|
||||||
def ccache_stats(args, arch):
|
def ccache_stats(args, arch):
|
||||||
|
|
|
@ -109,6 +109,12 @@ chroot_device_nodes = [
|
||||||
# BUILD
|
# BUILD
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Officially supported target architectures for postmarketOS. Only
|
||||||
|
# specify architectures supported by Alpine here. When creating a noarch
|
||||||
|
# package, symlinks for all architectures get created - so only specify
|
||||||
|
# architectures, where we really have device-* packages for.
|
||||||
|
build_device_architectures = ["armhf", "aarch64"]
|
||||||
|
|
||||||
# Packages, that will be installed in a chroot before it builds packages
|
# Packages, that will be installed in a chroot before it builds packages
|
||||||
# for the first time
|
# for the first time
|
||||||
build_packages = ["abuild", "build-base", "ccache"]
|
build_packages = ["abuild", "build-base", "ccache"]
|
||||||
|
|
|
@ -194,8 +194,18 @@ def arguments():
|
||||||
# Add convinience shortcuts
|
# Add convinience shortcuts
|
||||||
setattr(args, "arch_native", pmb.parse.arch.alpine_native())
|
setattr(args, "arch_native", pmb.parse.arch.alpine_native())
|
||||||
|
|
||||||
# Add the deviceinfo (only after initialization)
|
# Add and verify the deviceinfo (only after initialization)
|
||||||
if args.action != "init":
|
if args.action != "init":
|
||||||
setattr(args, "deviceinfo", pmb.parse.deviceinfo(args))
|
setattr(args, "deviceinfo", pmb.parse.deviceinfo(args))
|
||||||
|
arch = args.deviceinfo["arch"]
|
||||||
|
if (arch != args.arch_native and
|
||||||
|
arch not in pmb.config.build_device_architectures):
|
||||||
|
raise ValueError("Arch '" + arch + "' is not officially enabled"
|
||||||
|
" in postmarketOS yet. However, this should be straight"
|
||||||
|
" forward. Simply enable it in pmb/config/__init__.py"
|
||||||
|
" in build_device_architectures, zap your package cache"
|
||||||
|
" (otherwise you will have issues with noarch packages)"
|
||||||
|
" and try again. Some other things might break, but"
|
||||||
|
" they should be easy to fix them.")
|
||||||
|
|
||||||
return args
|
return args
|
||||||
|
|
|
@ -25,6 +25,7 @@ import filecmp
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.aportgen
|
import pmb.aportgen
|
||||||
|
import pmb.config
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -45,7 +46,7 @@ def test_aportgen(args):
|
||||||
|
|
||||||
# Generate all valid packages
|
# Generate all valid packages
|
||||||
pkgnames = []
|
pkgnames = []
|
||||||
for arch in ["armhf", "aarch64"]:
|
for arch in pmb.config.build_device_architectures:
|
||||||
# gcc twice, so the output folder already exists -> different code path
|
# gcc twice, so the output folder already exists -> different code path
|
||||||
for pkgname in ["binutils", "musl", "gcc", "gcc"]:
|
for pkgname in ["binutils", "musl", "gcc", "gcc"]:
|
||||||
pkgnames.append(pkgname + "-" + arch)
|
pkgnames.append(pkgname + "-" + arch)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import pytest
|
||||||
sys.path.append(os.path.abspath(
|
sys.path.append(os.path.abspath(
|
||||||
os.path.join(os.path.dirname(__file__) + "/..")))
|
os.path.join(os.path.dirname(__file__) + "/..")))
|
||||||
import pmb.aportgen
|
import pmb.aportgen
|
||||||
|
import pmb.config
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -44,5 +45,5 @@ def test_build_cross(args):
|
||||||
"""
|
"""
|
||||||
Build in non-native chroot, with cross-compiler through distcc.
|
Build in non-native chroot, with cross-compiler through distcc.
|
||||||
"""
|
"""
|
||||||
for arch in ["armhf", "aarch64"]:
|
for arch in pmb.config.build_device_architectures:
|
||||||
pmb.build.package(args, "hello-world", arch, True)
|
pmb.build.package(args, "hello-world", arch, True)
|
||||||
|
|
Loading…
Reference in New Issue