From bcd65f00ac939d3485b5ee2d5f38e11df58f6762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Pokorn=C3=BD?= Date: Tue, 4 Sep 2018 21:18:25 +0200 Subject: [PATCH] build: allow for being consumed in a (non-endorsed) form of snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is meant as a lean, customized policy driven alternative to the original proposal by Jan Friesse that balances the inherent trade-off in the opposite direction, so that the configure.ac script is practically untouched and more weight and policy is hardcoded in git-version-gen. Problem with that approach stems from (avoidable) effective fork of the respective gnulib's module and imposed maintenance burden. Speaking for libqb in particular, we should nonetheless make it absolutely clear such in-development snapshots are nothing more, nothing binding (not to think of viral injection of these bits into circle of dependent packages upon their rebuilds), since the changes accumulated since the last official release should only be assumed firmly committed at the point the new release is cut (may happen 99% of time with snapshots but no accountability from our side for the complementary inter-release twists...), which is exactly when many possibly unanticipated variables like correct SONAME versions get to reflect what's appropriate. Also, OpenPGP signature constitutes something more eligible for one's trust than (provably) bit/content unstable archives without the possibility of an independent authenticity/integrity verification. Therefore, the only thinkable and upstream-endorsed use cases for such snapshots are development-only purposes (CI et al.)! Signed-off-by: Jan Pokorný --- .gitattributes | 1 + .gitignore | 18 +++++++++++++----- Makefile.am | 7 ++++++- autogen.sh | 6 +++++- configure.ac | 12 +++++++++--- 5 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..86b753281 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +/configure.ac export-subst diff --git a/.gitignore b/.gitignore index 48d733624..9ae5f5426 100644 --- a/.gitignore +++ b/.gitignore @@ -16,24 +16,32 @@ autom4te.cache/ config.status configure conftest.* -.libs -# since we use subdir-objects as automake option -.dirstamp + +# dotfiles + +.* +# - subsumed: +# .dirstamp (since we use subdir-objects as automake option) +# .libs +# .{,snapshot-,tarball-}version +# - sans: +!.git* +!/.tito +!/.travis.yml + # ignore "libtoolized" m4 files, but keep our (custom-prefixed) ones /m4/* !/m4/ax_*.m4 # build-aux/release.mk related litter -/.tarball-version /tag-* /lib/qblog_script.ld # already captured with wildcard: /lib/qblog_script.la libtool -.version libqb.spec libqb-* cov diff --git a/Makefile.am b/Makefile.am index 6ced4c185..37f578c45 100644 --- a/Makefile.am +++ b/Makefile.am @@ -48,7 +48,7 @@ doxygen: $(MAKE) -C docs doxygen dist-clean-local: - rm -f autoconf automake autoheader + rm -f .snapshot-version autoconf automake autoheader # this will also get rid of "libtoolized" m4 files maintainer-clean-local: @@ -128,8 +128,13 @@ BUILT_SOURCES = .version .version: echo $(VERSION) > $@-t && mv $@-t $@ +# also untaint configure.ac when modified upon obtaining the snapshot form dist-hook: gen-ChangeLog echo $(VERSION) > $(distdir)/.tarball-version + sed "s/\(.*git-version-gen[^']*[']\)[^']*/\1\$$Format:%h!%D\$$/" \ + $(distdir)/configure.ac > $(distdir)/configure.ac-t + touch -r $(distdir)/configure.ac $(distdir)/configure.ac-t + mv $(distdir)/configure.ac-t $(distdir)/configure.ac gen_start_date = 2000-01-01 .PHONY: gen-ChangeLog diff --git a/autogen.sh b/autogen.sh index a10bf96c3..d5bb04f80 100755 --- a/autogen.sh +++ b/autogen.sh @@ -1,3 +1,7 @@ #!/bin/sh # Run this to generate all the initial makefiles, etc. -autoreconf -i -v && echo Now run ./configure and make +autoreconf -i -v \ + && { test -s .snapshot-version \ + && echo 'USE SNAPSHOT ONLY AT YOUR RISK (official release recommended)' \ + || :; } \ + && echo Now run ./configure and make diff --git a/configure.ac b/configure.ac index d57634eb2..0b76a6499 100644 --- a/configure.ac +++ b/configure.ac @@ -3,10 +3,16 @@ AC_PREREQ([2.61]) -dnl inject zero as a "patch" component of the version if missing in tag +dnl inject zero as a "patch" component of the version if missing in tag; +dnl care to bump X.Y.Z-g* version below with each point release very desirable AC_INIT([libqb], - m4_esyscmd([build-aux/git-version-gen .tarball-version \ - 's|^\(v[0-9][0-9]*\.[0-9][0-9]*\)\([^.].*\)\?$|\1.0\2|']), + m4_esyscmd([build-aux/git-version-gen $(echo '$Format:%h!%D$' \ + | sed -ne 's/[$]Format:%h!%D[$]/.tarball-version/p;tend' \ + -e 's/.*tag: v\([^, ][^, ]*\).*/\1/;tv' \ + -e 's/^\([[:xdigit:]][[:xdigit:]]*\).*/1.0.3-g\1/' \ + -e ':v;w .snapshot-version' -e 'i .snapshot-version' \ + -e ':end;q') \ + 's/^\(v[0-9][0-9]*\.[0-9][0-9]*\)\([^.].*\)\?$/\1.0\2/']), [developers@clusterlabs.org]) AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_SRCDIR([lib/ringbuffer.c])