aboutsummaryrefslogtreecommitdiffstats
path: root/Mk
diff options
context:
space:
mode:
authortobik <tobik@FreeBSD.org>2018-09-04 15:26:02 +0800
committertobik <tobik@FreeBSD.org>2018-09-04 15:26:02 +0800
commitfc7bb78d16f70f832c41b34b3990f2bff22acb24 (patch)
treefb8fb5fa32df0cff561b161aa711966271622bd4 /Mk
parentf6d126f9246d4c2900e53aaee72f50ef61adfe17 (diff)
downloadfreebsd-ports-gnome-fc7bb78d16f70f832c41b34b3990f2bff22acb24.tar.gz
freebsd-ports-gnome-fc7bb78d16f70f832c41b34b3990f2bff22acb24.tar.zst
freebsd-ports-gnome-fc7bb78d16f70f832c41b34b3990f2bff22acb24.zip
Mk/Uses/cargo.mk: Let 'cargo-crates' generate Cargo.lock if it does not exist
This will make maintaining ports easier when upstream does not provide a Cargo.lock on its own. It uses the crate registry and will output the newest crate versions available based on the restrictions in Cargo.toml. As such subsequent runs of `make cargo-crates` might not generate the same output. Upstream should still be encouraged to provide Cargo.lock if possible. Requested by: mat Differential Revision: https://reviews.freebsd.org/D17003
Diffstat (limited to 'Mk')
-rw-r--r--Mk/Uses/cargo.mk9
1 files changed, 8 insertions, 1 deletions
diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index 3969dd7cb0e5..30da95f02df6 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -253,8 +253,15 @@ do-test:
# Helper targets for port maintainers
#
-# cargo-crates will output the crates list from Cargo.lock.
+# cargo-crates will output the crates list from Cargo.lock. If there
+# is no Cargo.lock for some reason, try and generate it first.
cargo-crates: extract
+ @if [ ! -r "${CARGO_CARGOLOCK}" ]; then \
+ ${ECHO_MSG} "===> ${CARGO_CARGOLOCK} not found. Trying to generate it..."; \
+ ${CARGO_CARGO_RUN} generate-lockfile \
+ --manifest-path ${CARGO_CARGOTOML} \
+ --verbose; \
+ fi
@${SETENV} USE_GITHUB=${USE_GITHUB} \
${AWK} -f ${SCRIPTSDIR}/cargo-crates.awk ${CARGO_CARGOLOCK}