1#!/bin/sh 2 3error () { 4echo>&2"error: $@" 5exit1 6} 7 8find_embedded_trash () { 9whileread -r line 10do 11case"$line"in 12*Start\ of\ trash\ directory\ of\ \'t[0-9][0-9][0-9][0-9]-*\':*) 13 test_name="${line#*\'}" 14 test_name="${test_name%\'*}" 15 16return0 17esac 18done 19 20return1 21} 22 23extract_embedded_trash () { 24whileread -r line 25do 26case"$line"in 27*End\ of\ trash\ directory\ of\ \'$test_name\'*) 28return 29;; 30*) 31printf'%s\n'"$line" 32;; 33esac 34done 35 36 error "unexpected end of input" 37} 38 39# Raw logs from Linux build jobs have CRLF line endings, while OSX 40# build jobs mostly have CRCRLF, except an odd line every now and 41# then that has CRCRCRLF. 'base64 -d' from 'coreutils' doesn't like 42# CRs and complains about "invalid input", so remove all CRs at the 43# end of lines. 44sed-e's/\r*$//'| \ 45while find_embedded_trash 46do 47echo"Extracting trash directory of '$test_name'" 48 49 extract_embedded_trash |base64 -d|tar xzp 50done