[devscripts] 01/03: annotate-output: Optimize static FORMAT handling
James McCoy
jamessan at debian.org
Tue Sep 29 01:11:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 13812bb4497db7a2f30271e46f133f038841abbe
Author: James McCoy <jamessan at debian.org>
Date: Mon Sep 28 20:42:05 2015 -0400
annotate-output: Optimize static FORMAT handling
Signed-off-by: James McCoy <jamessan at debian.org>
---
debian/changelog | 3 +++
scripts/annotate-output.sh | 21 +++++++++++++++++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index ed186ca..8a8cdc5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,9 @@ devscripts (2.15.9) UNRELEASED; urgency=medium
* debcheckout:
+ Clarify documentation of -f option. Thanks to Daniel Shahaf for the
patch! (Closes: #797265)
+ * annotate-output:
+ + Optimize the case of FORMAT not containing any date format codes.
+ Thanks to Stefan Fritsch for the patch. (Closes: #799553)
[ Dominique Dumont ]
* licensecheck:
diff --git a/scripts/annotate-output.sh b/scripts/annotate-output.sh
index f260b95..6929faa 100755
--- a/scripts/annotate-output.sh
+++ b/scripts/annotate-output.sh
@@ -32,6 +32,16 @@ addtime ()
fi
}
+addprefix ()
+{
+ while IFS= read -r line; do
+ printf "%s: %s\n" "$1" "$line"
+ done
+ if [ ! -z "$line" ]; then
+ printf "%s: %s" "$1" "$line"
+ fi
+}
+
usage ()
{
echo \
@@ -75,8 +85,15 @@ ERR=$tmp/err
mkfifo $OUT $ERR || exit 1
-addtime O < $OUT &
-addtime E < $ERR &
+if [ "${FMT/\%}" != "${FMT}" ] ; then
+ addtime O < $OUT &
+ addtime E < $ERR &
+else
+ # If FMT does not contain a %, use the optimized version that
+ # does not call 'date'.
+ addprefix "${FMT#+} O" < $OUT &
+ addprefix "${FMT#+} E" < $ERR &
+fi
echo "Started $@" | addtime I
"$@" > $OUT 2> $ERR ; EXIT=$?
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list