Skip to content

Commit 3ffa63c

Browse files
author
Generate.yml
committed
Update anyvm-org/blissos-builder from base builder
1 parent a111b32 commit 3ffa63c

2 files changed

Lines changed: 64 additions & 20 deletions

File tree

.github/tpl/README.tpl.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ All the supported releases are here:
1212

1313
{{RELEASE_TABLE}}
1414

15-
15+
{{DESKTOP_TABLE}}
1616

1717
How to build:
1818

build.py

Lines changed: 63 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,28 @@ def _sh_quiet(cmdstr):
9696
return r.returncode
9797

9898

99+
def _run_loud(cmd, **kw):
100+
"""Like _run_quiet, but echo the command and let whatever it prints stream
101+
straight to our stdout/stderr instead of capturing it. setup() uses this
102+
(via a local alias) so each host-dependency step is announced in the log
103+
as it starts -- a slow or hung install is then obvious from which command
104+
was echoed last, instead of the whole phase sitting silent."""
105+
log("setup: + " + " ".join(map(str, cmd)))
106+
r = subprocess.run(cmd, **kw)
107+
if r.returncode != 0:
108+
log("FAILED (rc=%d): %s" % (r.returncode, " ".join(map(str, cmd))))
109+
return r
110+
111+
112+
def _sh_loud(cmdstr):
113+
"""Shell-string variant of _run_loud (output streams live)."""
114+
log("setup: + " + cmdstr)
115+
rc = subprocess.call(cmdstr, shell=True)
116+
if rc != 0:
117+
log("FAILED (rc=%d): %s" % (rc, cmdstr))
118+
return rc
119+
120+
99121
def state(osname, suffix):
100122
return "%s.%s" % (osname, suffix)
101123

@@ -1589,21 +1611,27 @@ def closeConsole():
15891611
# ============================================================================
15901612

