Pull the .deb + ASan-nginx rebuild out of `make robot-test` — a full
dpkg-buildpackage + nginx recompile before every test run was turning
a 15-second test loop into a multi-minute one, which hurts when
iterating on a flaky suite. robot-test now fails fast with an
actionable message if either artifact is missing:
Bootstrap once: make pkg-deb build-asan
Then iterate: make robot-test # reuses both
install-deps grew to cover what a truly minimal Debian box needs —
`build-essential`, `ca-certificates`, and an explicit check that
`deb-src` is enabled (required by `apt source nginx`, which both
fetch-nginx-src and build-asan rely on). `nginx-dev` transitively
brings in the nginx build-deps (libpcre2-dev, libssl-dev, libxslt1-dev,
libgeoip-dev, libperl-dev, libexpat-dev, libgd-dev, zlib1g-dev,
debhelper-compat, po-debconf) so those stay off the explicit list.
debian/rules' override_dh_clean now pre-clears
build/nginx-asan/{fastcgi,proxy,scgi,uwsgi,client_body}_temp before
running dh_clean. Those dirs get chowned to "nobody" when the 02-asan
robot suite bind-mounts build/nginx-asan/ RW into its container and
nginx master startup creates them — subsequent pkg-deb runs were
dying with EACCES from dh_clean's find traversal. rm -rf only needs
write access to the parent (which we have), so this is safe.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
62 lines
2.4 KiB
Makefile
Executable File
62 lines
2.4 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
# debian/rules for nginx-ipng-stats-plugin
|
|
#
|
|
# The actual module build is driven by the top-level Makefile, which
|
|
# copies /usr/share/nginx/src (from nginx-dev) into a writable
|
|
# build/nginx-src/ and runs the out-of-tree --add-dynamic-module dance
|
|
# against it. debian/rules just delegates to `make build` and installs
|
|
# the resulting .so into the package tree.
|
|
|
|
export DH_VERBOSE = 1
|
|
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
|
|
|
MODULE_NAME := ngx_http_ipng_stats_module
|
|
PKG := libnginx-mod-http-ipng-stats
|
|
|
|
%:
|
|
dh $@
|
|
|
|
override_dh_auto_configure:
|
|
# No-op: configure happens inside `make build`.
|
|
|
|
override_dh_auto_build:
|
|
$(MAKE) build
|
|
|
|
override_dh_auto_install:
|
|
install -D -m 0644 \
|
|
$(CURDIR)/build/$(MODULE_NAME).so \
|
|
$(CURDIR)/debian/$(PKG)/usr/lib/nginx/modules/$(MODULE_NAME).so
|
|
install -D -m 0644 \
|
|
$(CURDIR)/debian/mod-http-ipng-stats.conf \
|
|
$(CURDIR)/debian/$(PKG)/etc/nginx/modules-available/50-mod-http-ipng-stats.conf
|
|
|
|
override_dh_auto_clean:
|
|
# Intentionally a no-op: dh_auto_clean would call the top-level
|
|
# Makefile's `clean` target, which wipes build/ wholesale — and
|
|
# that includes build/nginx-asan/ from a prior `make build-asan`.
|
|
# Users who want a fresh reset run `make clean` at the top level.
|
|
|
|
override_dh_clean:
|
|
# `dh_clean` recurses from the package root to remove junk files
|
|
# (editor backups, autom4te caches, etc.). Two obstacles under
|
|
# build/:
|
|
# 1. `make build-asan` produces build/nginx-asan/{fastcgi,proxy,
|
|
# scgi,uwsgi,client_body}_temp owned by "nobody" with mode
|
|
# 0700 after the ASan nginx has been run (the 02-asan robot
|
|
# suite bind-mounts build/nginx-asan/ RW into a container,
|
|
# and nginx chowns its temp dirs on master startup). The
|
|
# current user can't traverse them, which makes dh_clean's
|
|
# `find` abort with EACCES.
|
|
# 2. We don't want to delete anything under build/ anyway — it
|
|
# holds the ASan build artifacts from a prior `make build-asan`.
|
|
# Clear the unreadable temp dirs first (rm -rf only needs write
|
|
# access to the parent, which we have), then tell dh_clean to
|
|
# exclude build/ entirely.
|
|
rm -rf $(CURDIR)/build/nginx-asan/client_body_temp \
|
|
$(CURDIR)/build/nginx-asan/fastcgi_temp \
|
|
$(CURDIR)/build/nginx-asan/proxy_temp \
|
|
$(CURDIR)/build/nginx-asan/scgi_temp \
|
|
$(CURDIR)/build/nginx-asan/uwsgi_temp
|
|
dh_clean -X build/
|