Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. #!/bin/sh
  2.  
  3. # Copyright 2007 Vincent Sanders <vince@debian.org>
  4. # All rights reserved.
  5.  
  6. # Redistribution and use in source and binary forms, with or without
  7. # modification, are permitted provided that the following conditions
  8. # are met:
  9. # 1. Redistributions of source code must retain the above copyright
  10. #    notice, this list of conditions and the following disclaimer.
  11. # 2. Redistributions in binary form must reproduce the above copyright
  12. #    notice, this list of conditions and the following disclaimer in the
  13. #    documentation and/or other materials provided with the distribution.
  14. # 3. Neither the name of the Author nor the names of its contributors
  15. #    may be used to endorse or promote products derived from this software
  16. #    without specific prior written permission.
  17.  
  18. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
  19. # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  20. # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  21. # ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
  22. # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  23. # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  24. # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  25. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  26. # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  27. # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. # SUCH DAMAGE.
  29.  
  30.  
  31. # where to store the processed list of warnings
  32. WARNING_LIST=/tmp/warning-list
  33.  
  34. if [ $# -gt 1 ]; then
  35.   if [ -f $1 ]; then
  36.     cp $1 ${WARNING_LIST}
  37.   else
  38.     echo "Need a valid warning file"
  39.     exit 1
  40.   fi
  41. else
  42.   make clean 2>&1 >/dev/null
  43.   make 2>&1 |grep "warning:" | sort | uniq > ${WARNING_LIST}
  44. fi
  45.  
  46. for blamefile in $(cat ${WARNING_LIST} | cut -f 1 -d ':'  | sort | uniq ); do
  47.   if [ -f ${blamefile} ]; then
  48.     svn blame ${blamefile} >/tmp/blame
  49.  
  50.     cat ${WARNING_LIST} | grep "^${blamefile}" >/tmp/blame-warnings
  51.  
  52.     while read warning; do
  53.       echo ${warning}
  54.  
  55.       lineno=$(echo ${warning} | cut -f 2 -d ':' ; )
  56.  
  57.       cat /tmp/blame | head -n ${lineno} | tail -n 1
  58.  
  59.     done < /tmp/blame-warnings
  60.     rm /tmp/blame-warnings
  61.   else
  62.     echo "Unable to find ${blamefile}"
  63.   fi
  64. done
  65.