aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2022-12-15 09:48:27 +0100
committerMatěj Cepl <mcepl@cepl.eu>2022-12-15 09:51:12 +0100
commit32b7186cdc5b2351aae5e621105b9c81bf994b23 (patch)
tree74eef5ded26a1b28ae5177afd1060062b8819c25
parentec06fe0a59c233b4a82040032bff413b213e89a5 (diff)
downloadtime-of-build-32b7186cdc5b2351aae5e621105b9c81bf994b23.tar.gz
Make the script resilient against packages which have only "multibuild" versions.
Happens with Lua packages.
-rw-r--r--README.md7
-rwxr-xr-xtime-of-build.sh8
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)"