From 30ccaa4db6396c7a42d21fa24adbf31d9adbdb2e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 4 Jul 2018 19:13:25 +0000 Subject: [PATCH] build-sys: Use --frozen if Rust library was already built The main rationale here is avoiding any Cargo internet access during `sudo make install` type flows. Closes: #1444 Approved by: jlebon --- Makefile-rpm-ostree.am | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Makefile-rpm-ostree.am b/Makefile-rpm-ostree.am index 8a6649fb..be2c226d 100644 --- a/Makefile-rpm-ostree.am +++ b/Makefile-rpm-ostree.am @@ -88,11 +88,16 @@ endif if ENABLE_RUST librpmostree_rust_path = @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@/librpmostree_rust.a +# If the target directory exists, use --frozen; we don't +# want to (by default) touch the Internet during builds here. +# One reason is that we want to support `make && sudo make install`, +# and we don't want to do `sudo cargo` there. LIBRPMOSTREE_RUST_SRCS = $(wildcard rust/src/*.rs) $(librpmostree_rust_path): Makefile $(LIBRPMOSTREE_RUST_SRCS) cd $(top_srcdir)/rust && \ - CARGO_TARGET_DIR=@abs_top_builddir@/target \ - $(cargo) build --verbose $(CARGO_RELEASE_ARGS) + export CARGO_TARGET_DIR=@abs_top_builddir@/target && \ + if test -d @abs_top_builddir@/target/@RUST_TARGET_SUBDIR@; then frozen=--frozen; fi && \ + $(cargo) build --verbose $${frozen} $(CARGO_RELEASE_ARGS) EXTRA_DIST += $(LIBRPMOSTREE_RUST_SRCS) rust/Cargo.lock rpm_ostree_CFLAGS += -Irust/include