-#!/bin/sh
+#!/bin/bash
tree=
if [ "$1" ]; then
shift
fi
-tools_dir=$(cd $(dirname "$0"); pwd)
-. "$tools_dir/common.sh"
+# shellcheck source=common.sh
+. "$(dirname "$0")/common.sh"
set -e
bparent=$(dirname "$build_dir")
-line="$(tail -n 1 $SHA1_FILE)"
+line=$(tail -n 1 "$SHA1_FILE")
# strip everything after the first tab character
stree=${line%% *}
if [ "$tree" ]; then
- [ "$tree" = "$stree" ] || {
- echo "That is not the last tree merged ($tree v $stree)" 1>&2
+ if [ "$tree" != "$stree" ]; then
+ printf 'That is not the last tree merged (%s v %s)\n' "$tree" "$stree" 1>&2
exit 1
- }
+ fi
else
tree="$stree"
fi
obdir="$bparent/old/$tree"
cmd="/bin/sh"
-[ "$build_host" ] &&
+if [ "$build_host" ]; then
cmd="ssh root@$build_host unshare -n su $(id -u -n)"
+fi
+
+log_regex='/^[[:space:]]+$/d
+/^[.[:digit:]]+user [.[:digit:]]+system [:.[:digit:]]+elapsed [[:digit:]]+%CPU \([[:digit:]]+avgtext\+[[:digit:]]+avgdata [[:digit:]]+maxresident\)k$/d
+/^[[:digit:]]+inputs\+[[:digit:]]+outputs \([[:digit:]]+major\+[[:digit:]]+minor\)pagefaults [[:digit:]]+swaps$/d
+/^Setup is [[:digit:]]+ bytes \(padded to [[:digit:]]+ bytes\)\.$/d
+/^System is [[:digit:]]+ kB$/d
+/^CRC [[:xdigit:]]+$/d
+/^Kernel: arch\/x86\/boot\/bzImage is ready \(#[[:digit:]]+\)$/d
+/^WARNING: vmlinux\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
+/^WARNING: drivers\/built-in\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
+/^Warning: Kernel ABI header at /d
+/^[[:space:]]+PERF_VERSION = /d
+s/^([[:xdigit:]]+)([[:space:]]+R_PPC64_REL32[[:space:]].*)$/XXX\2/'
$cmd <<-EOF
[ -d "$obdir" ] || mkdir -p "$obdir" || exit 1
sanitise_log() {
- sed -r '
-/^[[:space:]]+$/d
-/^[.[:digit:]]+user [.[:digit:]]+system [:.[:digit:]]+elapsed [[:digit:]]+%CPU \([[:digit:]]+avgtext\+[[:digit:]]+avgdata [[:digit:]]+maxresident\)k$/d
-/^[[:digit:]]+inputs\+[[:digit:]]+outputs \([[:digit:]]+major\+[[:digit:]]+minor\)pagefaults [[:digit:]]+swaps$/d
-/^Setup is [[:digit:]]+ bytes \(padded to [[:digit:]]+ bytes\)\.$/d
-/^System is [[:digit:]]+ kB$/d
-/^CRC [[:xdigit:]]+$/d
-/^Kernel: arch\/x86\/boot\/bzImage is ready \(#[[:digit:]]+\)$/d
-/^WARNING: vmlinux\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
-/^WARNING: drivers\/built-in\.o\(\.text\+0x[[:xdigit:]]+\): Section mismatch in reference from /d
-/^Warning: Kernel ABI header at /d
-/^[[:space:]]+PERF_VERSION = /d
-s/^([[:xdigit:]]+)([[:space:]]+R_PPC64_REL32[[:space:]].*)$/XXX\2/
-' | grep -vxFf $bparent/log-ignore
+ sed -E -e '$log_regex' | grep -vxFf $bparent/log-ignore
}
show_log() {