From 4ed0a556aedbf4a63429b72401f5ebffd79c0e53 Mon Sep 17 00:00:00 2001 From: Ojus Chugh Date: Sat, 28 Feb 2026 16:28:50 +0530 Subject: [PATCH] respect REPO_OFFLINE when building the cookbook tool REPO_OFFLINE=1 was already passing --offline to recipe cargo builds but the cargo build for the repo binary itself was still hitting crates.io. This fixes that and adds a cargo-fetch target to pre-populate the cache while online. --- mk/fstools.mk | 7 ++++++- mk/repo.mk | 8 ++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mk/fstools.mk b/mk/fstools.mk index 004b4c3c..052368cd 100644 --- a/mk/fstools.mk +++ b/mk/fstools.mk @@ -35,11 +35,16 @@ else $(REPO_BIN) fetch installer redoxfs endif +CARGO_OFFLINE_FLAG= +ifeq ($(REPO_OFFLINE),1) +CARGO_OFFLINE_FLAG=--offline +endif + $(FSTOOLS_TAG): $(CONTAINER_TAG) ifeq ($(PODMAN_BUILD),1) $(PODMAN_RUN) make $@ else - $(HOST_CARGO) build --manifest-path Cargo.toml --release --locked + $(HOST_CARGO) build --manifest-path Cargo.toml --release --locked $(CARGO_OFFLINE_FLAG) mkdir -p $(@D) touch $@ endif diff --git a/mk/repo.mk b/mk/repo.mk index 4b871ccb..fe7ac558 100644 --- a/mk/repo.mk +++ b/mk/repo.mk @@ -39,6 +39,14 @@ else $(REPO_BIN) fetch $(COOKBOOK_OPTS) --with-package-deps endif +# Fetch Cargo dependencies for the cookbook tool (needed for REPO_OFFLINE=1 builds) +cargo-fetch: FORCE +ifeq ($(PODMAN_BUILD),1) + $(PODMAN_RUN) make $@ +else + $(HOST_CARGO) fetch --manifest-path Cargo.toml --locked +endif + # Find recipe for one or more targets separated by comma find.%: $(FSTOOLS_TAG) FORCE ifeq ($(PODMAN_BUILD),1)