From 46c8dd210b7cf1fbff28f223329e5a8f2ce58135 Mon Sep 17 00:00:00 2001 From: nandi Date: Tue, 28 Jul 2026 23:17:40 -0700 Subject: [PATCH] Fix Spindle APK build: drop find(1) for NDK extract. Hosted nixery images lacked findutils; NDK install failed after download. Use bash globs and add findutils to the workflow deps as belt-and-suspenders. --- .tangled/workflows/android-apk.yml | 1 + scripts/ci-build-apk.sh | 14 +++++++++++--- test/ci_apk_workflow_test.sh | 3 +++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/.tangled/workflows/android-apk.yml b/.tangled/workflows/android-apk.yml index 951cede..aa5ed24 100644 --- a/.tangled/workflows/android-apk.yml +++ b/.tangled/workflows/android-apk.yml @@ -22,6 +22,7 @@ dependencies: nixpkgs: - bash - coreutils + - findutils - curl - gnutar - gzip diff --git a/scripts/ci-build-apk.sh b/scripts/ci-build-apk.sh index 9187977..ea80e19 100755 --- a/scripts/ci-build-apk.sh +++ b/scripts/ci-build-apk.sh @@ -77,9 +77,17 @@ ensure_ndk() { local extract_dir extract_dir="$(mktemp -d)" unzip -q "$zip" -d "$extract_dir" - local found - found="$(find "$extract_dir" -maxdepth 1 -type d -name 'android-ndk-*' | head -1)" - [[ -n "$found" ]] || { log "NDK extract failed"; exit 1; } + # Prefer bash glob over find(1) — Spindle nixery images may omit findutils. + local found="" d + shopt -s nullglob + for d in "$extract_dir"/android-ndk-*; do + if [[ -d "$d" ]]; then + found="$d" + break + fi + done + shopt -u nullglob + [[ -n "$found" ]] || { log "NDK extract failed under $extract_dir"; exit 1; } rm -rf "$ANDROID_NDK_HOME" mv "$found" "$ANDROID_NDK_HOME" rm -rf "$extract_dir" diff --git a/test/ci_apk_workflow_test.sh b/test/ci_apk_workflow_test.sh index 8150686..bf5b104 100755 --- a/test/ci_apk_workflow_test.sh +++ b/test/ci_apk_workflow_test.sh @@ -34,6 +34,9 @@ check "workflow mentions APK path" grep -q 'global-dist-ui.apk' "$WF" check "script emits APK_REL path" grep -q 'dist-ui/target/debug/apk/global-dist-ui.apk' "$SCRIPT" check "script checks ZIP magic" grep -q '504b' "$SCRIPT" check "script tolerates cargo-apk panic" grep -q 'cargo apk build' "$SCRIPT" +# Spindle nixery may omit findutils; NDK extract must not require bare find(1). +check "script NDK extract avoids find(1)" bash -c "! grep -E '(^|[^[:alnum:]_])find ' '$SCRIPT'" +check "workflow includes findutils (belt)" grep -q 'findutils' "$WF" # If APK present (after a real build), validate it is a non-empty APK/ZIP. if [[ -f "$APK_REL" ]]; then -- 2.51.2