From e1666af9be6b605a6e686a8d9a44347c06175750 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Fri, 22 Feb 2019 10:56:59 +0000 Subject: Better checks on newsfragments (#4698) * You need an entry in the debian changelog (and not a regular newsfragment) for debian packaging changes. * Regular newsfragments must end in full stops. --- scripts-dev/check-newsfragment | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 scripts-dev/check-newsfragment (limited to 'scripts-dev/check-newsfragment') diff --git a/scripts-dev/check-newsfragment b/scripts-dev/check-newsfragment new file mode 100755 index 0000000000..5da093e168 --- /dev/null +++ b/scripts-dev/check-newsfragment @@ -0,0 +1,36 @@ +#!/bin/bash +# +# A script which checks that an appropriate news file has been added on this +# branch. + +set -e + +# make sure that origin/develop is up to date +git fetch origin develop + +UPSTREAM=origin/develop + +# if there are changes in the debian directory, check that the debian changelog +# has been updated +if ! git diff --quiet $UPSTREAM... -- debian; then + if git diff --quiet $UPSTREAM... -- debian/changelog; then + echo "Updates to debian directory, but no update to the changelog." >&2 + exit 1 + fi +fi + +# if there are changes *outside* the debian directory, check that the +# newsfragments have been updated. +if git diff --name-only $UPSTREAM... | grep -qv '^develop/'; then + tox -e check-newsfragment +fi + +# check that any new newsfiles on this branch end with a full stop. +for f in git diff --name-only $UPSTREAM... -- changelog.d; do + lastchar=`tr -d '\n' < $f | tail -c 1` + if [ $lastchar != '.' ]; then + echo "Newsfragment $f does not end with a '.'" >&2 + exit 1 + fi +done + -- cgit 1.5.1 From 57426ec6a377015925d643576efa9ef3efd63fda Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Tue, 26 Feb 2019 21:13:41 +0000 Subject: Fix check-newsfragment script (#4750) * Fix check-newsfragment script I previously broke this so that it always succeeded... * more fixes * fix newsfiles --- changelog.d/4698.misc | 2 +- changelog.d/4750.misc | 1 + scripts-dev/check-newsfragment | 11 ++++++++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 changelog.d/4750.misc (limited to 'scripts-dev/check-newsfragment') diff --git a/changelog.d/4698.misc b/changelog.d/4698.misc index d17b19bec5..9dea5dd2be 100644 --- a/changelog.d/4698.misc +++ b/changelog.d/4698.misc @@ -1 +1 @@ -Better checks on newsfragments +Better checks on newsfragments. diff --git a/changelog.d/4750.misc b/changelog.d/4750.misc new file mode 100644 index 0000000000..3bb9c48f1a --- /dev/null +++ b/changelog.d/4750.misc @@ -0,0 +1 @@ +Better checks on newsfragments. \ No newline at end of file diff --git a/scripts-dev/check-newsfragment b/scripts-dev/check-newsfragment index 5da093e168..e4a22bae61 100755 --- a/scripts-dev/check-newsfragment +++ b/scripts-dev/check-newsfragment @@ -6,7 +6,8 @@ set -e # make sure that origin/develop is up to date -git fetch origin develop +git remote set-branches --add origin develop +git fetch --depth=1 origin develop UPSTREAM=origin/develop @@ -25,11 +26,15 @@ if git diff --name-only $UPSTREAM... | grep -qv '^develop/'; then tox -e check-newsfragment fi +echo +echo "--------------------------" +echo + # check that any new newsfiles on this branch end with a full stop. -for f in git diff --name-only $UPSTREAM... -- changelog.d; do +for f in `git diff --name-only $UPSTREAM... -- changelog.d`; do lastchar=`tr -d '\n' < $f | tail -c 1` if [ $lastchar != '.' ]; then - echo "Newsfragment $f does not end with a '.'" >&2 + echo -e "\e[31mERROR: newsfragment $f does not end with a '.'\e[39m" >&2 exit 1 fi done -- cgit 1.5.1