pthbs_genpkgpy

Template engine for producing packages for pthbs written using Python and Jinja
git clone https://ccx.te2000.cz/git/pthbs_genpkgpy
Log | Files | Refs | Submodules | README

commit f0df5f58617450f907b458409d48b52baba46a5c
parent 11c3811afe08a156fde384e4a23aa7d37fce29c1
Author: Jan Pobříslo <ccx@te2000.cz>
Date:   Fri, 22 Sep 2023 02:44:01 +0200

Disable shell xtrace by default.

Diffstat:
Mcommand/pthbs-build | 14+++++++++-----
Mcommand/pthbs-download | 2+-
Mcommand/pthbs-install | 2+-
Mcommand/pthbs-makegen | 1+
4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/command/pthbs-build b/command/pthbs-build @@ -8,6 +8,8 @@ script=$(realpath "$1") pthbs_package=${1##*/} pthbs_package=${pthbs_package%%:*}.$bsh +printf "BUILDING %s => %s => %s\n" "$1" "$workdir" "$pthbs_package" + if test -f "make/package.sha256.${bsh}.env"; then envfile="make/package.sha256.${bsh}.env" envhash=$(pthbs-getenvhash "$envfile") || exit $? @@ -24,7 +26,8 @@ env \ BEGIN { sandbox = 1 FS=":" - print "#!/bin/sh -xe" + print "#!/bin/sh -e" + print "if test -n \"$pthbs_xtrace\"; then pthbs_xtrace=-x; set -x; fi" print "cd "q(ENVIRON["workdir"]) } @@ -118,7 +121,7 @@ fi logdir=work/logs/$(date '+%Y-%m-%d-%H%M%S')-$pthbs_package ret=0 -set -x +if test -n "$pthbs_xtrace"; then pthbs_xtrace=-x; set -x; fi trap 'trap - INT' INT if env -i \ PATH="$PATH" \ @@ -126,9 +129,9 @@ if env -i \ pthbs_script="$script" \ pthbs_destdir="$workdir/destdir" \ pthbs_package="$pthbs_package" \ - sh -xe "$workdir/pthbs-setup" </dev/null; then + sh $pthbs_xtrace -e "$workdir/pthbs-setup" </dev/null; then trap - INT - echo "BUILD SUCCESFUL" + printf "BUILD SUCCESFUL :: %s\n" "$pthbs_package" if ! pthbs-install "$workdir/destdir" "$pthbs_package"; then ret=1 echo "INSTALL FAILED" @@ -139,9 +142,10 @@ else if test -n "$pthbs_fail_log_cmd"; then $pthbs_fail_log_cmd "$workdir/build.log" else + printf "Errors found in log:\n" grep -C 1 -Eie '(error|fatal)[: ]' "$workdir/build.log" fi - echo "BUILD FAILED: exitcode $ret" + printf "BUILD FAILED: exitcode %s :: %s :: %s :: %s\n" "$ret" "$1" "$workdir" "$logdir" mkdir -p "$logdir" pthbs-digest-tree >"$logdir/workdir-digest" "$workdir" fi diff --git a/command/pthbs-download b/command/pthbs-download @@ -34,7 +34,7 @@ check() { exit 1 } -set -x +test -z "$pthbs_xtrace" || set -x mkdir -p "downloads/$checksum_format" || exit $? diff --git a/command/pthbs-install b/command/pthbs-install @@ -1,5 +1,5 @@ #!/bin/sh -e -set -x +test -z "$pthbs_xtrace" || set -x pthbs_versions=/home/ccx/versions test "$#" -eq 2 || exit 2 diff --git a/command/pthbs-makegen b/command/pthbs-makegen @@ -81,6 +81,7 @@ function make_envfile( n, envfile, envhash) { for(n=1; n<=env_count; n++) { printf " %s", envdep[n] } + printf "\n\t@%s", "printf "q("Creating environment for %s\\n")" "q(FILENAME) printf "\n\t%s", "if test -e "q("$(VERSIONS)/env."envhash)"; then rm -r "q("$(VERSIONS)/env."envhash)"; fi" printf "\n\t%s", "mkdir -p "q("$(VERSIONS)/env."envhash) for(n=1; n<=env_count; n++) {