You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 line
1.1 KiB

  1. #!/bin/sh
  2. export MAKEFLAGS=""
  3. top_srcdir="$(make -s echo-topdir)"
  4. #
  5. # Check that the copyright information is valid
  6. #
  7. nfails=0
  8. nfiles=0
  9. for dir in $(make -s echo-dirs -C "${top_srcdir}"); do
  10. if [ ! -d "${top_srcdir}/${dir}" ]; then continue; fi
  11. for x in $(make -s echo-sources -C "${top_srcdir}/${dir}"); do
  12. case "$x" in
  13. *.c|*.cpp|*.h|*.m|*.php|*.cs|*.java|.py|.pl)
  14. nfiles=$(($nfiles + 1)) ;;
  15. *)
  16. continue ;;
  17. esac
  18. if ! grep 'Copyright *([cC])' "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then
  19. echo "error: ${dir}/$x lacks proper copyright information"
  20. nfails=$(($nfails + 1))
  21. elif [ -d ../../.git ]; then
  22. Y="$(git log "${top_srcdir}/${dir}/$x" | head -n 3 | sed -ne 's/^Date.* \([0-9][0-9][0-9][0-9]\) .*/\1/p')"
  23. if [ "$Y" != "" ]; then
  24. if ! grep "$Y.*@" "${top_srcdir}/${dir}/$x" >/dev/null 2>&1; then
  25. echo "error: ${dir}/$x last modified in $Y, which is not in copyright"
  26. nfails=$(($nfails + 1))
  27. fi
  28. fi
  29. fi
  30. done
  31. done
  32. echo "$nfiles files, $nfails errors in copyright information"
  33. if test "$nfails" != "0"; then
  34. exit 1
  35. fi
  36. exit 0