build enhancements and GitHub workflow
Subsystems (3)
cover build enhancements and GitHub workflow
This series aimes to:
1. Allow creation of dist tarball without self-referential hard links
2. Add a distckeck target
3. Add a GitHub workflow which to performs basic build testing
A sample run of the workflow can be seen here
https://github.com/horms/kexec-tools/actions/runs/711376088
Simon Horman (7):
build: create tarball without self-referential hard links
build: add dist make target
build: uninstall kexec_test
build: use DESTDIR in uninstall target
build: simplify uninstall target
build: add distcheck target
github: initial workflow
.github/workflows/build.yml | 72 ++++++++++++++++++ Makefile.in | 141 +++++++++++++++++------------------- configure.ac | 1 + 3 files changed, 141 insertions(+), 73 deletions(-) create mode 100644 .github/workflows/build.yml
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 1/7 build: create tarball without self-referential hard links
The current method of creating the tarball, which is to the hard-link the source directory to the target directory, results in self-referential hardlinks which can be observed using tar xf.
This patch resolves this by using an intermediate tarball, held in memory, which collects files to be distributed. This is then unpacked in the target directory which is finally packed into the distribution tarball, a file.
--- Makefile.in | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
Makefile.in +5 -6
@@ -201,14 +201,13 @@ configure: configure.ac tarball: $(TARBALL.gz) $(TARBALL): $(SRCS) $(GENERATED_SRCS) - $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION) - $(LN) -s $(srcdir) $(PACKAGE_NAME)-$(PACKAGE_VERSION) + $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION) + $(MKDIR) $(PACKAGE_NAME)-$(PACKAGE_VERSION) + $(TAR) -c $(SRCS) $(GENERATED_SRCS) | \ + $(TAR) -C $(PACKAGE_NAME)-$(PACKAGE_VERSION) -x $(TAR) -cf $@ $(PSRCS) - $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION) - $(LN) -sf . $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(TAR) -rf $@ $(PGSRCS) - $(RM) -f $(PACKAGE_NAME)-$(PACKAGE_VERSION) - @echo $(dist) + $(RM) -rf $(PACKAGE_NAME)-$(PACKAGE_VERSION) $(TARBALL.gz): $(TARBALL) gzip -c < $^ > $@
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 2/7 build: add dist make target
In reply to Simon HormanThis provides a familiar alias for the existing tarball target. The result is a tar.gz file.
--- Makefile.in | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Makefile.in +3 -1
@@ -198,6 +198,8 @@ Makefile: Makefile.in config.status configure: configure.ac cd $(srcdir) && autoheader && autoconf && rm -rf autom4te.cache +dist: tarball + tarball: $(TARBALL.gz) $(TARBALL): $(SRCS) $(GENERATED_SRCS)
@@ -397,4 +399,4 @@ uninstall: done .PHONY: echo install uninstall all targets uninstall-targets clean dist-clean distclean \ - maintainer-clean maintainerclean tarball rpm + maintainer-clean maintainerclean dist tarball rpm
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 3/7 build: uninstall kexec_test
In reply to Simon Hormankexec_test is installed but not uninstalled.
Correct this oversight.
--- Makefile.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
Makefile.in +5 -1
@@ -181,15 +181,19 @@ UNINSTALL_KDUMP = $(sbindir)/kdump UNINSTALL_KDUMP_MANPAGE = $(mandir)/man8/kdump.8 UNINSTALL_KEXEC = $(sbindir)/kexec UNINSTALL_KEXEC_MANPAGE = $(mandir)/man8/kexec.8 +UNINSTALL_KEXEC_TEST = $(pkglibdir)/kexec_test UNINSTALL_VMCORE_DMESG = $(sbindir)/vmcore-dmesg UNINSTALL_VMCORE_DMESG_MANPAGE = $(mandir)/man8/vmcore-dmesg.8 TARGETS:=$(BINARIES) $(MAN_PAGES) targets: $(TARGETS) +UNINSTALL_TARGETS_i386:=$(UNINSTALL_KEXEC_TEST) +UNINSTALL_TARGETS_x86_64:=$(UNINSTALL_KEXEC_TEST) UNINSTALL_TARGETS:=$(UNINSTALL_KDUMP) $(UNINSTALL_KDUMP_MANPAGE) \ $(UNINSTALL_KEXEC) $(UNINSTALL_KEXEC_MANPAGE) \ - $(UNINSTALL_VMCORE_DMESG) $(UNINSTALL_VMCORE_DMESG_MANPAGE) + $(UNINSTALL_VMCORE_DMESG) $(UNINSTALL_VMCORE_DMESG_MANPAGE) \ + $(UNINSTALL_TARGETS_$(ARCH)) uninstall-targets: $(UNINSTALL_TARGETS) Makefile: Makefile.in config.status
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 4/7 build: use DESTDIR in uninstall target
In reply to Simon HormanFor symmetry with the install target, also use DESTDIR in the uninstall target.
--- Makefile.in | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-)
Makefile.in +21 -21
@@ -338,67 +338,67 @@ install: $(TARGETS) uninstall: UINSTALL_LIST='$(UNINSTALL_TARGETS)'; for file in $$UINSTALL_LIST ; do \ if test `$(DIRNAME) $$file` = "$(sbindir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(bindir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(libexecdir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(datadir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(sysconfdir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(sharedstatedir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(localstatedir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(libdir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(infodir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man1" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man2" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man3" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man4" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man5" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man6" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man7" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(mandir)/man8" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(includedir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(pkgdatadir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(pkglibdir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ if test `$(DIRNAME) $$file` = "$(pkgincludedir)" ; then \ - rm -rf $$file ; \ + rm -rf $(DESTDIR)/$$file ; \ fi; \ done
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 5/7 build: simplify uninstall target
In reply to Simon HormanThis appears to have been copied from some generated code. Simplify it by rolling repetitive operations into a for loop.
--- Makefile.in | 81 +++++++++++------------------------------------------ 1 file changed, 17 insertions(+), 64 deletions(-)
Makefile.in +17 -64
@@ -106,6 +106,14 @@ PKGDATADIR=$(DATADIR)/$(PACKAGE_NAME) PKGLIBDIR=$(LIBDIR)/$(PACKAGE_NAME) PKGINCLUDEIR=$(INCLUDEDIR)/$(PACKAGE_NAME) +ALLOWED_UNINSTALL_DIRS := \ + $(SBINDIR) \ + $(sbindir) $(bindir) $(libexecdir) $(datadir) $(sysconfdir) \ + $(sharedstatedir) $(localstatedir) $(libdir) $(infodir) \ + $(mandir)/man1 $(mandir)/man2 $(mandir)/man3 $(mandir)/man4 \ + $(mandir)/man5 $(mandir)/man6 $(mandir)/man7 $(mandir)/man8 \ + $(includedir) $(pkgdatadir) $(pkglibdir) $(pkgincludedir) + all: targets # generic build rules
@@ -336,70 +344,15 @@ install: $(TARGETS) done uninstall: - UINSTALL_LIST='$(UNINSTALL_TARGETS)'; for file in $$UINSTALL_LIST ; do \ - if test `$(DIRNAME) $$file` = "$(sbindir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(bindir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(libexecdir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(datadir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(sysconfdir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(sharedstatedir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(localstatedir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(libdir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(infodir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man1" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man2" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man3" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man4" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man5" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man6" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man7" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(mandir)/man8" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(includedir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(pkgdatadir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(pkglibdir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ - if test `$(DIRNAME) $$file` = "$(pkgincludedir)" ; then \ - rm -rf $(DESTDIR)/$$file ; \ - fi; \ + UINSTALL_LIST='$(UNINSTALL_TARGETS)'; \ + for file in $$UINSTALL_LIST ; do \ + DIRS='$(ALLOWED_UNINSTALL_DIRS)'; \ + for dir in $$DIRS ; do \ + if test `$(DIRNAME) $$file` = "$$dir" ; then \ + rm -rf $(DESTDIR)/$$file ; \ + break ; \ + fi; \ + done; \ done .PHONY: echo install uninstall all targets uninstall-targets clean dist-clean distclean \
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 6/7 build: add distcheck target
In reply to Simon HormanAdd distcheck target which aims to exercise build, install and uninstall using distribution tarball.
--- Makefile.in | 39 ++++++++++++++++++++++++++++++++++++++- configure.ac | 1 + 2 files changed, 39 insertions(+), 1 deletion(-)
Makefile.in +38 -1
@@ -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
configure.ac +1 -0
@@ -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])
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
PATCH 7/7 github: initial workflow
In reply to Simon HormanInitial github workflow which builds kexec on a range of architectures.
--- .github/workflows/build.yml | 72 +++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/build.yml
.github/workflows/build.yml new file +72 -0
@@ -0,0 +1,72 @@ +name: Build + +on: push + +jobs: + build: + name: Build + runs-on: ubuntu-20.04 + strategy: + matrix: + arch: + - arm + - arm64 + - hppa + - i686 + - m68k + - mips + - mipsel + - powerpc + - powerpc64 + - powerpc64le + - sh4 + - s390x + - x86_64-x32 + include: + - arch: x86_64 + - arch: x86_64 + libxen: libxen + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set Environment + env: + LIBXEN: ${{ matrix.libxen }} + ARCH: ${{ matrix.arch }} + run: | + case $LIBXEN in + libxen) EXTRA_PKGS+=" libxen-dev" ;; + esac + + case $ARCH in + arm) GNU_ARCH="arm-linux-gnueabi" ;; + arm64) GNU_ARCH="aarch64-linux-gnu" ;; + x86_64) ;; + x86_64-x32) GNU_ARCH="x86_64-linux-gnux32" + CROSS_COMPILER_PKG="gcc-x86-64-linux-gnux32" ;; + *) GNU_ARCH="$ARCH-linux-gnu" ;; + esac + + if [ -n "$GNU_ARCH" ]; then + if [ -z "$CROSS_COMPILER_PKG" ]; then + CROSS_COMPILER_PKG="gcc-$GNU_ARCH" + fi + EXTRA_PKGS+=" $CROSS_COMPILER_PKG" + CONFIG_FLAGS+=" --host=$GNU_ARCH" + fi + + echo "EXTRA_PKGS=$EXTRA_PKGS" >> $GITHUB_ENV + echo "CONFIG_FLAGS=$CONFIG_FLAGS" >> $GITHUB_ENV + + - name: Install Dependencies + if: env.EXTRA_PKGS != '' + run: sudo apt-get -q=2 install ${{ env.EXTRA_PKGS }} + + - name: Build + run: | + ./bootstrap + ./configure ${{ env.CONFIG_FLAGS }} + make -j"$(nproc)" distcheck \ + DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIG_FLAGS }}" +
Signature · 7 lines
2.20.1 _______________________________________________ kexec mailing list [email protected] http://lists.infradead.org/mailman/listinfo/kexec
Quoted 8 lines · Simon Horman
This series aimes to:
1. Allow creation of dist tarball without self-referential hard links
2. Add a distckeck target
3. Add a GitHub workflow which to performs basic build testingA sample run of the workflow can be seen here
https://github.com/horms/kexec-tools/actions/runs/711376088
Series applied.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec