[libvirt] [libvirt-snmp][PATCH 1/3] Generate AUTHORS from git log

Michal Privoznik mprivozn at redhat.com
Wed Sep 5 08:55:38 UTC 2018


Adding new contributor to the list is something I keep forgetting
about. Therefore switch to autogenerated list of contributors,
just like every other libvirt project is doing so.

Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 .gitignore            |  4 ++--
 AUTHORS => AUTHORS.in | 12 +++++-------
 Makefile.am           | 30 +++++++++++++++++++++---------
 autogen.sh            | 10 ++++++----
 4 files changed, 34 insertions(+), 22 deletions(-)
 rename AUTHORS => AUTHORS.in (44%)

diff --git a/.gitignore b/.gitignore
index 2193ea2..aae9628 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,5 @@
-#*#
-*.#*#
+AUTHORS
+ChangeLog
 *.a
 *.exe
 *.gcda
diff --git a/AUTHORS b/AUTHORS.in
similarity index 44%
rename from AUTHORS
rename to AUTHORS.in
index 79dcc0e..d117ae4 100644
--- a/AUTHORS
+++ b/AUTHORS.in
@@ -1,5 +1,5 @@
-      libvirt-snmp
-     ==============
+      libvirt-snmp Authors
+     =====================
 
 
 The main work done by:
@@ -13,8 +13,6 @@ Autoconfiscated by:
 
 Patches have also been contributed by:
 
-     Daniel P. Berrange     <berrange at redhat.com>
-     Doug Goldstein         <cardoe at cardoe.com>
-     Laine Stump            <laine at laine.org>
-     Martin Kletzander      <mkletzan at redhat.com>
-     Jorge Boncompte        <jorge at dti2.net>
+#authorslist#
+
+   ... send patches to get your name added ...
diff --git a/Makefile.am b/Makefile.am
index ae1cd79..9ac6fc2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,18 +3,30 @@ SUBDIRS=src/ docs/
 EXTRA_DIST = \
 	libvirt-snmp.spec libvirt-snmp.spec.in \
 	autobuild.sh \
-	autogen.sh
+	autogen.sh \
+	AUTHORS.in \
+	$(NULL)
 
 rpm: clean
 		@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
 
+dist-hook: gen-ChangeLog gen-AUTHORS
+
+# Generate the ChangeLog file (with all entries since the switch to git)
+# and insert it into the directory we're about to use to create a tarball.
+.PHONY: gen-ChangeLog gen-AUTHORS
 gen-ChangeLog:
-		if [ -d .git ]; then \
-			git log --oneline | sed 's/[0-9a-f]* \(.*\)/\1/' > $(distdir)/ChangeLog; \
-		else \
-			echo "Prevent non-empty ChangeLog" > $(distdir)/ChangeLog ;\
-		fi
+	if test -d .git || test -d ../.git; then					\
+	  $(top_srcdir)/build-aux/gitlog-to-changelog		\
+	     > $(distdir)/cl-t;	\
+	  rm -f $(distdir)/ChangeLog;				\
+	  mv $(distdir)/cl-t $(distdir)/ChangeLog;		\
+	fi
 
-.PHONY: gen-ChangeLog
-
-dist-hook: gen-ChangeLog
+gen-AUTHORS:
+	$(AM_V_GEN)if test -d $(srcdir)/.git; then                      \
+	  out="`cd $(srcdir) && git log --pretty=format:'%aN <%aE>' | sort -u`" && \
+	  perl -p -e "s/#authorslist#// and print '$$out'"            \
+	    < $(srcdir)/AUTHORS.in > $(distdir)/AUTHORS-tmp &&        \
+	  mv -f $(distdir)/AUTHORS-tmp $(distdir)/AUTHORS ;           \
+	fi
diff --git a/autogen.sh b/autogen.sh
index 5d00494..12d0dc0 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -15,11 +15,13 @@ if test -z "$*"; then
 fi
 
 # Automake requires that ChangeLog exist.
-if test ! -f ChangeLog; then
-    touch ChangeLog || exit 1
-fi
+# Real ChangeLog/AUTHORS is auto-generated from GIT logs at
+# make dist time, but automake requires that it
+# exists at all times :-(
+touch ChangeLog AUTHORS
 
-autoreconf -i -f
+mkdir -p build-aux
+autoreconf -if
 
 cd $THEDIR
 
-- 
2.16.4




More information about the libvir-list mailing list