Skip to content

Commit 286d1d3

Browse files
committed
config-desktop: install python3-yaml; surface parse_desktop_yaml.py errors
Two related fixes for BUILD_DESKTOP=yes on the configng-based desktop selection path: 1. prepare-host.sh: add 'python3-yaml' to host_dependencies. configng's parse_desktop_yaml.py imports PyYAML, which neither the freshly- prepared docker container nor a from-scratch host had installed, so the parser bombed on every interactive desktop build with: ModuleNotFoundError: No module named 'yaml' 2. config-desktop.sh: stop swallowing the parser's stderr. The previous 'python3 ... 2>/dev/null' meant any parser failure landed in the bash SUBSHELL ERR trap with zero diagnostic, e.g.: Error 1 occurred in SUBSHELL [ at config-desktop.sh:78 ] Error 1 occurred in main shell [ at config-desktop.sh:78 ] Capture stderr to a temp file, capture exit code via '|| de_rc=$?', and on non-zero invoke exit_with_error with the captured stderr inline so the actual cause shows up in the user's log on first run. The 'parser succeeded but returned empty list' branch is unchanged.
1 parent 4726d9b commit 286d1d3

2 files changed

Lines changed: 21 additions & 3 deletions

File tree

lib/functions/configuration/config-desktop.sh

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,25 @@ function interactive_desktop_main_configuration() {
7373
local status_filter="supported"
7474
[[ "${EXPERT}" == "yes" ]] && status_filter="supported,community"
7575

76-
local de_json
76+
# Capture stdout and stderr separately and check the exit code
77+
# explicitly. Previously stderr was redirected to /dev/null and
78+
# only stdout was captured, so a non-zero exit (missing python3
79+
# yaml module, malformed YAML, parser-side argparse change, …)
80+
# left the SUBSHELL ERR trap firing at this line with no
81+
# diagnostic — see the build hang at config-desktop.sh:78
82+
# referenced from production logs.
83+
local de_json de_stderr de_rc=0
84+
de_stderr=$(mktemp)
7785
de_json=$(python3 "${parser}" "${yaml_dir}" --list-json \
78-
"${RELEASE}" "${ARCH}" --status "${status_filter}" 2>/dev/null)
86+
"${RELEASE}" "${ARCH}" --status "${status_filter}" 2>"${de_stderr}") || de_rc=$?
87+
if [[ "${de_rc}" -ne 0 ]]; then
88+
local err_text
89+
err_text=$(cat "${de_stderr}" 2> /dev/null || true)
90+
rm -f "${de_stderr}"
91+
exit_with_error "Desktop parser failed (exit ${de_rc}) for ${RELEASE}/${ARCH}" \
92+
"stderr: ${err_text:-<empty>}"
93+
fi
94+
rm -f "${de_stderr}"
7995
if [[ -z "${de_json}" || "${de_json}" == "[]" ]]; then
8096
exit_with_error "No desktop environments available for ${RELEASE}/${ARCH}" \
8197
"Parser returned an empty list"

lib/functions/host/prepare-host.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,9 @@ function adaptative_prepare_host_dependencies() {
202202
### Python3 -- required for Armbian's Python tooling, and also for more recent u-boot builds. Needs 3.9+; ffi-dev is needed for some Python packages when the wheel is not prebuilt
203203
### 'python3-setuptools' and 'python3-pyelftools' moved to requirements.txt to make sure build hosts use the same/latest versions of these tools.
204204
### 'python3-dev' depends on distutils, so instead depend on libpython3-dev which doesn't.
205-
host_dependencies+=("python3" "libpython3-dev" "libffi-dev")
205+
### 'python3-yaml' is needed by configng's parse_desktop_yaml.py during
206+
### BUILD_DESKTOP=yes (config-desktop.sh::interactive_desktop_main_configuration).
207+
host_dependencies+=("python3" "libpython3-dev" "libffi-dev" "python3-yaml")
206208

207209
# Needed for some u-boot's, lest "tools/mkeficapsule.c:21:10: fatal error: gnutls/gnutls.h"
208210
host_dependencies+=("libgnutls28-dev")

0 commit comments

Comments
 (0)