diff --git a/pmb/build/_package.py b/pmb/build/_package.py index b6bf2d41..af91abbc 100644 --- a/pmb/build/_package.py +++ b/pmb/build/_package.py @@ -16,8 +16,9 @@ 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 os import logging +import os +import shlex import pmb.build import pmb.build.autodetect @@ -242,7 +243,8 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None, logging.info("(" + suffix + ") build " + output) # Environment variables - env = {"CARCH": arch} + env = {"CARCH": arch, + "SUDO_APK": "abuild-apk --no-progress"} if cross == "native": hostspec = pmb.parse.arch.alpine_to_hostspec(arch) env["CROSS_COMPILE"] = hostspec + "-" @@ -256,7 +258,7 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None, # Build the abuild command cmd = [] for key, value in env.items(): - cmd += [key + "=" + value] + cmd += [key + "=" + shlex.quote(value)] cmd += ["abuild"] if strict: cmd += ["-r"] # install depends with abuild @@ -289,7 +291,8 @@ def finish(args, apkbuild, arch, output, strict=False, suffix="native"): # Uninstall build dependencies (strict mode) if strict: logging.info("(" + suffix + ") uninstall build dependencies") - pmb.chroot.user(args, ["abuild", "undeps"], suffix, "/home/pmos/build") + cmd = ["SUDO_APK='abuild-apk --no-progress'", "abuild", "undeps"] + pmb.chroot.user(args, cmd, suffix, "/home/pmos/build") def package(args, pkgname, arch=None, force=False, strict=False, diff --git a/pmb/chroot/init.py b/pmb/chroot/init.py index 73ac75a8..d44a0ea7 100644 --- a/pmb/chroot/init.py +++ b/pmb/chroot/init.py @@ -135,7 +135,7 @@ def init(args, suffix="native"): chroot + "/usr/bin/qemu-" + arch_debian + "-static"]) # Install alpine-base (no clean exit for non-native chroot!) - pmb.chroot.apk_static.run(args, ["--root", chroot, + pmb.chroot.apk_static.run(args, ["--no-progress", "--root", chroot, "--cache-dir", apk_cache, "--initdb", "--arch", arch, "add", "alpine-base"]) diff --git a/test/check_checksums.py b/test/check_checksums.py index c1999fa3..d32cec64 100755 --- a/test/check_checksums.py +++ b/test/check_checksums.py @@ -64,14 +64,16 @@ def check_checksums(package): def check_build(packages): - command = (["./pmbootstrap.py", "--details-to-stdout", "build", - "--strict"] + list(packages)) - try: - process = subprocess.Popen(command) - process.communicate() - except subprocess.CalledProcessError as e: - print("** Building failed") - exit(1) + # Initialize build environment with less logging + commands = [["build_init"], + ["--details-to-stdout", "build", "--strict"] + list(packages)] + for command in commands: + try: + process = subprocess.Popen(["./pmbootstrap.py"] + command) + process.communicate() + except subprocess.CalledProcessError as e: + print("** Building failed") + exit(1) if __name__ == "__main__": diff --git a/test/test_build_package.py b/test/test_build_package.py index a95c78e7..6226403e 100644 --- a/test/test_build_package.py +++ b/test/test_build_package.py @@ -212,19 +212,21 @@ def test_run_abuild(args, monkeypatch): # Normal run output = "armhf/test-1-r2.apk" - env = {"CARCH": "armhf"} - cmd = ["CARCH=armhf", "abuild", "-d"] + env = {"CARCH": "armhf", "SUDO_APK": "abuild-apk --no-progress"} + sudo_apk = "SUDO_APK='abuild-apk --no-progress'" + cmd = ["CARCH=armhf", sudo_apk, "abuild", "-d"] assert func(args, apkbuild, "armhf") == (output, cmd, env) # Force and strict - cmd = ["CARCH=armhf", "abuild", "-r", "-f"] + cmd = ["CARCH=armhf", sudo_apk, "abuild", "-r", "-f"] assert func(args, apkbuild, "armhf", True, True) == (output, cmd, env) # cross=native env = {"CARCH": "armhf", + "SUDO_APK": "abuild-apk --no-progress", "CROSS_COMPILE": "armv6-alpine-linux-muslgnueabihf-", "CC": "armv6-alpine-linux-muslgnueabihf-gcc"} - cmd = ["CARCH=armhf", "CROSS_COMPILE=armv6-alpine-linux-muslgnueabihf-", + cmd = ["CARCH=armhf", sudo_apk, "CROSS_COMPILE=armv6-alpine-linux-muslgnueabihf-", "CC=armv6-alpine-linux-muslgnueabihf-gcc", "abuild", "-d"] assert func(args, apkbuild, "armhf", cross="native") == (output, cmd, env)