Release v0.2.0: single-source the version, wildcard it in docs
Introduces a VERSION variable in the top-level Makefile as the authoritative source for the module's reported version. A new version-header target writes src/version.h only when the content would change, so no-op rebuilds don't rewrite the file. The C source #includes that header in place of a hardcoded #define; the user-guide's install example is wildcarded (libnginx-mod-http-ipng-stats_*_amd64.deb) so it doesn't drift. The design doc still references v0.2.0 by name — operators read it as a point-in-time description, not a moving target. debian/changelog keeps its own 0.2.0-1 entry because dpkg reads the package version from there directly; the e2e test is updated to match the JSON schema bump to 2. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
24
Makefile
24
Makefile
@@ -18,9 +18,16 @@ MODULE_NAME := ngx_http_ipng_stats_module
|
||||
MODULE_DIR := $(CURDIR)
|
||||
BUILD_DIR := $(CURDIR)/build
|
||||
|
||||
# Single source of truth for the module version. When cutting a release,
|
||||
# bump this AND add a matching top entry to debian/changelog — dpkg reads
|
||||
# the package version from there directly. The C code picks up VERSION
|
||||
# via the generated src/version.h (written by the version-header target
|
||||
# below and depended on by the module build).
|
||||
VERSION := 0.2.0
|
||||
|
||||
NGINX_SRC ?=
|
||||
|
||||
.PHONY: help build pkg-deb robot-test install-deps clean fetch-nginx-src
|
||||
.PHONY: help build pkg-deb robot-test install-deps clean fetch-nginx-src version-header
|
||||
|
||||
TEST ?= tests/
|
||||
|
||||
@@ -50,7 +57,19 @@ build: $(BUILD_DIR)/$(MODULE_NAME).so
|
||||
@echo " echo 'load_module modules/$(MODULE_NAME).so;' | sudo tee /etc/nginx/modules-enabled/50-mod-http-ipng-stats.conf"
|
||||
@echo " sudo nginx -t && sudo nginx -s reload"
|
||||
|
||||
$(BUILD_DIR)/$(MODULE_NAME).so: fetch-nginx-src
|
||||
# version-header: write src/version.h iff its contents would change. The
|
||||
# target is .PHONY so it's re-evaluated every build, but the file itself
|
||||
# is only touched on VERSION bumps — keeps the .so from rebuilding when
|
||||
# nothing has actually changed.
|
||||
version-header:
|
||||
@NEW='#define NGX_HTTP_IPNG_STATS_VERSION "$(VERSION)"'; \
|
||||
if [ ! -f $(MODULE_DIR)/src/version.h ] \
|
||||
|| [ "$$NEW" != "$$(cat $(MODULE_DIR)/src/version.h)" ]; then \
|
||||
echo "Generating src/version.h (VERSION=$(VERSION))"; \
|
||||
echo "$$NEW" > $(MODULE_DIR)/src/version.h; \
|
||||
fi
|
||||
|
||||
$(BUILD_DIR)/$(MODULE_NAME).so: version-header fetch-nginx-src
|
||||
@set -e; \
|
||||
if [ -z "$(NGINX_SRC)" ]; then \
|
||||
NGX_SRC="$(BUILD_DIR)/nginx-src"; \
|
||||
@@ -154,4 +173,5 @@ install-deps:
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILD_DIR) tests/.venv tests/out
|
||||
rm -f $(MODULE_DIR)/src/version.h
|
||||
-dh_clean 2>/dev/null || true
|
||||
|
||||
Reference in New Issue
Block a user