check-newsfragment 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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 fetch origin develop
  8. UPSTREAM=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 $UPSTREAM... -- debian; then
  12. if git diff --quiet $UPSTREAM... -- 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 $UPSTREAM... | grep -qv '^develop/'; then
  20. tox -e check-newsfragment
  21. fi
  22. # check that any new newsfiles on this branch end with a full stop.
  23. for f in git diff --name-only $UPSTREAM... -- changelog.d; do
  24. lastchar=`tr -d '\n' < $f | tail -c 1`
  25. if [ $lastchar != '.' ]; then
  26. echo "Newsfragment $f does not end with a '.'" >&2
  27. exit 1
  28. fi
  29. done