| 1 | #!/bin/bash |
| 2 | # -*- Mode: Shell-script; tab-width: 4; indent-tabs-mode: nil; -*- |
| 3 | |
| 4 | # This Source Code Form is subject to the terms of the Mozilla Public |
| 5 | # License, v. 2.0. If a copy of the MPL was not distributed with this |
| 6 | # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 7 | |
| 8 | # usage: changes.sh [prefix] |
| 9 | # |
| 10 | # combines the {prefix}*possible-fixes.log files into {prefix}possible-fixes.log |
| 11 | # and {prefix}*possible-regressions.log files into |
| 12 | # possible-regressions.log. |
| 13 | # |
| 14 | # This script is useful in cases where log files from different machines, branches |
| 15 | # and builds are being investigated. |
| 16 | |
| 17 | export LC_ALL=C |
| 18 | |
| 19 | if cat /dev/null | sed -r 'q' > /dev/null 2>&1; then |
| 20 | SED="sed -r" |
| 21 | elif cat /dev/null | sed -E 'q' > /dev/null 2>&1; then |
| 22 | SED="sed -E" |
| 23 | else |
| 24 | echo "Neither sed -r or sed -E is supported" |
| 25 | exit 2 |
| 26 | fi |
| 27 | |
| 28 | workfile=`mktemp work.XXXXXXXX` |
| 29 | if [ $? -ne 0 ]; then |
| 30 | echo "Unable to create working temp file" |
| 31 | exit 2 |
| 32 | fi |
| 33 | |
| 34 | for f in ${1}*results-possible-fixes.log*; do |
| 35 | case $f in |
| 36 | *.log) |
| 37 | CAT=cat |
| 38 | ;; |
| 39 | *.log.bz2) |
| 40 | CAT=bzcat |
| 41 | ;; |
| 42 | *.log.gz) |
| 43 | CAT=zcat |
| 44 | ;; |
| 45 | *.log.zip) |
| 46 | CAT="unzip -c" |
| 47 | ;; |
| 48 | *) |
| 49 | echo "unknown log type: $f" |
| 50 | exit 2 |
| 51 | ;; |
| 52 | esac |
| 53 | |
| 54 | $CAT $f | $SED "s|$|:$f|" >> $workfile |
| 55 | |
| 56 | done |
| 57 | |
| 58 | sort -u $workfile > ${1}possible-fixes.log |
| 59 | |
| 60 | rm $workfile |
| 61 | |
| 62 | |
| 63 | for f in ${1}*results-possible-regressions.log*; do |
| 64 | case $f in |
| 65 | *.log) |
| 66 | CAT=cat |
| 67 | ;; |
| 68 | *.log.bz2) |
| 69 | CAT=bzcat |
| 70 | ;; |
| 71 | *.log.gz) |
| 72 | CAT=zcat |
| 73 | ;; |
| 74 | *.log.zip) |
| 75 | CAT="unzip -c" |
| 76 | ;; |
| 77 | *) |
| 78 | echo "unknown log type: $f" |
| 79 | exit 2 |
| 80 | ;; |
| 81 | esac |
| 82 | $CAT $f >> $workfile |
| 83 | done |
| 84 | |
| 85 | sort -u $workfile > ${1}possible-regressions.log |
| 86 | |
| 87 | rm $workfile |
| 88 | |
| 89 | |
| 90 |