[beast] BUILD: automatically extract contributors from NEWS file



commit cc4c42ffaf7f9c08983a091398882e7c6162a914
Author: Tim Janik <timj gtk org>
Date:   Thu Apr 7 20:37:53 2011 +0200

    BUILD: automatically extract contributors from NEWS file

 Makefile.am  |    5 +++++
 mkrelease.sh |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 39 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 766b198..4b8fe67 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -42,6 +42,11 @@ release-news:
 	$(srcdir)/mkrelease.sh news
 .PHONY: release-news
 
+# --- release-contributors ---
+release-contributors:
+	$(srcdir)/mkrelease.sh contributors -B timj,stw -C $(srcdir)/beast-gtk/bstmain.c
+.PHONY: release-contributors
+
 # --- release-upload ---
 release-upload: ChangeLog
 	$(srcdir)/mkrelease.sh upload -U beast:dist/beast/ -E configure.in:BSE_MICRO_VERSION
diff --git a/mkrelease.sh b/mkrelease.sh
index 82dcfef..0e853d0 100755
--- a/mkrelease.sh
+++ b/mkrelease.sh
@@ -4,6 +4,7 @@
 ## This work is provided "as is"; see: http://rapicorn.org/LICENSE-AS-IS
 
 MYVERSION="mkrelease.sh version 20100901"
+# 20110407: extract 'contributors' from NEWS files
 # 20100910: fixed 'commit-stamps' outside of git repos
 # 20100901: check HEAD against upstream repository, upload last
 # 20100831: implemented 'shellvar' command
@@ -34,6 +35,7 @@ usage() {
 	Usage: `basename $SCRIPT_NAME` <command> [options]
 	Commands:
 	  commit-stamps		list stamp files affected by a commit
+	  contributors		extract contributor C strings from NEWS files
 	  ChangeLog		generate ChangeLog from git history
 	  news			list commits since last release tag
 	  upload		check and upload release tarball
@@ -43,6 +45,8 @@ usage() {
 	  -v, --version		issue version and brief history
 	  -E <FILE:VAR>         revision variable to increment during "upload"
 	                        (e.g. configure.ac:MICRO)
+	  -B <A,B,C...>		ignored names for "contributors"
+	  -C <NEWS>		file with ignored C strings for "contributors"
 	  -R <revision>		revision range for "ChangeLog" generation
 	                        last release revision for "news" (auto)
 	  -T <disttarball>	name of distribution tarball (from Makefile)
@@ -58,10 +62,14 @@ VERSION=_parse
 TARBALL=_parse
 REMOTE_URL=
 REVISIONVAR=
+CONTRBLACK=
+CONTRCFILE=/dev/null
 parse_options=1
 while test $# -ne 0 -a $parse_options = 1; do
   case "$1" in
     -h|--help)	usage 0 ;;
+    -B)		CONTRBLACK="$2" ; shift ;;
+    -C)		CONTRCFILE="$2" ; shift ;;
     -E)		REVISIONVAR="$2" ; shift ;;
     -R)		R_REVISION="$2" ; shift ;;
     -T)		TARBALL="$2" ; shift ;;
@@ -113,6 +121,32 @@ done
   exit
 }
 
+# === contributors ===
+[ "$COMMAND" = "contributors" ] && {
+  TEMPF="`mktemp -t yyTMPcontribs.$$XXXXXX`" && touch $TEMPF || \
+    die 9 "Failed to create temporary file"
+  # find and extract contributor names from first NEWS section
+  sed -n '/^[A-Za-z0-9]/{
+	    # loop over content lines of first NEWS section
+	    :1 n;
+	    /^[A-Za-z0-9]/q;
+	    /\[.*\]/{
+	      # extract names, enclosed in brackets
+	      s/\(^.*\[\|][^]]*$\)//g;
+	      # separate list of names by newlines
+	      s/[,;\/]/\n/g;
+	      # remove excessive whitespaces
+	      s/\(^\s\+\|\s\+$\)//g ; s/\s\s\+/ /g
+	      p; };
+	    b 1; }' < NEWS | sort | uniq > $TEMPF
+  # list unknown contributor names as C strings
+  while read NAME ; do
+    case ",$CONTRBLACK," in (*",$NAME,"*) continue ;; esac
+    grep -qFie \""$NAME"\" "$CONTRCFILE" || echo "  \"$NAME\","
+  done < $TEMPF
+  exit
+}
+
 # === news ===
 [ "$COMMAND" = "news" ] && {
   # list numeric tags



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]