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
|
||||
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
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,
|
||||
|
|
|
@ -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"])
|
||||
|
||||
|
|
|
@ -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__":
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue