Files
RedBear-OS/mk/redbear.mk
T
vasilito c2f5bb09fc feat: build-system hardening (validate gate, cache safeguards, status sync)
Phase 1 remediation of the build-system assessment:

- Makefile: wire 'validate' target into build/live/reimage flows; surface
  lint-config and init-service validators as a first-class gate.
- mk/disk.mk: add 'validate' target running lint-config, init-service
  validator, and file-ownership validator; suppress noisy unmount warnings
  that masked real failures.
- mk/redbear.mk: add source-fingerprint tracking so integrate-redbear.sh
  re-runs when local/recipes, local/Assets, or local/firmware change.
- src/cook/cook_build.rs: atomic dep_hashes.toml write (tmp + rename) to
  prevent torn-write cache corruption; binary-store restore now checks
  dep_hashes before silent restore; fix production bug in
  collect_files_recursive that silently dropped subdirectories whose
  name matched an exclude pattern.
- src/cook/fetch.rs, src/cook/fetch_repo.rs: harden atomic patch
  application and protected-recipe gating.
- AGENTS.md, local/AGENTS.md, local/docs/COLLISION-DETECTION-STATUS.md:
  sync collision-detection status to 'implemented (Phase 15.0)' now that
  CollisionTracker is wired across all four installer layers
  (installer submodule pointer tracked separately in 13cc6fb0c3).

Verified: cargo check (0 errors), cargo test --lib (35/35 passed),
cargo clippy (0 new warnings vs baseline), make -n validate, make -n live.
2026-07-18 16:30:23 +09:00

51 lines
1.9 KiB
Makefile

# Red Bear OS integration — runs before repo cook and disk image creation
# Ensures all custom recipe symlinks, patches, assets, and firmware are staged.
REDBEAR_TAG=$(BUILD)/redbear.tag
REDBEAR_FP=$(REDBEAR_TAG).fp
REDBEAR_INPUTS = local/scripts/integrate-redbear.sh local/recipes local/Assets local/firmware
# FORCE is retained so Make evaluates this recipe on every build. The fingerprint
# check inside the recipe decides whether the expensive integration actually
# runs. Removing FORCE would break detection of newly-added files under
# local/recipes/ because Make's mtime model cannot track directory-tree growth.
$(REDBEAR_TAG): FORCE
ifeq ($(PODMAN_BUILD),1)
$(PODMAN_RUN) make $@
else
@current=$$(find $(REDBEAR_INPUTS) -type f -printf '%P %s %T@\n' 2>/dev/null | sort | sha256sum | cut -d' ' -f1); \
stored=""; \
if [ -f "$(REDBEAR_FP)" ]; then stored=$$(cat "$(REDBEAR_FP)" 2>/dev/null); fi; \
if [ "$$current" = "$$stored" ] && [ -f "$@" ]; then \
touch "$@"; \
else \
echo "Red Bear: integration inputs changed (or first run), executing integrate-redbear.sh..."; \
bash -c 'export REDBEAR_TAG="$$1"; exec bash local/scripts/integrate-redbear.sh' _ '$(REDBEAR_TAG)'; \
echo "$$current" > "$(REDBEAR_FP)"; \
fi
endif
redbear: $(REDBEAR_TAG)
redbear_clean:
rm -f "$(REDBEAR_TAG)" "$(REDBEAR_FP)"
# Source archival — exports fully-patched, versioned source archives
# for all recipes with source/ directories to sources/<target>/
# Runs after `make all` and also standalone via `make sources`
SOURCES_DIR=$(BUILD)/../sources/$(TARGET)
SOURCES_TAG=$(SOURCES_DIR)/.sources-tag
# Standalone: archive what's cached (no rebuild needed)
sources:
@echo "Archiving source packages..."
bash local/scripts/archive-sources.sh --all
@mkdir -p "$(SOURCES_DIR)"
@touch "$(SOURCES_TAG)"
@echo "Sources archived: $$(wc -l < $(SOURCES_DIR)/packages.txt 2>/dev/null || echo 0) packages"
# Hook: run after full build
$(BUILD)/harddrive.img: sources
FORCE: