From 7b98433c46c95d053757c004b40a2f1bdfd86fa2 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 24 May 2018 09:36:49 +1000 Subject: [PATCH] Reduce path length in PS4 for debug Strip everything before "site-packages" in the output filename for the PS4 prompt. This makes the line in debug logs significantly shorter as we don't have the full virtualenv path every single time. The important thing -- the file being called in the lib/ dir, is retained. Change-Id: I00706b6f6c0425c7795f997c08ceda3374dc84b5 --- diskimage_builder/lib/disk-image-create | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/diskimage_builder/lib/disk-image-create b/diskimage_builder/lib/disk-image-create index 24eb62ddf..e22549cdd 100644 --- a/diskimage_builder/lib/disk-image-create +++ b/diskimage_builder/lib/disk-image-create @@ -204,6 +204,10 @@ exec 1> >( ${DIB_PYTHON_EXEC:-python} $_LIB/outfilter.py ${_TS_FLAG} ${_QUIET_FL function _ps4 { IFS=" " called=($(caller 0)) local f=$(readlink -f ${called[2]}) + # As we're being run out of the python package's lib/ dir (either + # virtualenv or system), we can strip everything before + # "site-packages" to significantly shorten the line without really + f=${f##*site-packages/} printf "%-80s " "$f:${called[1]}:${called[0]}" } export -f _ps4