[grilo-plugins] build: Generate AUTHORS automatically on release



commit 01cb6c3d94427c359d4a10b90afdae30d8a09d3d
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Mar 25 22:52:16 2014 +0000

    build: Generate AUTHORS automatically on release
    
    Instead of generating the AUTHORS file manually, generate it automatically
    based on the git commits.
    
    The file is split in two sections: current contributors (authors that has some
    line in the current code) and past contributors (those that committed code in
    the past but that nowadays has been replaced by code of new authors).
    
    Because everybody is important for this project.

 AUTHORS     |   21 ---------------------
 Makefile.am |   12 +-----------
 release.mk  |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 32 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index c599e51..e69de29 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,21 +0,0 @@
-Bastien Nocera <hadess hadess net>
-Damien Lespiau <damien lespiau intel com>
-Guillaume Emont <gemont igalia com>
-Iago Toral Quiroga <itoral igalia com>
-Joaquim Rocha <jrocha igalia com>
-Juan A. Suarez Romero <jasuarez igalia com>
-Jussi Kukkonen <jku linux intel com>
-Kjartan Maraas <kmaraas gnome org>
-Lionel Landwerlin <lionel g landwerlin linux intel com>
-Marek Chalupa <mchalupa redhat com>
-Marek Černocký <marek manet cz>
-Matej Urbančič <mateju svn gnome org>
-Mathias Hasselmann <mathias openismus com>
-Miguel Rodriguez Nuñez <bokerones fritos gmail com>
-Murray Cumming <murrayc murrayc com>
-Murray Cumming <murrayc openismus com>
-Philip Withnall <philip tecnocode co uk>
-Piotr Drąg <piotrdrag gmail com>
-Victor Toso <me victortoso com>
-Víctor Manuel Jáquez Leal <vjaquez igalia com>
-Xabier Rodriguez Calvar <xrcalvar igalia com>
diff --git a/Makefile.am b/Makefile.am
index bd9958e..813aeac 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,6 +6,7 @@
 # Copyright (C) 2010, 2011 Igalia S.L. All rights reserved.
 
 include $(top_srcdir)/gtester.mk
+include $(top_srcdir)/release.mk
 
 ACLOCAL_AMFLAGS = -I m4
 
@@ -62,17 +63,6 @@ distclean-local:
        -rm -rf autom4te.cache
 
 dist-hook:
-       @if test -d "$(srcdir)/.git"; \
-       then \
-               echo Creating ChangeLog && \
-               ( cd "$(top_srcdir)" && \
-                 $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
-               && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
-               || ( rm -f ChangeLog.tmp ; \
-                    echo Failed to generate ChangeLog >&2 ); \
-       else \
-               echo A git clone is required to generate a ChangeLog >&2; \
-       fi
 
 if GCOV_ENABLED
 lcov-clean:
diff --git a/release.mk b/release.mk
new file mode 100644
index 0000000..7a4b6e0
--- /dev/null
+++ b/release.mk
@@ -0,0 +1,48 @@
+changelog:
+       @if test -d "$(srcdir)/.git"; \
+        then \
+                echo Creating ChangeLog && \
+                ( cd "$(top_srcdir)" && \
+                  $(top_srcdir)/missing --run git log --stat ) > ChangeLog.tmp \
+                && mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
+                || ( rm -f ChangeLog.tmp ; \
+                     echo Failed to generate ChangeLog >&2 ); \
+        else \
+                echo A git clone is required to generate a ChangeLog >&2; \
+        fi
+
+authors:
+       @if test -d "$(srcdir)/.git"; \
+        then \
+                echo Creating AUTHORS && \
+                ( cd "$(top_srcdir)" && \
+                  $(top_srcdir)/missing --run git ls-tree HEAD -r | awk '{ print $$4 }'  ) > _files.tmp && \
+                ( cd "$(top_srcdir)" && \
+                  $(top_srcdir)/missing --run git log --pretty="%an <%ae>" ) > _all.tmp && \
+                ( cd "$(top_srcdir)" && \
+                  cat _all.tmp | awk -F"<" '{ print $$2 }' | sort | uniq -c | sort -rn ) > _by_commits.tmp 
&& \
+                ( cd "$(top_srcdir)" && \
+                  while read line ; do  $(top_srcdir)/missing --run git blame -c -e "$$line" | \
+                        awk '{ print $$2 }' | cut -c2- ; done  < _files.tmp | sort -u ) > _current.tmp && \
+                  touch _AUTHORS.current.tmp _AUTHORS.past.tmp && \
+                  cat _by_commits.tmp | awk '{ print $$2 }' | while read line ; do \
+                        if `grep -q "$$line" _current.tmp` ; then \
+                           grep -m 1 "$$line" _all.tmp >> _AUTHORS.current.tmp ; \
+                        else \
+                           grep -m 1 "$$line" _all.tmp >> _AUTHORS.past.tmp ; \
+                        fi \
+                  done && \
+                  echo Contributors: >> AUTHORS.tmp && \
+                  echo ============= >> AUTHORS.tmp && \
+                  cat _AUTHORS.current.tmp >> AUTHORS.tmp && \
+                  echo >> AUTHORS.tmp && \
+                  echo Past contributors: >> AUTHORS.tmp && \
+                  echo ================== >> AUTHORS.tmp && \
+                  cat _AUTHORS.past.tmp >> AUTHORS.tmp && \
+                  rm -fr _files.tmp _all.tmp _by_commits.tmp _current.tmp _AUTHORS.current.tmp 
_AUTHORS.past.tmp && \
+                  mv -f AUTHORS.tmp $(top_distdir)/AUTHORS; \
+        else \
+                echo A git clone is required to generate an AUTHORS >&2; \
+        fi
+
+dist-hook: changelog authors


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