aboutsummaryrefslogtreecommitdiffstats
path: root/time-of-build.sh
blob: 825a0656acef36976ecb4822506901a56acc839e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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
#  begtime="Tue Dec 13 23:50:13 UTC 2022"
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"