Fix screwed up progress bars in Travis output (#1213)
Right now, they appear on screen when using --details-to-stdout. This does not work well with Travis CI and screws up the log. Disabling the progress bars in abuild works just like Alpine does it in their Travis CI script: Exporting SUDO_APK as "abuild-apk --no-progress" instead of "abuild-apk". test_check_checksums.py: Run "pmbootstrap build_init" before building any packages, so it is a bit less verbose (downloading the APKINDEX files etc.). Later we run the build init code again (because we use --strict while building the packages), but then the APKINDEX files are already present. So overall the log is a bit shorter before the building starts. (It is still logged to the logfile, which gets printed on error anyway.)
This commit is contained in:
parent
c232c98851
commit
3fe75ddb56
|
@ -16,8 +16,9 @@ GNU General Public License for more details.
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
|
||||||
import pmb.build
|
import pmb.build
|
||||||
import pmb.build.autodetect
|
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)
|
logging.info("(" + suffix + ") build " + output)
|
||||||
|
|
||||||
# Environment variables
|
# Environment variables
|
||||||
env = {"CARCH": arch}
|
env = {"CARCH": arch,
|
||||||
|
"SUDO_APK": "abuild-apk --no-progress"}
|
||||||
if cross == "native":
|
if cross == "native":
|
||||||
hostspec = pmb.parse.arch.alpine_to_hostspec(arch)
|
hostspec = pmb.parse.arch.alpine_to_hostspec(arch)
|
||||||
env["CROSS_COMPILE"] = hostspec + "-"
|
env["CROSS_COMPILE"] = hostspec + "-"
|
||||||
|
@ -256,7 +258,7 @@ def run_abuild(args, apkbuild, arch, strict=False, force=False, cross=None,
|
||||||
# Build the abuild command
|
# Build the abuild command
|
||||||
cmd = []
|
cmd = []
|
||||||
for key, value in env.items():
|
for key, value in env.items():
|
||||||
cmd += [key + "=" + value]
|
cmd += [key + "=" + shlex.quote(value)]
|
||||||
cmd += ["abuild"]
|
cmd += ["abuild"]
|
||||||
if strict:
|
if strict:
|
||||||
cmd += ["-r"] # install depends with abuild
|
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)
|
# Uninstall build dependencies (strict mode)
|
||||||
if strict:
|
if strict:
|
||||||
logging.info("(" + suffix + ") uninstall build dependencies")
|
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,
|
def package(args, pkgname, arch=None, force=False, strict=False,
|
||||||
|
|
|
@ -135,7 +135,7 @@ def init(args, suffix="native"):
|
||||||
chroot + "/usr/bin/qemu-" + arch_debian + "-static"])
|
chroot + "/usr/bin/qemu-" + arch_debian + "-static"])
|
||||||
|
|
||||||
# Install alpine-base (no clean exit for non-native chroot!)
|
# 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,
|
"--cache-dir", apk_cache, "--initdb", "--arch", arch,
|
||||||
"add", "alpine-base"])
|
"add", "alpine-base"])
|
||||||
|
|
||||||
|
|
|
@ -64,14 +64,16 @@ def check_checksums(package):
|
||||||
|
|
||||||
|
|
||||||
def check_build(packages):
|
def check_build(packages):
|
||||||
command = (["./pmbootstrap.py", "--details-to-stdout", "build",
|
# Initialize build environment with less logging
|
||||||
"--strict"] + list(packages))
|
commands = [["build_init"],
|
||||||
try:
|
["--details-to-stdout", "build", "--strict"] + list(packages)]
|
||||||
process = subprocess.Popen(command)
|
for command in commands:
|
||||||
process.communicate()
|
try:
|
||||||
except subprocess.CalledProcessError as e:
|
process = subprocess.Popen(["./pmbootstrap.py"] + command)
|
||||||
print("** Building failed")
|
process.communicate()
|
||||||
exit(1)
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("** Building failed")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
|
@ -212,19 +212,21 @@ def test_run_abuild(args, monkeypatch):
|
||||||
|
|
||||||
# Normal run
|
# Normal run
|
||||||
output = "armhf/test-1-r2.apk"
|
output = "armhf/test-1-r2.apk"
|
||||||
env = {"CARCH": "armhf"}
|
env = {"CARCH": "armhf", "SUDO_APK": "abuild-apk --no-progress"}
|
||||||
cmd = ["CARCH=armhf", "abuild", "-d"]
|
sudo_apk = "SUDO_APK='abuild-apk --no-progress'"
|
||||||
|
cmd = ["CARCH=armhf", sudo_apk, "abuild", "-d"]
|
||||||
assert func(args, apkbuild, "armhf") == (output, cmd, env)
|
assert func(args, apkbuild, "armhf") == (output, cmd, env)
|
||||||
|
|
||||||
# Force and strict
|
# 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)
|
assert func(args, apkbuild, "armhf", True, True) == (output, cmd, env)
|
||||||
|
|
||||||
# cross=native
|
# cross=native
|
||||||
env = {"CARCH": "armhf",
|
env = {"CARCH": "armhf",
|
||||||
|
"SUDO_APK": "abuild-apk --no-progress",
|
||||||
"CROSS_COMPILE": "armv6-alpine-linux-muslgnueabihf-",
|
"CROSS_COMPILE": "armv6-alpine-linux-muslgnueabihf-",
|
||||||
"CC": "armv6-alpine-linux-muslgnueabihf-gcc"}
|
"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"]
|
"CC=armv6-alpine-linux-muslgnueabihf-gcc", "abuild", "-d"]
|
||||||
assert func(args, apkbuild, "armhf", cross="native") == (output, cmd, env)
|
assert func(args, apkbuild, "armhf", cross="native") == (output, cmd, env)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue