]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
dnsdist: Fix release builds by updating the locked Rust lib version 16180/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 25 Sep 2025 13:14:40 +0000 (15:14 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 25 Sep 2025 14:40:17 +0000 (16:40 +0200)
Since we are now dynamically setting the version of our internal Rust library
when generating the release tarball, `cargo` needs to update the `Cargo.lock`
file to reflect the new version, which is not possible if we are passing `--locked`:
```
error: the lock file /pdns/dnsdist-2.1.0-alpha0.870.master.gc64b979bc/dnsdist-rust-lib/rust/Cargo.lock needs to be updated but --locked was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --locked flag and use --offline instead.
```
This commit fixes that also updating the `Cargo.lock` file when generating the
release tarball so that `cargo` no longer needs to update the `Cargo.lock`.

Signed-off-by: Remi Gacogne <remi.gacogne@powerdns.com>
builder-support/dockerfiles/Dockerfile.dnsdist
pdns/dnsdistdist/meson-dist-script.sh

index 0c39b90afb9e67dc90c9b3d11e72b29233a2b872..1cd47e27800df303e44ec4915341568021b07f76 100644 (file)
@@ -2,7 +2,8 @@ FROM alpine:3.21 AS dnsdist
 ARG BUILDER_CACHE_BUSTER=
 
 RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
-                       libtool file boost-dev ragel python3 py3-yaml git libedit-dev bash meson
+                       libtool file boost-dev ragel python3 py3-yaml git libedit-dev \
+                       bash meson cargo
 
 COPY . /dnsdist/
 WORKDIR /dnsdist/
index 7e264171e9185cc5495ab91055ac4af9679aa663..7e5857c480f54460d71815813ebb191503d569f5 100755 (executable)
@@ -30,8 +30,6 @@ echo Running autoreconf -vi so distfile is still usable for autotools building
 # Run autoconf for people using autotools to build, this creates a configure sc
 autoreconf -vi
 rm -rf "$MESON_PROJECT_DIST_ROOT"/autom4te.cache
-echo Updating the version of the Rust library to ${BUILDER_VERSION}
-"$MESON_SOURCE_ROOT"/../../builder-support/helpers/update-rust-library-version.py "$MESON_PROJECT_DIST_ROOT"/dnsdist-rust-lib/rust/Cargo.toml dnsdist-rust ${BUILDER_VERSION}
 
 cd "$MESON_PROJECT_BUILD_ROOT"
 
@@ -53,6 +51,16 @@ meson compile rust-lib-sources
 cp -vp dnsdist-rust-lib/*.cc dnsdist-rust-lib/*.hh "$MESON_PROJECT_DIST_ROOT"/dnsdist-rust-lib/
 cp -vp "$MESON_SOURCE_ROOT"/dnsdist-rust-lib/rust/src/lib.rs "$MESON_PROJECT_DIST_ROOT"/dnsdist-rust-lib/rust/src/
 
+echo Updating the version of the Rust library to ${BUILDER_VERSION}
+"$MESON_SOURCE_ROOT"/../../builder-support/helpers/update-rust-library-version.py "$MESON_PROJECT_DIST_ROOT"/dnsdist-rust-lib/rust/Cargo.toml dnsdist-rust ${BUILDER_VERSION}
+# Update the version of the Rust library in Cargo.lock as well,
+# This needs to be done AFTER the sources of the Rust library have been generated
+# Unfortunately we cannot use --offline because for some reason cargo-update wants
+# to check all dependencies even though we are telling it exactly what to update
+cd "$MESON_PROJECT_DIST_ROOT"/dnsdist-rust-lib/rust/
+cargo update --verbose --precise ${BUILDER_VERSION} dnsdist-rust
+cd "$MESON_PROJECT_BUILD_ROOT"
+
 # Generate man pages
 meson compile man-pages
 cp -vp *.1 "$MESON_PROJECT_DIST_ROOT"