commit cea5b847bc43cb180a9bdec057955b6bdd17f14f
parent e1240156c6b0dd9e27aa3014d6297d01a46e54da
Author: Jan Pobříslo <ccx@te2000.cz>
Date: Sat, 17 Jun 2023 18:28:47 +0200
Move build logs to work/logs
Diffstat:
2 files changed, 23 insertions(+), 22 deletions(-)
diff --git a/command/pthbs-build b/command/pthbs-build
@@ -116,9 +116,10 @@ if test -z "$JOBS"; then
fi
fi
-set -x
-
+logdir=work/logs/$(date '+%Y-%m-%d-%H%M%S')-$pthbs_package
ret=0
+set -x
+trap 'trap - INT' INT
if env -i \
PATH="$PATH" \
JOBS="$JOBS" \
@@ -126,6 +127,7 @@ if env -i \
pthbs_destdir="$workdir/destdir" \
pthbs_package="$pthbs_package" \
sh -xe "$workdir/pthbs-setup" </dev/null; then
+ trap - INT
echo "BUILD SUCCESFUL"
if ! pthbs-install "$workdir/destdir" "$pthbs_package"; then
ret=1
@@ -133,13 +135,32 @@ if env -i \
fi
else
ret=$?
+ trap - INT
if test -n "$pthbs_fail_log_cmd"; then
$pthbs_fail_log_cmd "$workdir/build.log"
else
grep -C 1 -Eie '(error|fatal)[: ]' "$workdir/build.log"
fi
echo "BUILD FAILED: exitcode $ret"
+ mkdir -p "$logdir"
+ pthbs-digest-tree >"$logdir/workdir-digest" "$workdir"
+fi
+
+mkdir -p "$logdir"
+
+if test -e "$workdir/build.log"; then
+ mv "$workdir/build.log" "$logdir/log"
+ bzip2 "$logdir/log"
fi
+
+if test -e "$workdir/pthbs-setup"; then
+ mv "$workdir/pthbs-setup" "$logdir/"
+fi
+
+if test -n "$pthbs_build_environment"; then
+ ln -s "$pthbs_build_environment" "$logdir/env"
+fi
+
if test -z "$pthbs_skip_cleanup"; then
rm -rf "$workdir" || ret=$?
fi
diff --git a/command/pthbs-install b/command/pthbs-install
@@ -30,24 +30,4 @@ if test -e "$pthbs_versions/$pthbs_package"; then
find "$pthbs_versions" -type l ! -exec test -e {} \; -exec rm -v {} +
fi
-buildinfo=$pthbs_versions/${pthbs_package%/}.buildinfo
-if test -e "$buildinfo"; then
- rm -r "$buildinfo"
-fi
-mkdir -p "$buildinfo"
-
-builddir=$(dirname "$pthbs_destdir")
-if test -e "$builddir/build.log"; then
- mv "$builddir/build.log" "$buildinfo/log"
- bzip2 "$buildinfo/log"
-fi
-
-if test -e "$builddir/pthbs-setup"; then
- mv "$builddir/pthbs-setup" "$buildinfo/"
-fi
-
-if test -n "$pthbs_build_environment"; then
- ln -s "$pthbs_build_environment" "$buildinfo/env"
-fi
-
mv "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package" "$pthbs_versions/$pthbs_package"