summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2020-09-23 12:22:01 +0200
committerBastien Nocera <hadess@hadess.net>2020-09-23 12:22:01 +0200
commitf8706c33f2959b93e06ce386c9a067ad57e96042 (patch)
treea6361462055081c46a5dda4980a9a49730f8e443
parent08defddc2cdcff7f5d783de46c2fddb654c5aeed (diff)
downloadgnome-bluetooth-f8706c33f2959b93e06ce386c9a067ad57e96042.tar.gz
build: Add check-news.sh helper
-rwxr-xr-xcheck-news.sh82
-rw-r--r--meson.build6
2 files changed, 88 insertions, 0 deletions
diff --git a/check-news.sh b/check-news.sh
new file mode 100755
index 00000000..e7e8fa6b
--- /dev/null
+++ b/check-news.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+
+# Copyright (C) 2019 Red Hat, Inc.
+# Author: Bastien Nocera <hadess@hadess.net>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+
+# Add to your top-level meson.build to check for an updated NEWS file
+# when doing a "dist" release, similarly to automake's check-news:
+# https://www.gnu.org/software/automake/manual/html_node/List-of-Automake-options.html
+#
+# Checks NEWS for the version number:
+# meson.add_dist_script(
+# find_program('check-news.sh').path(),
+# '@0@'.format(meson.project_version())
+# )
+#
+# Checks NEWS and data/foo.appdata.xml for the version number:
+# meson.add_dist_script(
+# find_program('check-news.sh').path(),
+# '@0@'.format(meson.project_version()),
+# 'NEWS',
+# 'data/foo.appdata.xml'
+# )
+
+usage()
+{
+ echo "$0 VERSION [FILES...]"
+ exit 1
+}
+
+check_version()
+{
+ VERSION=$1
+ # Look in the first 15 lines for NEWS files, but look
+ # everywhere for other types of files
+ if [ "$2" = "NEWS" ]; then
+ DATA=`sed 15q $SRC_ROOT/"$2"`
+ else
+ DATA=`cat $SRC_ROOT/"$2"`
+ fi
+ case "$DATA" in
+ *"$VERSION"*)
+ :
+ ;;
+ *)
+ echo "$2 not updated; not releasing" 1>&2;
+ exit 1
+ ;;
+ esac
+}
+
+SRC_ROOT=${MESON_DIST_ROOT:-"./"}
+
+if [ $# -lt 1 ] ; then usage ; fi
+
+VERSION=$1
+shift
+
+if [ $# -eq 0 ] ; then
+ check_version $VERSION 'NEWS'
+ exit 0
+fi
+
+for i in $@ ; do
+ check_version $VERSION "$i"
+done
+
+exit 0
diff --git a/meson.build b/meson.build
index 02f11fbf..357b4eb8 100644
--- a/meson.build
+++ b/meson.build
@@ -133,3 +133,9 @@ output += ' Prefix......................: ' + gnomebt_prefix + '\n'
output += ' Documentation...............: ' + enable_gtk_doc.to_string() + '\n'
output += ' GObject-Introspection.......: ' + enable_gir.to_string()
message(output)
+
+meson.add_dist_script(
+ find_program('check-news.sh').path(),
+ '@0@'.format(meson.project_version()),
+ 'NEWS',
+)