commit 33e27115aa0cf5d9a7ef973bffd046131cd72198
parent ea8067a3c923436e63e4a36ba7fdb530d0c681de
Author: Jan Pobrislo <ccx@te2000.cz>
Date: Fri, 10 Jan 2025 01:31:11 +0000
Better xtrace under busybox
Diffstat:
5 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/command/pthbs-build b/command/pthbs-build
@@ -1,5 +1,8 @@
#!/bin/sh
-if test -n "$pthbs_xtrace"; then set -x; fi
+if test -n "$pthbs_xtrace"; then
+ set -x
+ if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi
+fi
bsh=$(sha256sum $1) || exit $?
bsh=${bsh%% *}
if test -z "$pthbs_workdir"; then
@@ -99,7 +102,10 @@ BEGIN {
settings["set_path"] = 1
FS=":"
print "#!/bin/sh -e"
- print "if test -n \"$pthbs_xtrace\"; then pthbs_xtrace=-x; set -x; fi"
+ print "if test -n \"$pthbs_xtrace\"; then"
+ print " set -x"
+ print " if test -n \"$BB_ASH_VERSION\"; then PS4=\"+${0##*/}\"" single_quote ":${FUNCNAME}:${LINENO} " single_quote "; fi"
+ print "fi"
print "cd "q(ENVIRON["workdir"])
if(ENVIRON["pthbs_uid"]) {
print "export pthbs_uid=" ENVIRON["pthbs_uid"]
@@ -280,6 +286,7 @@ if env -i \
pthbs_script="$script" \
pthbs_destdir="$workdir/destdir" \
pthbs_package="$pthbs_package" \
+ pthbs_xtrace="$pthbs_xtrace" \
sh $pthbs_xtrace -e "$workdir/pthbs-setup" </dev/null; then
trap - INT
printf "BUILD SUCCESFUL :: %s\n" "$pthbs_package"
@@ -300,7 +307,7 @@ else
mkdir -p "$logdir"
rm -v "$(dirname "$logdir")/last_failed_build"
ln -v -s -f "$(basename "$logdir")" "$(dirname "$logdir")/last_failed_build"
- find "$workdir" -name config.log -exec cp -v --backup=numbered '{}' "$logdir/config.log" \;
+ find "$workdir" -name config.log -exec pthbs-copy-to-logdir "$logdir" '{}' \;
pthbs-digest-tree >"$logdir/workdir-digest" "$workdir"
fi
diff --git a/command/pthbs-download b/command/pthbs-download
@@ -1,6 +1,7 @@
#!/bin/sh
if test -n "$pthbs_xtrace"; then
set -x
+ if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi
fi
test $# -gt 3 || exit 2
checksum_format=$1
@@ -41,8 +42,6 @@ check() {
exit 1
}
-test -z "$pthbs_xtrace" || set -x
-
mkdir -p "$pthbs_cache/downloads/$checksum_format" || exit $?
if check; then
diff --git a/command/pthbs-install b/command/pthbs-install
@@ -1,5 +1,8 @@
#!/bin/sh -e
-test -z "$pthbs_xtrace" || set -x
+if test -n "$pthbs_xtrace"; then
+ set -x
+ if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi
+fi
if test -z "$pthbs_versions"; then
echo >&2 "ERROR: pthbs_versions is undefined"
exit 2
@@ -21,9 +24,9 @@ fi
if test -n "$pthbs_install_uid"; then
chown -R "$pthbs_install_uid:$pthbs_install_gid" "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package"
fi
-chmod -R ugo-w "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package"
pthbs-digest-tree >"$pthbs_destdir/pthbs-digest" "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package/" || exit $?
mv "$pthbs_destdir/pthbs-digest" "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package/.pthbs-digest" || exit $?
+chmod -R ugo-w "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package"
if test -e "$pthbs_versions/$pthbs_package"; then
if ! diff -u "$pthbs_versions/$pthbs_package" "$pthbs_destdir/${pthbs_versions%/}/$pthbs_package/.pthbs-digest"; then
diff --git a/command/pthbs-makegen b/command/pthbs-makegen
@@ -1,5 +1,8 @@
#!/bin/sh
-if test -n "$pthbs_xtrace"; then set -x; fi
+if test -n "$pthbs_xtrace"; then
+ set -x
+ if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi
+fi
bsh=$(sha256sum $1) || exit $?
bsh=${bsh%% *}
if test -z "$pthbs_workdir"; then
diff --git a/command/pthbs-namedenv b/command/pthbs-namedenv
@@ -1,6 +1,9 @@
#!/bin/sh
set -e
-if test -n "$pthbs_xtrace"; then set -x; fi
+if test -n "$pthbs_xtrace"; then
+ set -x
+ if test -n "$BB_ASH_VERSION"; then PS4="+${0##*/}"':${FUNCNAME}:${LINENO} '; fi
+fi
if test -z "$pthbs_cache"; then
printf '%s\n' >&2 "$0: fatal: pthbs_cache env var undefined or empty"
exit 100