1
0

check-newsfragment 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. #
  3. # A script which checks that an appropriate news file has been added on this
  4. # branch.
  5. set -e
  6. # make sure that origin/develop is up to date
  7. git remote set-branches --add origin develop
  8. git fetch origin develop
  9. # if there are changes in the debian directory, check that the debian changelog
  10. # has been updated
  11. if ! git diff --quiet FETCH_HEAD... -- debian; then
  12. if git diff --quiet FETCH_HEAD... -- debian/changelog; then
  13. echo "Updates to debian directory, but no update to the changelog." >&2
  14. exit 1
  15. fi
  16. fi
  17. # if there are changes *outside* the debian directory, check that the
  18. # newsfragments have been updated.
  19. if git diff --name-only FETCH_HEAD... | grep -qv '^debian/'; then
  20. tox -e check-newsfragment
  21. fi
  22. echo
  23. echo "--------------------------"
  24. echo
  25. # check that any new newsfiles on this branch end with a full stop.
  26. for f in `git diff --name-only FETCH_HEAD... -- changelog.d`; do
  27. lastchar=`tr -d '\n' < $f | tail -c 1`
  28. if [ $lastchar != '.' -a $lastchar != '!' ]; then
  29. echo -e "\e[31mERROR: newsfragment $f does not end with a '.' or '!'\e[39m" >&2
  30. exit 1
  31. fi
  32. done