Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

check-copyright 1009 B

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