Skip to content

Commit bd5c944

Browse files
committed
Added attestation targets
1 parent 6a62f91 commit bd5c944

File tree

4 files changed

+32
-7
lines changed

4 files changed

+32
-7
lines changed

alpine/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ BASE_CONFIGURE_ARGS+=\
109109
--with-stream_proxy_protocol_vendor_module
110110
endif
111111

112+
include $(CONTRIB)/attestation.mak
113+
112114
export CR=\\n
113115

114116
modname = $(shell echo $1 | tr '-' '_')
@@ -145,7 +147,7 @@ modules: base $(addprefix module-, $(MODULES))
145147

146148
abuild: abuild-base $(addprefix abuild-module-, $(MODULES))
147149

148-
base: ${HOME}/.abuild/abuild.conf | abuild-base
150+
base: ${HOME}/.abuild/abuild.conf | abuild-base attest-base
149151
@echo "===> Building base package" ; \
150152
/usr/bin/time -p $(SHELL) -c "cd abuild-base/ && abuild checksum && abuild unpack && abuild prepare && abuild -K build && abuild rootpkg" && \
151153
ln -s abuild-base/pkg/nginx$(BASE_SUFFIX)/usr/sbin base && \
@@ -184,7 +186,7 @@ abuild-base: $(BASE_SRC)
184186
> abuild-base/APKBUILD ; \
185187
}
186188

187-
module-%: ${HOME}/.abuild/abuild.conf | abuild-module-%
189+
module-%: ${HOME}/.abuild/abuild.conf | abuild-module-% attest-module-%
188190
@echo "===> Building nginx$(MODULE_SUFFIX)-$@ package"
189191
@/usr/bin/time -p $(SHELL) -c "cd abuild-$@/ && abuild checksum && abuild unpack && abuild prepare && abuild -K build && abuild rootpkg" && \
190192
ln -s abuild-$@/pkg/nginx$(MODULE_SUFFIX)-module-$*/usr/lib/nginx/modules $@
@@ -372,7 +374,7 @@ check-modules:
372374
}
373375

374376
clean:
375-
@rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests .deps-module-*
377+
@rm -rf base abuild-base abuild-module-* module-* $(BASE_SRC) nginx-tests .deps-module-* attest-base attest-module-*
376378

377379
.PHONY: default all modules abuild test test-debug check-modules clean
378380

contrib/attestation.mak

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

rpm/SPECS/Makefile

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

116+
include $(CONTRIB)/attestation.mak
117+
116118
export CR=\\n
117119

118120
modname = $(shell echo $1 | tr '-' '_')
@@ -145,7 +147,7 @@ $(SRCPATH)/$(BASE_SRC):
145147
cd $(CONTRIB) && make .sum-nginx$(BASE_SUFFIX)
146148
cd $(SRCPATH) && ln -s $(CONTRIB)/tarballs/$(BASE_SRC) $(BASE_SRC)
147149

148-
base: nginx.spec $(SRCPATH)/$(BASE_SRC)
150+
base: nginx.spec $(SRCPATH)/$(BASE_SRC) attest-base
149151
@echo "===> Building base package" ; \
150152
BUILDROOT=`rpmbuild -bc --short-circuit -D "_topdir \`pwd\`/../" -D "__spec_build_pre echo bdir=%{_builddir}; exit 0" nginx$(BASE_SUFFIX).spec | grep ^bdir= | cut -d'=' -f 2` ; \
151153
$(SHELL) -c "time -p rpmbuild --noclean -D \"_topdir `pwd`/../\" -ba nginx$(BASE_SUFFIX).spec" && \
@@ -195,7 +197,7 @@ endif
195197
fi; \
196198
touch $@
197199

198-
module-%: nginx-module-%.spec check-compat-% $(SRCPATH)/$(BASE_SRC) .deps-module-%
200+
module-%: nginx-module-%.spec check-compat-% $(SRCPATH)/$(BASE_SRC) .deps-module-% attest-module-%
199201
@if [ -e nginx-$@.skip ]; then \
200202
echo "---> Skipping nginx-$@ package (`cat nginx-$@.skip`)" ; \
201203
else \
@@ -447,6 +449,7 @@ clean:
447449
@rm -f $(BASE_SRC) $(SRCPATH)/$(BASE_SRC)
448450
@rm -f nginx.rpm-changelog nginx-*.rpm-changelog nginx-module-*.rpm-changelog
449451
@rm -f .deps-module-*
452+
@rm -f attest-base attest-module-*
450453
@find $(SRCPATH)/ -type l -delete
451454

452455
.PHONY: default list list-base list-all-modules list-base-modules all modules specs test test-debug clean

0 commit comments

Comments
 (0)