Skip to content

Commit f0fc31f

Browse files
committed
Use packaging sources to build packages on non-mainstream architectures.
1 parent 479f90a commit f0fc31f

File tree

10 files changed

+275
-83
lines changed

10 files changed

+275
-83
lines changed

Dockerfile-debian-otel.template

+30-8
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,46 @@ RUN set -x; \
1515
;; \
1616
*) \
1717
# we're on an architecture upstream doesn't officially build for
18-
# let's build binaries from the published source packages
19-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
20-
\
18+
# let's build binaries from the published packaging sources
2119
# new directory for storing sources and .deb files
22-
&& tempDir="$(mktemp -d)" \
20+
tempDir="$(mktemp -d)" \
2321
&& chmod 777 "$tempDir" \
2422
# (777 to ensure APT's "_apt" user can access it too)
2523
\
2624
# save list of currently-installed packages so build dependencies can be cleanly removed later
2725
&& savedAptMark="$(apt-mark showmanual)" \
2826
\
29-
# build .deb files from upstream's source packages (which are verified by apt-get)
27+
# build .deb files from upstream's packaging sources
3028
&& apt-get update \
31-
&& apt-get build-dep -y %%BUILDTARGET%% \
29+
&& apt-get install --no-install-recommends --no-install-suggests -y \
30+
curl \
31+
devscripts \
32+
equivs \
33+
git \
34+
libxml2-utils \
35+
lsb-release \
36+
xsltproc \
3237
&& ( \
3338
cd "$tempDir" \
34-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
35-
apt-get source --compile %%BUILDTARGET%% \
39+
&& REVISION="%%REVISION%%" \
40+
&& REVISION=${REVISION%~*} \
41+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
42+
&& PKGOSSCHECKSUM="%%PKGOSSCHECKSUM%% *${REVISION}.tar.gz" \
43+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
44+
echo "pkg-oss tarball checksum verification succeeded!"; \
45+
else \
46+
echo "pkg-oss tarball checksum verification failed!"; \
47+
exit 1; \
48+
fi \
49+
&& tar xzvf ${REVISION}.tar.gz \
50+
&& cd pkg-oss-${REVISION} \
51+
&& cd debian \
52+
&& for target in %%BUILDTARGET%%; do \
53+
make rules-$target; \
54+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
55+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
56+
done \
57+
&& make %%BUILDTARGET%% \
3658
) \
3759
# we don't remove APT lists here because they get re-downloaded and removed later
3860
\

Dockerfile-debian-perl.template

+30-8
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,46 @@ RUN set -x; \
1313
;; \
1414
*) \
1515
# we're on an architecture upstream doesn't officially build for
16-
# let's build binaries from the published source packages
17-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
18-
\
16+
# let's build binaries from the published packaging sources
1917
# new directory for storing sources and .deb files
20-
&& tempDir="$(mktemp -d)" \
18+
tempDir="$(mktemp -d)" \
2119
&& chmod 777 "$tempDir" \
2220
# (777 to ensure APT's "_apt" user can access it too)
2321
\
2422
# save list of currently-installed packages so build dependencies can be cleanly removed later
2523
&& savedAptMark="$(apt-mark showmanual)" \
2624
\
27-
# build .deb files from upstream's source packages (which are verified by apt-get)
25+
# build .deb files from upstream's packaging sources
2826
&& apt-get update \
29-
&& apt-get build-dep -y %%BUILDTARGET%% \
27+
&& apt-get install --no-install-recommends --no-install-suggests -y \
28+
curl \
29+
devscripts \
30+
equivs \
31+
git \
32+
libxml2-utils \
33+
lsb-release \
34+
xsltproc \
3035
&& ( \
3136
cd "$tempDir" \
32-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
33-
apt-get source --compile %%BUILDTARGET%% \
37+
&& REVISION="%%REVISION%%" \
38+
&& REVISION=${REVISION%~*} \
39+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
40+
&& PKGOSSCHECKSUM="%%PKGOSSCHECKSUM%% *${REVISION}.tar.gz" \
41+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
42+
echo "pkg-oss tarball checksum verification succeeded!"; \
43+
else \
44+
echo "pkg-oss tarball checksum verification failed!"; \
45+
exit 1; \
46+
fi \
47+
&& tar xzvf ${REVISION}.tar.gz \
48+
&& cd pkg-oss-${REVISION} \
49+
&& cd debian \
50+
&& for target in %%BUILDTARGET%%; do \
51+
make rules-$target; \
52+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
53+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
54+
done \
55+
&& make %%BUILDTARGET%% \
3456
) \
3557
# we don't remove APT lists here because they get re-downloaded and removed later
3658
\

