From 0f7678f033eb286e9e4b58b7b3ca30794cc22d67 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Wed, 18 Sep 2019 18:13:39 +0200 Subject: [PATCH] build: remove QEMU workaround for aarch64 (!1814) QEMU is now at v4.0.0 and the issue was fixed upstream. Fixes #546. --- pmb/build/__init__.py | 1 - pmb/build/init.py | 6 --- pmb/build/qemu_workaround_aarch64.py | 34 ------------- test/test_buildroot_aarch64_init.py | 76 ---------------------------- 4 files changed, 117 deletions(-) delete mode 100644 pmb/build/qemu_workaround_aarch64.py delete mode 100644 test/test_buildroot_aarch64_init.py diff --git a/pmb/build/__init__.py b/pmb/build/__init__.py index a9541dc8..b95e94ea 100644 --- a/pmb/build/__init__.py +++ b/pmb/build/__init__.py @@ -24,4 +24,3 @@ from pmb.build.newapkbuild import newapkbuild from pmb.build.other import copy_to_buildpath, is_necessary, \ index_repo from pmb.build._package import package -from pmb.build.qemu_workaround_aarch64 import qemu_workaround_aarch64 diff --git a/pmb/build/init.py b/pmb/build/init.py index 82d2d799..cab26f08 100644 --- a/pmb/build/init.py +++ b/pmb/build/init.py @@ -92,11 +92,5 @@ def init(args, suffix="native"): "s/^ERROR_CLEANUP=.*/ERROR_CLEANUP=''/", "/etc/abuild.conf"], suffix) - # QEMU workaround (aarch64 only) - arch = pmb.parse.arch.from_chroot_suffix(args, suffix) - emulate = pmb.parse.arch.cpu_emulation_required(args, arch) - if emulate and arch == "aarch64": - pmb.build.qemu_workaround_aarch64(args, suffix) - # Mark the chroot as initialized pmb.chroot.root(args, ["touch", marker], suffix) diff --git a/pmb/build/qemu_workaround_aarch64.py b/pmb/build/qemu_workaround_aarch64.py deleted file mode 100644 index 14541947..00000000 --- a/pmb/build/qemu_workaround_aarch64.py +++ /dev/null @@ -1,34 +0,0 @@ -""" -Copyright 2019 Oliver Smith - -This file is part of pmbootstrap. - -pmbootstrap is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -pmbootstrap is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with pmbootstrap. If not, see . -""" -import pmb.build -import pmb.chroot.apk - - -def qemu_workaround_aarch64(args, suffix="buildroot_aarch64"): - """ - QEMU has a bug in aarch64 emulation, that causes abuild-tar to omit files - from the archives it generates in some cases. We build a patched abuild-tar, - which avoids the bug. - - https://gitlab.com/postmarketOS/pmbootstrap/issues/546 - """ - pkgname = "abuild-aarch64-qemu-workaround" - pmb.build.package(args, pkgname, "aarch64", True, - skip_init_buildenv=True) - pmb.chroot.apk.install(args, [pkgname], suffix, False) diff --git a/test/test_buildroot_aarch64_init.py b/test/test_buildroot_aarch64_init.py deleted file mode 100644 index 79587afe..00000000 --- a/test/test_buildroot_aarch64_init.py +++ /dev/null @@ -1,76 +0,0 @@ -""" -Copyright 2019 Oliver Smith - -This file is part of pmbootstrap. - -pmbootstrap is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -pmbootstrap is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with pmbootstrap. If not, see . -""" - -""" -This file tests all functions from pmb.build._package. -""" - -import glob -import os -import pytest -import sys - -# Import from parent directory -sys.path.insert(0, os.path.realpath( - os.path.join(os.path.dirname(__file__) + "/.."))) -import pmb.build -import pmb.helpers.logging - - -@pytest.fixture -def args(tmpdir, request): - import pmb.parse - sys.argv = ["pmbootstrap", "init"] - args = pmb.parse.arguments() - args.log = args.work + "/log_testsuite.txt" - pmb.helpers.logging.init(args) - request.addfinalizer(args.logfd.close) - return args - - -def test_buildroot_aarch64_init(args, monkeypatch): - # Patch pmb.build.is_necessary() to always build the workaround package - def fake_build_is_necessary(args, arch, apkbuild, apkindex_path=None): - if apkbuild["pkgname"] == "abuild-aarch64-qemu-workaround": - return True - return pmb.build.other.is_necessary(args, arch, apkbuild, - apkindex_path) - monkeypatch.setattr(pmb.build, "is_necessary", - fake_build_is_necessary) - - # Remove aarch64 chroot - pmb.chroot.shutdown(args) - path = args.work + "/chroot_buildroot_aarch64" - if os.path.exists(path): - pmb.helpers.run.root(args, ["rm", "-rf", path]) - - # Remove existing workaround packages - pattern_workaround_apk = (args.work + "/packages/aarch64/" - "abuild-aarch64-qemu-workaround-*") - for match in glob.glob(pattern_workaround_apk): - pmb.helpers.run.root(args, ["rm", match]) - pmb.build.index_repo(args, "aarch64") - - # Build hello-world for aarch64, causing the chroot to initialize properly - pmb.build.package(args, "hello-world", "aarch64", force=True) - - # Verify that the workaround was built and installed - assert len(glob.glob(pattern_workaround_apk)) - assert os.path.exists(args.work + "/chroot_buildroot_aarch64/usr/bin" - "/abuild-tar-patched")