aboutsummaryrefslogtreecommitdiffstats
path: root/time-of-build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'time-of-build.sh')
-rwxr-xr-xtime-of-build.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/time-of-build.sh b/time-of-build.sh
new file mode 100755
index 0000000..fde7689
--- /dev/null
+++ b/time-of-build.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+set -eu
+
+projname="$1"
+pkg="$2"
+tempfile="$(mktemp -t time-of-build-XXXXXX)"
+trap 'rm -rf "$tempfile"' EXIT
+
+osc rbl $projname $pkg openSUSE_Tumbleweed x86_64 >$tempfile
+begstr="$(sed -E -n -e '/started "build/s/^.*at (.*)\.$/\1/p' $tempfile)"
+endstr="$(sed -E -n -e '/(finished|failed) "build/s/^.*at (.*)\.$/\1/p' $tempfile)"
+begtime="$(date --date "$begstr" +%s)"
+endtime="$(date --date "$endstr" +%s)"
+echo -e "$(( $endtime - $begtime ))\t$pkg"
+
+# begtime="Tue Dec 13 23:50:13 UTC 2022"
+# endtime="Tue Dec 13 23:50:27 UTC 2022"
+# date --date '2017-08-17 04:00:01' +%s # "1502938801"
+# date --date '2017-08-17 04:00:01' +%s
+# date --date "$begtime" %s
+# date --date "$begtime" +%s
+# echo $(( $(date --date "$endtime" +%s) - $(date --date "$begtime" +%s) ))