Dockerfile-debian.template

+30-8
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,46 @@ RUN set -x \
4343
;; \
4444
*) \
4545
# we're on an architecture upstream doesn't officially build for
46-
# let's build binaries from the published source packages
47-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] %%PACKAGEREPO%% %%DEBIAN_VERSION%% nginx" >> /etc/apt/sources.list.d/nginx.list \
48-
\
46+
# let's build binaries from the published packaging sources
4947
# new directory for storing sources and .deb files
50-
&& tempDir="$(mktemp -d)" \
48+
tempDir="$(mktemp -d)" \
5149
&& chmod 777 "$tempDir" \
5250
# (777 to ensure APT's "_apt" user can access it too)
5351
\
5452
# save list of currently-installed packages so build dependencies can be cleanly removed later
5553
&& savedAptMark="$(apt-mark showmanual)" \
5654
\
57-
# build .deb files from upstream's source packages (which are verified by apt-get)
55+
# build .deb files from upstream's packaging sources
5856
&& apt-get update \
59-
&& apt-get build-dep -y %%BUILDTARGET%% \
57+
&& apt-get install --no-install-recommends --no-install-suggests -y \
58+
curl \
59+
devscripts \
60+
equivs \
61+
git \
62+
libxml2-utils \
63+
lsb-release \
64+
xsltproc \
6065
&& ( \
6166
cd "$tempDir" \
62-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
63-
apt-get source --compile %%BUILDTARGET%% \
67+
&& REVISION="%%REVISION%%" \
68+
&& REVISION=${REVISION%~*} \
69+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
70+
&& PKGOSSCHECKSUM="%%PKGOSSCHECKSUM%% *${REVISION}.tar.gz" \
71+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
72+
echo "pkg-oss tarball checksum verification succeeded!"; \
73+
else \
74+
echo "pkg-oss tarball checksum verification failed!"; \
75+
exit 1; \
76+
fi \
77+
&& tar xzvf ${REVISION}.tar.gz \
78+
&& cd pkg-oss-${REVISION} \
79+
&& cd debian \
80+
&& for target in %%BUILDTARGET%%; do \
81+
make rules-$target; \
82+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
83+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
84+
done \
85+
&& make %%BUILDTARGET%% \
6486
) \
6587
# we don't remove APT lists here because they get re-downloaded and removed later
6688
\

mainline/debian-otel/Dockerfile

+30-8
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,46 @@ RUN set -x; \
2626
;; \
2727
*) \
2828
# we're on an architecture upstream doesn't officially build for
29-
# let's build binaries from the published source packages
30-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bookworm nginx" >> /etc/apt/sources.list.d/nginx.list \
31-
\
29+
# let's build binaries from the published packaging sources
3230
# new directory for storing sources and .deb files
33-
&& tempDir="$(mktemp -d)" \
31+
tempDir="$(mktemp -d)" \
3432
&& chmod 777 "$tempDir" \
3533
# (777 to ensure APT's "_apt" user can access it too)
3634
\
3735
# save list of currently-installed packages so build dependencies can be cleanly removed later
3836
&& savedAptMark="$(apt-mark showmanual)" \
3937
\
40-
# build .deb files from upstream's source packages (which are verified by apt-get)
38+
# build .deb files from upstream's packaging sources
4139
&& apt-get update \
42-
&& apt-get build-dep -y nginx-module-otel \
40+
&& apt-get install --no-install-recommends --no-install-suggests -y \
41+
curl \
42+
devscripts \
43+
equivs \
44+
git \
45+
libxml2-utils \
46+
lsb-release \
47+
xsltproc \
4348
&& ( \
4449
cd "$tempDir" \
45-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
46-
apt-get source --compile nginx-module-otel \
50+
&& REVISION="${NGINX_VERSION}-${PKG_RELEASE}" \
51+
&& REVISION=${REVISION%~*} \
52+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
53+
&& PKGOSSCHECKSUM="b9fbdf1779186fc02aa59dd87597fe4e906892391614289a4e6eedba398a3e770347b5b07110cca8c11fa3ba85bb711626ae69832e74c69ca8340d040a465907 *${REVISION}.tar.gz" \
54+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
55+
echo "pkg-oss tarball checksum verification succeeded!"; \
56+
else \
57+
echo "pkg-oss tarball checksum verification failed!"; \
58+
exit 1; \
59+
fi \
60+
&& tar xzvf ${REVISION}.tar.gz \
61+
&& cd pkg-oss-${REVISION} \
62+
&& cd debian \
63+
&& for target in module-otel; do \
64+
make rules-$target; \
65+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
66+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
67+
done \
68+
&& make module-otel \
4769
) \
4870
# we don't remove APT lists here because they get re-downloaded and removed later
4971
\

