[libvirt] [libvirt-snmp][PATCH 0/3] Couple of build improvements

I'd like to get some review for these actually. Michal Privoznik (3): Generate AUTHORS from git log Makefile: Introduce srpm target configure: Prevent autoreconf from installing `compile' file .gitignore | 4 ++-- AUTHORS => AUTHORS.in | 12 +++++------- Makefile.am | 38 +++++++++++++++++++++++++++----------- autogen.sh | 10 ++++++---- configure.ac | 8 ++++++-- 5 files changed, 46 insertions(+), 26 deletions(-) rename AUTHORS => AUTHORS.in (44%) -- 2.16.4

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@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@redhat.com> - Doug Goldstein <cardoe@cardoe.com> - Laine Stump <laine@laine.org> - Martin Kletzander <mkletzan@redhat.com> - Jorge Boncompte <jorge@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

On Wed, Sep 05, 2018 at 10:55:38AM +0200, Michal Privoznik wrote:
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@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/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)
What was the versioning system used by libvirt-snmp before? commit ac37a36d642c7e035ec1651dbf8d30c12c648efe Author: Michal Privoznik <mprivozn@redhat.com> AuthorDate: Thu Feb 3 10:51:36 2011 +0100 Commit: Michal Privoznik <mprivozn@redhat.com> CommitDate: Thu Feb 3 10:51:36 2011 +0100 Initial revision
+# 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 \
The ../.git test is suspicious, but, more importantly:
+ $(top_srcdir)/build-aux/gitlog-to-changelog \
how do you expect gitlog-to-changelog to appear in build-aux?
+ > $(distdir)/cl-t; \ + rm -f $(distdir)/ChangeLog; \ + mv $(distdir)/cl-t $(distdir)/ChangeLog; \
This is just an overly verbose touch. Are you looking for the 'foreign' option to AM_INIT_AUTOMAKE which relaxes the GNU packaging standards?
+ fi
-.PHONY: gen-ChangeLog - -dist-hook: gen-ChangeLog +gen-AUTHORS: + $(AM_V_GEN)if test -d $(srcdir)/.git; then \
test -x
+ 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
Unrelated change.
+# Real ChangeLog/AUTHORS is auto-generated from GIT logs at
s/ChangeLog//
+# make dist time, but automake requires that it +# exists at all times :-( +touch ChangeLog AUTHORS
s/ChangeLog//
-autoreconf -i -f +mkdir -p build-aux
This will not be needed without ChangeLog
+autoreconf -if
And this change is also unrelated.
cd $THEDIR
-- 2.16.4
With only the AUTHORS-related stuff in: Reviewed-by: Ján Tomko <jtomko@redhat.com> Otherwise, the "nobody cares about libvirt-snmp" rule applies. Jano

Just like we have 'rpm' we might have 'srpm'. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9ac6fc2..6ce91ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,18 @@ SUBDIRS=src/ docs/ EXTRA_DIST = \ - libvirt-snmp.spec libvirt-snmp.spec.in \ + $(PACKAGE).spec \ + $(PACKAGE).spec.in \ autobuild.sh \ autogen.sh \ AUTHORS.in \ $(NULL) rpm: clean - @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz) + +srpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz) dist-hook: gen-ChangeLog gen-AUTHORS -- 2.16.4

On Wed, Sep 05, 2018 at 10:55:39AM +0200, Michal Privoznik wrote:
Just like we have 'rpm' we might have 'srpm'.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- Makefile.am | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/Makefile.am b/Makefile.am index 9ac6fc2..6ce91ed 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,14 +1,18 @@ SUBDIRS=src/ docs/
EXTRA_DIST = \ - libvirt-snmp.spec libvirt-snmp.spec.in \ + $(PACKAGE).spec \ + $(PACKAGE).spec.in \
This change is also unrelated.
autobuild.sh \ autogen.sh \ AUTHORS.in \ $(NULL)
rpm: clean - @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz) + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.xz) +
This breaks 'make rpm' make[1]: Leaving directory '/home/test/libvirt-snmp' error: File libvirt-snmp-0.0.3.tar.xz: No such file or directory /usr/bin/cat: libvirt-snmp-0.0.3.tar.xz: No such file or directory error: File libvirt-snmp-0.0.3.tar.xz: No such file or directory /usr/bin/cat: libvirt-snmp-0.0.3.tar.xz: No such file or directory error: Failed to read spec file from libvirt-snmp-0.0.3.tar.xz make: *** [Makefile:786: rpm] Error 1 Switching the project to use dist-xz before referencing it might help. Jano
+srpm: clean + @(unset CDPATH ; $(MAKE) dist && rpmbuild -ts $(distdir).tar.xz)
dist-hook: gen-ChangeLog gen-AUTHORS
-- 2.16.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

When running autoreconf, it installs this `compile' file which triggers my OCD. It appears that our configure script can be modernized a bit which makes it stop. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index f520927..c8df41d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,12 @@ AC_INIT([libvirt-snmp],[0.0.3],[libvir-list@redhat.com],[],[http://libvirt.org]) -AM_INIT_AUTOMAKE([-Wall -Werror]) +AC_CONFIG_SRCDIR(src/libvirtSnmp.c) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([-Wall -Werror]) -AC_PREREQ([2.50]) +AC_CANONICAL_HOST + +AM_SILENT_RULES([yes]) AC_PROG_CC AM_PROG_CC_C_O -- 2.16.4

s/Prevent autoreconf from installing `compile' file/Modernize/ On Wed, Sep 05, 2018 at 10:55:40AM +0200, Michal Privoznik wrote:
When running autoreconf, it installs this `compile' file which
s/installs/creates/ maybe? I'd expect 'install' to refer to the process of copying the resulting files into the system by 'make install'
triggers my OCD. It appears that our configure script can be modernized a bit which makes it stop.
It merely puts them into the requested AUX_DIR
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- configure.ac | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac index f520927..c8df41d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,8 +1,12 @@ AC_INIT([libvirt-snmp],[0.0.3],[libvir-list@redhat.com],[],[http://libvirt.org]) -AM_INIT_AUTOMAKE([-Wall -Werror]) +AC_CONFIG_SRCDIR(src/libvirtSnmp.c) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_HEADERS([config.h]) +AM_INIT_AUTOMAKE([-Wall -Werror])
Not moving this line would make the diff smaller.
-AC_PREREQ([2.50])
+AC_CANONICAL_HOST
Not necessary, 'host' is not used anywhere.
+ +AM_SILENT_RULES([yes])
Without the AM_INIT_AUTOMAKE and AC_CANONICAL_HOST changes: Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano
participants (2)
-
Ján Tomko
-
Michal Privoznik