15911613
def setup(install_ocr=None):
1592-
"""Install host dependencies. All package-manager output is captured and
1593-
only printed on failure -- normal runs stay quiet."""
1594-
log("setup: installing host dependencies (silent unless something fails)")
1614+
"""Install host dependencies. Each package-manager step is echoed to the
1615+
log as it starts (and whatever it prints streams live), so a slow or hung
1616+
install is identifiable from the last command shown instead of the phase
1617+
sitting silent. The apt -q / pip -q flags stay on, so the log is not
1618+
flooded with per-package chatter -- only the step markers and any errors
1619+
appear. Alias the quiet run-helpers to their loud variants for the length
1620+
of this function so the call sites below need no change."""
1621+
_run_quiet = _run_loud
1622+
_sh_quiet = _sh_loud
1623+
log("setup: installing host dependencies (each step echoed below)")
15951624
if is_linux():
15961625
apt_env = dict(os.environ)
15971626
apt_env["DEBIAN_FRONTEND"] = "noninteractive"
1598-
_run_quiet(["sudo", "-E", "apt-get", "update", "-qq"], env=apt_env)
1599-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1600-
"zstd", "qemu-utils", "qemu-system-x86", "ovmf", "expect",
1601-
"sshpass", "netcat-openbsd"], env=apt_env)
1627+
_run_quiet(["sudo", "-E", "apt-get", "update", "-q"], env=apt_env)
1628+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
1629+
"zstd", "qemu-utils", "qemu-system-x86", "sshpass",
1630+
"netcat-openbsd"], env=apt_env)
16021631
if install_ocr:
1603-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1632+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
16041633
"tesseract-ocr", "python3-pil",
1605-
"tesseract-ocr-eng", "tesseract-ocr-script-latn",
1606-
"python3-opencv", "python3-pip"], env=apt_env)
1634+
"tesseract-ocr-eng", "python3-pip"], env=apt_env)
16071635
# Use opencv-python-HEADLESS, not the full opencv-python wheel: the
16081636
# full wheel needs libGL.so.1, which headless CI runners (GitHub
16091637
# Actions) lack, so `import cv2` raises ImportError there. cv2 is
@@ -1621,6 +1649,8 @@ def setup(install_ocr=None):
16211649
# Use `sys.executable -m pip`, not bare `pip3`: on GitHub
16221650
# runners pip3 and the python3 running build.py can resolve to
16231651
# different interpreters / site-packages.
1652+
log("setup: installing PaddleOCR -- the paddlepaddle wheel is "
1653+
"hundreds of MB, expect this step to take a few minutes")
16241654
if _sh_quiet(pip + " --break-system-packages "
16251655
"paddlepaddle 'paddleocr>=3.7'") != 0:
16261656
_sh_quiet(pip + " paddlepaddle 'paddleocr>=3.7'")
@@ -1668,16 +1698,16 @@ def setup(install_ocr=None):
16681698
if os.path.exists(vp):
16691699
_run_quiet(["sudo", "ln", "-sf", vp, "/usr/local/bin/vncdotool"])
16701700
if env("VM_ARCH") == "riscv64":
1671-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1701+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
16721702
"qemu-system-misc", "u-boot-qemu"], env=apt_env)
16731703
if env("VM_ARCH") == "aarch64":
1674-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1704+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
16751705
"qemu-system-arm", "qemu-efi-aarch64"], env=apt_env)
16761706
if env("VM_ARCH") == "s390x":
16771707
# qemu-system-s390x ships in its own package on Ubuntu (NOT in
16781708
# qemu-system-misc); its s390-ccw.img firmware comes with the
16791709
# qemu-system-data dependency.
1680-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1710+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
16811711
"qemu-system-s390x"], env=apt_env)
16821712
# A conf may ship its own QEMU build as a tarball (bin/ +
16831713
# share/qemu layout, built against the runner's distro libs;
@@ -1693,15 +1723,15 @@ def setup(install_ocr=None):
16931723
if env("VM_ARCH") == "sparc64":
16941724
# qemu-system-sparc64 (sun4u + bundled OpenBIOS) ships in the
16951725
# qemu-system-sparc package; no separate firmware package needed.
1696-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1726+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
16971727
"qemu-system-sparc"], env=apt_env)
16981728
if env("VM_ARCH") in ("powerpc64", "powerpc64le", "ppc64", "ppc64le"):
16991729
# qemu-system-ppc64 (pseries machine) ships in the qemu-system-ppc
17001730
# package; its SLOF firmware (/usr/share/qemu/slof.bin) is bundled
17011731
# with it, so no separate firmware package is needed. The GitHub
17021732
# ubuntu runner image does NOT preinstall this, hence the explicit
17031733
# apt-get (a local dev box may already have it from qemu-system).
1704-
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-qq",
1734+
_run_quiet(["sudo", "-E", "apt-get", "install", "-y", "-q", "--no-install-recommends",
17051735
"qemu-system-ppc"], env=apt_env)
17061736
# Make /dev/kvm usable by the current shell user. On GitHub Actions
17071737
# runners (and most desktop distros) the device is mode crw-rw----
@@ -3303,11 +3333,25 @@ def _restart():
33033333
log(extra)
33043334
# Same relaxed keepalive as the install step above: a long CPU burst
33053335
# in the guest must not get the stdin-fed script killed mid-run.
3336+
#
3337+
# CHECK THE EXIT CODE. The desktop hooks (xfce.sh/gnome.sh/kde6.sh,
3338+
# openbsd vm_*.sh) run `set -e`, so a failed `pkg install` aborts them
3339+
# non-zero. build.py used to ignore that rc and export the image
3340+
# anyway: a transient "pkg: No packages available matching
3341+
# 'plasma6-plasma'" left the FreeBSD 15.1-kde6 v2.1.8 artifact with NO
3342+
# desktop, yet the build still went green and was published. Fail the
3343+
# build on any non-zero rc so a desktop-less image is never shipped.
3344+
# One failure is a failure -- no retry; rerun the job to recover from a
3345+
# transient repo-catalogue hiccup.
33063346
with open(extra, "rb") as f:
3307-
subprocess.run(["ssh", "-o", "SendEnv=VM_RELEASE",
3308-
"-o", "ServerAliveInterval=30",
3309-
"-o", "ServerAliveCountMax=20",
3310-
osname, "sh"], stdin=f)
3347+
rc = subprocess.run(["ssh", "-o", "SendEnv=VM_RELEASE",
3348+
"-o", "ServerAliveInterval=30",
3349+
"-o", "ServerAliveCountMax=20",
3350+
osname, "sh"], stdin=f).returncode
3351+
if rc != 0:
3352+
log("VM_EXTRA_SCRIPT %s FAILED rc=%d; aborting (refusing to ship "
3353+
"an image whose extra script did not complete)" % (extra, rc))
3354+
return 1
33113355

33123356
shutdown_and_wait()
33133357

0 commit comments

Comments
 (0)