[grilo] build: Generate AUTHORS automatically on release



commit 0f2dd0486d9ef589dfd73a5ff41b7479742cc695
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date:   Tue Mar 25 22:32:51 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     |   17 -----------------
 Makefile.am |   12 +-----------
 release.mk  |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 49 insertions(+), 28 deletions(-)
---
diff --git a/AUTHORS b/AUTHORS
index e1c7ff8..e69de29 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,17 +0,0 @@
-Alberto Garcia <agarcia igalia com>
-Bastien Nocera <hadess hadess net>
-Damien Lespiau <damien lespiau intel com>
-Emanuele Aina <emanuele aina collabora com>
-Guillaume Emont <gemont igalia com>
-Iago Toral Quiroga <itoral igalia com>
-Jens Georg <jensg openismus com>
-Joaquim Rocha <jrocha igalia com>
-Juan A. Suarez Romero <jasuarez igalia com>
-Kjartan Maraas <kmaraas gnome org>
-Lionel Landwerlin <lionel g landwerlin linux intel com>
-Mathias Hasselmann <mathias openismus com>
-Murray Cumming <murrayc murrayc com>
-Sam Thursfield <sam thursfield codethink co uk>
-Simon Pena Placer <spenap gmail 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 ee0a7f3..ceceaaa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -56,16 +56,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
 
 -include $(top_srcdir)/git.mk
+-include $(top_srcdir)/release.mk
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]