[PATCH kexec-tools 6/7] build: add distcheck target
Simon Horman
horms at verge.net.au
Fri Apr 2 11:17:36 BST 2021
Add distcheck target which aims to exercise build, install and uninstall
using distribution tarball.
Signed-off-by: Simon Horman <horms at verge.net.au>
---
Makefile.in | 39 ++++++++++++++++++++++++++++++++++++++-
configure.ac | 1 +
2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/Makefile.in b/Makefile.in
index 1569b42..09bbd5c 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -55,6 +55,8 @@ LIBS = @LIBS@
# Utilities called by the makefiles
INSTALL = @INSTALL@
+CHMOD = @CHMOD@
+CD = cd
MKDIR = @MKDIR@
RM = @RM@
CP = @CP@
@@ -215,6 +217,8 @@ dist: tarball
tarball: $(TARBALL.gz)
$(TARBALL): $(SRCS) $(GENERATED_SRCS)
+ [ ! -d $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] || \
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)
$(TAR) -c $(SRCS) $(GENERATED_SRCS) | \
@@ -255,6 +259,38 @@ dist-clean: clean
$(RM) -f include/config.h.in configure $(SPEC)
$(RM) -rf autom4te.cache
+distuninstallcheck:
+ FOUND=$$(find $(distuninstallcheck_dir) ! -type d) && \
+ [ -z "$$FOUND" ] || { \
+ echo "Unexpeced files found after uninstall:" && \
+ echo "$$FOUND" && \
+ exit 1; }
+
+distcheck: $(TARBALL)
+ [ ! -d $(PACKAGE_NAME)-$(PACKAGE_VERSION) ] || \
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(TAR) -xf $(TARBALL)
+ $(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build/sub \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_inst \
+ $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_dest
+ $(CHMOD) a-w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ test -d $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build
+ INSTALL_BASE=$$($(CD) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,') &&\
+ DESTDIR="$(PACKAGE_NAME)-$(PACKAGE_VERSION)/_dest" && \
+ $(CD) $(PACKAGE_NAME)-$(PACKAGE_VERSION)/_build/sub && \
+ ../../configure \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ --srcdir=../.. --prefix="$$INSTALL_BASE" && \
+ $(MAKE) $(AM_MAKEFLAGS) && \
+ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" install && \
+ $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$DESTDIR" uninstall && \
+ $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$DESTDIR" \
+ distuninstallcheck
+ $(CHMOD) u+w $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+ $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION)
+
install: $(TARGETS)
for file in $(TARGETS) ; do \
if test `$(DIRNAME) $$file` = "$(SBINDIR)" ; then \
@@ -355,5 +391,6 @@ uninstall:
done; \
done
-.PHONY: echo install uninstall all targets uninstall-targets clean dist-clean distclean \
+.PHONY: echo install uninstall distuninstallcheck all targets \
+ uninstall-targets clean dist-clean distclean distcheck \
maintainer-clean maintainerclean dist tarball rpm
diff --git a/configure.ac b/configure.ac
index 6c8e053..6469fd1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -151,6 +151,7 @@ AC_SUBST(PURGATORY_EXTRA_CFLAGS, [$PURGATORY_EXTRA_CFLAGS])
dnl Find the helper functions
AC_PROG_INSTALL
+AC_CHECK_PROG([CHMOD], chmod, chmod, "no", [$PATH])
AC_CHECK_PROG([MKDIR], mkdir, mkdir, "no", [$PATH])
AC_CHECK_PROG([RM], rm, rm, "no", [$PATH])
AC_CHECK_PROG([CP], cp, cp, "no", [$PATH])
--
2.20.1
More information about the kexec
mailing list