Skip to content

Commit 6ee0d3a

Browse files
committed
debian: added attestation targets
1 parent ba3e889 commit 6ee0d3a

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

contrib/attestation.mak

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
define NEWLINE
2+
3+
4+
endef
5+
6+
toupper = $(shell echo $1 | tr '[:lower:]-' '[:upper:]_' )
7+
dep_v = $(shell echo $(call toupper,$1)_VERSION )
8+
dep_h = $(shell echo $(call toupper,$1)_GITHASH )
9+
dep_checksum = $(shell test -f "$(CONTRIB)/src/$1/SHA512SUMS" && \
10+
awk '( index($$2,"$($(call dep_v,$1))") > 1 || index($$2,"$($(call dep_h,$1))") > 1 ) {print $$1}' "$(CONTRIB)/src/$1/SHA512SUMS" )
11+
attest_version = $(shell test -n '$($(call dep_h,$1))' && echo $($(call dep_v,$1))-$($(call dep_h,$1)) || echo $($(call dep_v,$1)))
12+
13+
attest-module-%:
14+
@$(foreach dep,$(MODULE_CONTRIB_DEPS_$*),echo $(dep) $(call attest_version,$(dep)) $(call dep_checksum,$(dep)) >> attest-module-$* $(NEWLINE))
15+
16+
attest: attest-base $(addprefix attest-module-, $(MODULES))
17+
18+
attest-base:
19+
if [ "$(BASE_TARGET)" = "oss" ]; then \
20+
checksum=$$(grep "$(BASE_VERSION)" "$(CONTRIB)/src/nginx/SHA512SUMS" | cut -d' ' -f1) ; \
21+
printf "%s\s%s\s%s\n" "nginx" "$(BASE_VERSION)" "$$checksum" >> "$@"; \
22+
fi

debian/Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ BASE_CONFIGURE_ARGS+= \
111111
--with-stream_proxy_protocol_vendor_module
112112
endif
113113

114+
include $(CONTRIB)/attestation.mak
115+
114116
export CR=\\n
115117

116118
modname = $(shell echo $1 | tr '-' '_')
@@ -139,7 +141,7 @@ modules: $(addprefix module-, $(MODULES))
139141

140142
rules: rules-base $(addprefix rules-module-, $(MODULES))
141143

142-
base: rules-base
144+
base: rules-base attest-base
143145
@echo "===> Building base package" ; \
144146
$(SHELL) -c "cd debuild-base/$(SRCDIR) ; export DEB_BUILD_OPTIONS=parallel=$(NPROC) ; time -p debuild -us -uc" && \
145147
find debuild-base/ -maxdepth 1 -type f -exec cp {} ../../ \; && \
@@ -207,7 +209,7 @@ rules-base: $(BASE_SRC) nginx.deb-changelog
207209
ln -s debuild-base/$(SRCDIR)/debian/rules rules-base ; \
208210
}
209211

210-
module-%: rules-module-% check-compat-%
212+
module-%: rules-module-% check-compat-% attest-module-%
211213
@if [ -e nginx-$@.skip ]; then \
212214
echo "---> Skipping nginx-$@ package (`cat nginx-$@.skip`)" ; \
213215
else \
@@ -462,6 +464,7 @@ check-modules:
462464
clean:
463465
@rm -rf base module-* rules-base rules-module-* debuild-base debuild-module-* nginx-tests $(BASE_SRC) .deps-module-*
464466
@rm -f nginx.deb-changelog nginx-*.deb-changelog nginx-module-*.deb-changelog nginx-module-*.skip
467+
@rm -f attest-base attest-module-*
465468

466469
.PHONY: default list list-base list-all-modules list-base-modules all modules rules test test-debug check-modules clean
467470

0 commit comments

Comments
 (0)