[Bf-blender-cvs] [a90c2834a1f] master: install_deps.sh: add debugging options

Campbell Barton noreply at git.blender.org
Wed Jan 22 14:53:04 CET 2020


Commit: a90c2834a1f35d97d3a5a96af5486d84aaa8e1ce
Author: Campbell Barton
Date:   Thu Jan 23 00:40:40 2020 +1100
Branches: master
https://developer.blender.org/rBa90c2834a1f35d97d3a5a96af5486d84aaa8e1ce

install_deps.sh: add debugging options

Add USE_DEBUG_TRAP, USE_DEBUG_LOG for trapping errors and logging
executed lines respectively.

Handy for troubleshooting issues in the script.

===================================================================

M	build_files/build_environment/install_deps.sh

===================================================================

diff --git a/build_files/build_environment/install_deps.sh b/build_files/build_environment/install_deps.sh
index c71b5f1c436..c783c7f2b85 100755
--- a/build_files/build_environment/install_deps.sh
+++ b/build_files/build_environment/install_deps.sh
@@ -19,6 +19,29 @@
 
 # A shell script installing/building all needed dependencies to build Blender, for some Linux distributions.
 
+##### Debugging Helpers #####
+#
+# Use for developing this script (keep first).
+
+# Useful for debugging this script:
+USE_DEBUG_TRAP=${USE_DEBUG_TRAP:-0}
+USE_DEBUG_LOG=${USE_DEBUG_LOG:-0}
+
+# Print the line that exits.
+if [ $USE_DEBUG_TRAP -ne 0 ]; then
+  err_report() {
+    echo "Error on line $1"
+    exit 1
+  }
+  trap 'err_report $LINENO' ERR
+fi
+
+# Noisy, show every line that runs with it's line number.
+if [ $USE_DEBUG_LOG -ne 0 ]; then
+  PS4='\e[0;33m$(printf %4d ${LINENO}):\e\033[0m '
+  set -x
+fi
+
 ##### Args and Help Handling #####
 
 # Parse command line!



More information about the Bf-blender-cvs mailing list