mainline/debian-perl/Dockerfile

+30-8
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,46 @@ RUN set -x; \
2424
;; \
2525
*) \
2626
# we're on an architecture upstream doesn't officially build for
27-
# let's build binaries from the published source packages
28-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bookworm nginx" >> /etc/apt/sources.list.d/nginx.list \
29-
\
27+
# let's build binaries from the published packaging sources
3028
# new directory for storing sources and .deb files
31-
&& tempDir="$(mktemp -d)" \
29+
tempDir="$(mktemp -d)" \
3230
&& chmod 777 "$tempDir" \
3331
# (777 to ensure APT's "_apt" user can access it too)
3432
\
3533
# save list of currently-installed packages so build dependencies can be cleanly removed later
3634
&& savedAptMark="$(apt-mark showmanual)" \
3735
\
38-
# build .deb files from upstream's source packages (which are verified by apt-get)
36+
# build .deb files from upstream's packaging sources
3937
&& apt-get update \
40-
&& apt-get build-dep -y nginx-module-perl=${NGINX_VERSION}-${DYNPKG_RELEASE} \
38+
&& apt-get install --no-install-recommends --no-install-suggests -y \
39+
curl \
40+
devscripts \
41+
equivs \
42+
git \
43+
libxml2-utils \
44+
lsb-release \
45+
xsltproc \
4146
&& ( \
4247
cd "$tempDir" \
43-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
44-
apt-get source --compile nginx-module-perl=${NGINX_VERSION}-${DYNPKG_RELEASE} \
48+
&& REVISION="${NGINX_VERSION}-${PKG_RELEASE}" \
49+
&& REVISION=${REVISION%~*} \
50+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
51+
&& PKGOSSCHECKSUM="b9fbdf1779186fc02aa59dd87597fe4e906892391614289a4e6eedba398a3e770347b5b07110cca8c11fa3ba85bb711626ae69832e74c69ca8340d040a465907 *${REVISION}.tar.gz" \
52+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
53+
echo "pkg-oss tarball checksum verification succeeded!"; \
54+
else \
55+
echo "pkg-oss tarball checksum verification failed!"; \
56+
exit 1; \
57+
fi \
58+
&& tar xzvf ${REVISION}.tar.gz \
59+
&& cd pkg-oss-${REVISION} \
60+
&& cd debian \
61+
&& for target in module-perl; do \
62+
make rules-$target; \
63+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
64+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
65+
done \
66+
&& make module-perl \
4567
) \
4668
# we don't remove APT lists here because they get re-downloaded and removed later
4769
\

mainline/debian/Dockerfile

