commit b2b2be5d69847aefe098006077ea6f52024847b2
Author: Scott Kostyshak <[email protected]>
Date: Thu Jun 26 16:47:08 2025 +0200
lyxbuild: store copies of commands run
Use a helper function which echos the command into a build script
(for easy sharing with others), then runs the command and
appropriately logs the command's output.
---
development/lyx-tester/lyxbuild | 49 +++++++++++++++++++++++++++++++++++------
1 file changed, 42 insertions(+), 7 deletions(-)
diff --git a/development/lyx-tester/lyxbuild b/development/lyx-tester/lyxbuild
index e35b957fba..c50e40209e 100755
--- a/development/lyx-tester/lyxbuild
+++ b/development/lyx-tester/lyxbuild
@@ -27,6 +27,41 @@
set -o nounset
LOGS_D=../"build-logs"
+
+# this is for easy reproducing
+build_script_f="${LOGS_D}/build-commands"
+
+
+# First argument is the name of the log, and the rest is the command
+# that will be run. The command will also be stored in a build script.
+# The output of the command will be stored in the corresponding log file.
+# (https://unix.stackexchange.com/a/106777/197212)
+function runthis() {
+ # DBG: sometimes useful to just echo directly.
+ #echo "$@"
+
+ echo "$@" >> "${build_script_f}"
+
+ # (https://stackoverflow.com/a/9057699/1376404)
+ # todo: sanity check the log name. use whitelist?
+ #
+ # Alternative, could use the binary name (e.g., make, python, cmake) and
+ # derive the log name from there.
+ LOG="${LOGS_D}/$1"
+ shift
+
+ # TODO: first need to clean up STDERR from other outputs
+ # The following tee's STDERR:
+ # note: order is not reliable.
+ # (https://stackoverflow.com/a/63714773/1376404)
+ #"$@" \
+ # 2> >(tee -a "${LOG}" >&2) \
+ # > >(tee -a "${LOG}" >/dev/null)
+
+ "$@" >> "${LOG}" 2>&1
+}
+
+
function checkTerm() {
# check if the column is 0 and if not start a new line (useful bc of the
progress bar).
# based on code from:
http://stackoverflow.com/questions/2575037/how-to-get-the-cursor-position-in-bash
@@ -465,12 +500,12 @@ if [ "${automake}" = "1" ]; then
fi
echo "$(ECHOPREFIX)running autogen..."
- ./autogen.sh > "${LOGS_D}/autogen" 2>&1 \
+ runthis autogen.log ./autogen.sh \
|| { echo "$(ERRORPREFIX)running autogen.sh" >&2; exit 1; }
echo "$(ECHOPREFIX)running configure..."
# echo "configure options are: ${configure_options}"
- ./configure ${configure_options} > "${LOGS_D}/configure" 2>&1 \
+ runthis configure.log ./configure ${configure_options} \
|| { echo "$(ERRORPREFIX)running configure" >&2; exit 1; }
else
# this check needs to be done before cd'ing to build dir (or need to cd back)
@@ -663,13 +698,13 @@ else
-DLYX_DEBUG_GLIBC_PEDANTIC=OFF
)
- cmake ${cmake_Werror_flags} "${gitRepoDIR}/" ${cmake_flags[@]} >
../build-logs/cmake 2>&1 \
+ runthis cmake.log cmake ${cmake_Werror_flags} "${gitRepoDIR}/"
${cmake_flags[@]} \
|| { echo "$(ERRORPREFIX)running cmake" >&2; exit 1; }
fi
echo "$(ECHOPREFIX)running make..."
-echo "$(ECHOPREFIX)building with ${njobs} core(s)" > "${LOGS_D}/make"
-make -j${njobs} >> "${LOGS_D}/make" 2>&1
+echo "$(ECHOPREFIX)building with ${njobs} core(s)" >> "${LOGS_D}/make.log"
+runthis make.log make -j${njobs} 2>&1
make_ret=$?
if [ "${make_ret}" != 0 ]; then
echo "$(ERRORPREFIX)running make" >&2
@@ -696,7 +731,7 @@ if [ "${patch_old}" != "1" ]; then
# (--strict does not do it). We could instead propose to write a wrapper
script
# for msgmerge that checks for this output (i.e., upstream this check to
theLyX
# build scripts).
- if grep "warning: internationalized messages should not contain"
"${LOGS_D}/make"; then
+ if grep "warning: internationalized messages should not contain"
"${LOGS_D}/make.log"; then
echo "$(ERRORPREFIX)invalid string(s) in po file(s). See grepped lines
just above." >&2
exit 1
fi
@@ -784,7 +819,7 @@ fi
PYTHON_EXEC="python3"
cd "${LYX_USER_DIR}"
-${PYTHON_EXEC} -tt "${gitRepoDIR}/lib/configure.py" > "${LOGS_D}/reconfigure"
2>&1 \
+runthis configure-lyx.log ${PYTHON_EXEC} -tt "${gitRepoDIR}/lib/configure.py" \
|| { echo "$(WARNINGPREFIX)reconfigure failed." >&2; exit 1; }
LYX_USER_DIR_NOAUTH="${LYX_USER_DIR}-noauth"
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs