From 32b7186cdc5b2351aae5e621105b9c81bf994b23 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Thu, 15 Dec 2022 09:48:27 +0100 Subject: Make the script resilient against packages which have only "multibuild" versions. Happens with Lua packages. --- README.md | 7 ++++++- time-of-build.sh | 8 +++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index cadd895..4c5124a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,12 @@ Calculate number of seconds the package was build in OBS. -Usage: +Usage (run inside of the complete checkout of the particular +development project): $ time-of-build.sh python-Flask Requires osc and xmlstarlet. + +All issues, questions, complaints, or (even better!) patches +should be send via email to mcepl at cepl do eu (use [git +send-email](https://git-send-email.io/) for it). diff --git a/time-of-build.sh b/time-of-build.sh index a2ec4ec..916075c 100755 --- a/time-of-build.sh +++ b/time-of-build.sh @@ -1,12 +1,12 @@ #!/bin/sh -set -eu +set -u if [ ! -r .osc/_project ] ; then echo 'This program must be run from an OBS project directory.' exit 42 fi -projname="$(basename $(pwd))" +projname="$(basename "$(pwd -P)")" package="$1" tempfile="$(mktemp -t time-of-build-XXXXXX)" trap 'rm -rf "$tempfile"' EXIT @@ -23,7 +23,9 @@ fi total_time=0 for pkg in $process ; do - osc rbl $projname $pkg openSUSE_Tumbleweed x86_64 >$tempfile + osc rbl $projname $pkg openSUSE_Tumbleweed x86_64 >$tempfile 2>/dev/null \ + || continue + # begtime="Tue Dec 13 23:50:13 UTC 2022" # \x22 is " character; https://unix.stackexchange.com/a/230354/184648 begstr="$(sed -E -n -e '/started \x22build/s/^.*at (.*)\.$/\1/p' $tempfile)" -- cgit