From 1158bb0c068af00f67663318f4145aa34a724cea Mon Sep 17 00:00:00 2001 From: Caleb Maclennan Date: Sat, 6 Apr 2024 23:05:39 +0300 Subject: [PATCH] Gate check tooling like linters behind developer mode flag --- .github/workflows/build.yml | 2 +- .github/workflows/release.yml | 2 +- Makefile.am | 19 ++++++++++++++++--- build-aux/que_dist_checksums.m4 | 14 +++++++++----- build-aux/que_git_version.m4 | 13 +++++++------ configure.ac | 1 + 6 files changed, 35 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 965d87d6..d567897a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,7 +49,7 @@ jobs: - name: Configure run: | ./bootstrap.sh - ./configure + ./configure --enable-developer-mode - name: Run tests run: | make check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8da056b2..c2e02750 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: echo "VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV echo "${GITHUB_REF#refs/*/v}" > .tarball-version ./bootstrap.sh - ./configure + ./configure --enable-developer-mode - name: Generate release-specific changelog run: | echo "PRERELEASE=${{ contains(env.VERSION, '-alpha') || contains(env.VERSION, '-beta') || contains(env.VERSION, '-rc') }}" >> $GITHUB_ENV diff --git a/Makefile.am b/Makefile.am index 031bc8fc..648a9758 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,17 +68,28 @@ prove: .PHONY: test test: prove -.PHONY: lint +PHONY_DEVELOPER_TARGETS = lint lint-editor-config lint-shellheck +.PHONY: $(PHONY_DEVELOPER_TARGETS) + +if DEVELOPER_MODE + lint: lint-editor-config lint-shellcheck -.PHONY: lint-editor-config lint-editor-config: ec -.PHONY: lint-shellheck lint-shellcheck: $(PACKAGE_NAME) shellcheck $< +else !DEVELOPER_MODE + +$(PHONY_DEVELOPER_TARGETS): + @: $(error "Please reconfigure using --enable-developer-mode to use developer tooling") + +endif !DEVELOPER_MODE + +if SOURCE_IS_GIT + CONTRIBUTORS: exec > $@ echo 'Alphabetical list of names of everyone who ever committed to this repository.' @@ -88,3 +99,5 @@ CONTRIBUTORS: changelog-HEAD: changelog sed -nEe '2d;s/^\t//p;/^$$/q;' $< > $@ + +endif SOURCE_IS_GIT diff --git a/build-aux/que_dist_checksums.m4 b/build-aux/que_dist_checksums.m4 index 5206b372..cc213afa 100644 --- a/build-aux/que_dist_checksums.m4 +++ b/build-aux/que_dist_checksums.m4 @@ -1,13 +1,17 @@ AC_DEFUN_ONCE([QUE_DIST_CHECKSUMS], [ - QUE_PROGVAR([sha256sum]) - QUE_PROGVAR([tee]) + AM_COND_IF([DEVELOPER_MODE], [ - QUE_TRANSFORM_PACKAGE_NAME + QUE_PROGVAR([sha256sum]) + QUE_PROGVAR([tee]) - AC_REQUIRE([AX_AM_MACROS]) - AX_ADD_AM_MACRO([dnl + QUE_TRANSFORM_PACKAGE_NAME + + AC_REQUIRE([AX_AM_MACROS]) + + AX_ADD_AM_MACRO([dnl $(cat build-aux/que_dist_checksums.am) ])dnl + ]) ]) diff --git a/build-aux/que_git_version.m4 b/build-aux/que_git_version.m4 index 7174a56f..56e7f18b 100644 --- a/build-aux/que_git_version.m4 +++ b/build-aux/que_git_version.m4 @@ -1,11 +1,5 @@ AC_DEFUN_ONCE([QUE_GIT_VERSION], [ - AC_PROG_AWK - AC_PROG_GREP - QUE_PROGVAR([cmp]) - - QUE_TRANSFORM_PACKAGE_NAME - AM_CONDITIONAL([SOURCE_IS_GIT], [test -d .git]) @@ -15,6 +9,13 @@ AC_DEFUN_ONCE([QUE_GIT_VERSION], [ AM_CONDITIONAL([SOURCE_IS_ARCHIVE], [test ! -d .git -a ! -f .tarball-version]) + AC_PROG_AWK + AC_PROG_GREP + + QUE_TRANSFORM_PACKAGE_NAME + + AM_COND_IF([SOURCE_IS_DIST], [], [QUE_PROGVAR([cmp])]) + AC_REQUIRE([AX_AM_MACROS]) AX_ADD_AM_MACRO([dnl $(cat build-aux/que_git_version.am) diff --git a/configure.ac b/configure.ac index b8166edd..928033aa 100644 --- a/configure.ac +++ b/configure.ac @@ -26,6 +26,7 @@ AC_ARG_WITH([standalone], []) QUE_TRANSFORM_PACKAGE_NAME +QUE_DEVELOPER_MODE # These macros must be run after processing our standalone setup because # they all expect the program name transformation setup to be complete.