+30-8
Original file line numberDiff line numberDiff line change
@@ -53,24 +53,46 @@ RUN set -x \
5353
;; \
5454
*) \
5555
# we're on an architecture upstream doesn't officially build for
56-
# let's build binaries from the published source packages
57-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/mainline/debian/ bookworm nginx" >> /etc/apt/sources.list.d/nginx.list \
58-
\
56+
# let's build binaries from the published packaging sources
5957
# new directory for storing sources and .deb files
60-
&& tempDir="$(mktemp -d)" \
58+
tempDir="$(mktemp -d)" \
6159
&& chmod 777 "$tempDir" \
6260
# (777 to ensure APT's "_apt" user can access it too)
6361
\
6462
# save list of currently-installed packages so build dependencies can be cleanly removed later
6563
&& savedAptMark="$(apt-mark showmanual)" \
6664
\
67-
# build .deb files from upstream's source packages (which are verified by apt-get)
65+
# build .deb files from upstream's packaging sources
6866
&& apt-get update \
69-
&& apt-get build-dep -y $nginxPackages \
67+
&& apt-get install --no-install-recommends --no-install-suggests -y \
68+
curl \
69+
devscripts \
70+
equivs \
71+
git \
72+
libxml2-utils \
73+
lsb-release \
74+
xsltproc \
7075
&& ( \
7176
cd "$tempDir" \
72-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
73-
apt-get source --compile $nginxPackages \
77+
&& REVISION="${NGINX_VERSION}-${PKG_RELEASE}" \
78+
&& REVISION=${REVISION%~*} \
79+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
80+
&& PKGOSSCHECKSUM="b9fbdf1779186fc02aa59dd87597fe4e906892391614289a4e6eedba398a3e770347b5b07110cca8c11fa3ba85bb711626ae69832e74c69ca8340d040a465907 *${REVISION}.tar.gz" \
81+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
82+
echo "pkg-oss tarball checksum verification succeeded!"; \
83+
else \
84+
echo "pkg-oss tarball checksum verification failed!"; \
85+
exit 1; \
86+
fi \
87+
&& tar xzvf ${REVISION}.tar.gz \
88+
&& cd pkg-oss-${REVISION} \
89+
&& cd debian \
90+
&& for target in base module-geoip module-image-filter module-njs module-xslt; do \
91+
make rules-$target; \
92+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
93+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
94+
done \
95+
&& make base module-geoip module-image-filter module-njs module-xslt \
7496
) \
7597
# we don't remove APT lists here because they get re-downloaded and removed later
7698
\

stable/debian-otel/Dockerfile

+30-8
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,46 @@ RUN set -x; \
2626
;; \
2727
*) \
2828
# we're on an architecture upstream doesn't officially build for
29-
# let's build binaries from the published source packages
30-
echo "deb-src [signed-by=$NGINX_GPGKEY_PATH] https://nginx.org/packages/debian/ bookworm nginx" >> /etc/apt/sources.list.d/nginx.list \
31-
\
29+
# let's build binaries from the published packaging sources
3230
# new directory for storing sources and .deb files
33-
&& tempDir="$(mktemp -d)" \
31+
tempDir="$(mktemp -d)" \
3432
&& chmod 777 "$tempDir" \
3533
# (777 to ensure APT's "_apt" user can access it too)
3634
\
3735
# save list of currently-installed packages so build dependencies can be cleanly removed later
3836
&& savedAptMark="$(apt-mark showmanual)" \
3937
\
40-
# build .deb files from upstream's source packages (which are verified by apt-get)
38+
# build .deb files from upstream's packaging sources
4139
&& apt-get update \
42-
&& apt-get build-dep -y nginx-module-otel \
40+
&& apt-get install --no-install-recommends --no-install-suggests -y \
41+
curl \
42+
devscripts \
43+
equivs \
44+
git \
45+
libxml2-utils \
46+
lsb-release \
47+
xsltproc \
4348
&& ( \
4449
cd "$tempDir" \
45-
&& DEB_BUILD_OPTIONS="nocheck parallel=$(nproc)" \
46-
apt-get source --compile nginx-module-otel \
50+
&& REVISION="${NGINX_VERSION}-${PKG_RELEASE}" \
51+
&& REVISION=${REVISION%~*} \
52+
&& curl -f -O https://hg.nginx.org/pkg-oss/archive/${REVISION}.tar.gz \
53+
&& PKGOSSCHECKSUM="825f610c44dfb97166112e6d060c0ba209a74f50e42c7c23a5b8742f468596f110bb1b4ca9299547a8a3d41f3a7caa864622f40f6c7bb4d8bab3d24880bdfb6a *${REVISION}.tar.gz" \
54+
&& if [ "$(openssl sha512 -r ${REVISION}.tar.gz)" = "$PKGOSSCHECKSUM" ]; then \
55+
echo "pkg-oss tarball checksum verification succeeded!"; \
56+
else \
57+
echo "pkg-oss tarball checksum verification failed!"; \
58+
exit 1; \
59+
fi \
60+
&& tar xzvf ${REVISION}.tar.gz \
61+
&& cd pkg-oss-${REVISION} \
62+
&& cd debian \
63+
&& for target in module-otel; do \
64+
make rules-$target; \
65+
mk-build-deps --install --tool="apt-get -o Debug::pkgProblemResolver=yes --no-install-recommends --yes" \
66+
debuild-$target/nginx-$NGINX_VERSION/debian/control; \
67+
done \
68+
&& make module-otel \
4769
) \
4870
# we don't remove APT lists here because they get re-downloaded and removed later
4971
\

0 commit comments

Comments
 (0)