From 7cd49077198ab826774e5ae57d3d3bfce3c5ece1 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Thu, 24 Jul 2025 10:42:04 +0800 Subject: [PATCH 1/2] Makefile: Copy locales _after_ build When creating the `target` directory, `cargo` also creates `target/CACHEDIR.TAG` which is important for backup tools to know to ignore the directory. This doesn't happen if something else creates the `target` directory (e.g. `locales` Makefile target). Swap the execution order to fix this. --- GNUmakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 9cc210004..e80d3aa7a 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -320,10 +320,10 @@ else endif endif -build-coreutils: locales +build-coreutils: ${CARGO} build ${CARGOFLAGS} --features "${EXES} $(BUILD_SPEC_FEATURE)" ${PROFILE_CMD} --no-default-features -build: build-coreutils build-pkgs +build: build-coreutils build-pkgs locales $(foreach test,$(filter-out $(SKIP_UTILS),$(PROGS)),$(eval $(call TEST_BUSYBOX,$(test)))) From f327174539d7676988cbfab1ebd1377d206929a9 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Thu, 24 Jul 2025 10:59:28 +0800 Subject: [PATCH 2/2] .github/workflows: Check that target/CACHEDIR.TAG is created There was a small bug in `Makefile` that caused the `target` directory to be created by `install`, not `cargo`, which lead to a missing `target/CACHEDIR.TAG`. Test for that in CI, so that the issue does not recur. --- .github/workflows/CICD.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CICD.yml b/.github/workflows/CICD.yml index a07163d24..35fcee173 100644 --- a/.github/workflows/CICD.yml +++ b/.github/workflows/CICD.yml @@ -1,6 +1,6 @@ name: CICD -# spell-checker:ignore (abbrev/names) CICD CodeCOV MacOS MinGW MSVC musl taiki +# spell-checker:ignore (abbrev/names) CACHEDIR CICD CodeCOV MacOS MinGW MSVC musl taiki # spell-checker:ignore (env/flags) Awarnings Ccodegen Coverflow Cpanic Dwarnings RUSTDOCFLAGS RUSTFLAGS Zpanic CARGOFLAGS # spell-checker:ignore (jargon) SHAs deps dequote softprops subshell toolchain fuzzers dedupe devel profdata # spell-checker:ignore (people) Peltoche rivy dtolnay Anson dawidd @@ -278,9 +278,21 @@ jobs: - name: Run sccache-cache uses: mozilla-actions/sccache-action@v0.0.9 - name: "`make build`" + # Also check that target/CACHEDIR.TAG is created on a fresh checkout shell: bash run: | + set -x + # Target directory must not exist to start with, otherwise cargo + # will not create target/CACHEDIR.TAG. + if [[ -d target ]]; then + mv -T target target.cache + fi + # Actually do the build make build + echo "Check that target directory will be ignored by backup tools" + test -f target/CACHEDIR.TAG + # Restore cache for target/release (we only did a debug build) + mv -t target/ target.cache/release 2>/dev/null || true - name: "`make nextest`" shell: bash run: make nextest CARGOFLAGS="--profile ci --hide-progress-bar" @@ -289,6 +301,7 @@ jobs: - name: "`make install COMPLETIONS=n MANPAGES=n`" shell: bash run: | + set -x DESTDIR=/tmp/ make PROFILE=release COMPLETIONS=n MANPAGES=n install # Check that the utils are present test -f /tmp/usr/local/bin/tty @@ -303,6 +316,7 @@ jobs: - name: "`make install`" shell: bash run: | + set -x DESTDIR=/tmp/ make PROFILE=release install # Check that the utils are present test -f /tmp/usr/local/bin/tty @@ -317,6 +331,7 @@ jobs: - name: "`make uninstall`" shell: bash run: | + set -x DESTDIR=/tmp/ make uninstall # Check that the utils are not present ! test -f /tmp/usr/local/bin/tty