svn commit: r478931 - head/Mk/Uses

Tobias Kortkamp tobik at FreeBSD.org
Tue Sep 4 07:26:03 UTC 2018


Author: tobik
Date: Tue Sep  4 07:26:02 2018
New Revision: 478931
URL: https://svnweb.freebsd.org/changeset/ports/478931

Log:
  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

Modified:
  head/Mk/Uses/cargo.mk

Modified: head/Mk/Uses/cargo.mk
==============================================================================
--- head/Mk/Uses/cargo.mk	Tue Sep  4 06:54:09 2018	(r478930)
+++ head/Mk/Uses/cargo.mk	Tue Sep  4 07:26:02 2018	(r478931)
@@ -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}
 


More information about the svn-ports-head mailing list