Monorepo for Aesthetic.Computer aesthetic.computer
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

ac-os: parallel binary build + consistent version strings

- Add -j$(nproc) to binary make (was single-threaded on 8 cores)
- Freeze AC_GIT_HASH, AC_BUILD_TS, AC_BUILD_NAME once at script top
- All stages (build, initramfs, kernel, upload, record) use the same
frozen values — no more mismatches from HEAD moving mid-build

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+33 -38
+33 -38
fedac/native/ac-os
··· 15 15 16 16 CMD="${1:-build}" 17 17 18 + # Freeze version strings once — all stages use the same values 19 + export AC_GIT_HASH="${AC_GIT_HASH:-$(cd "${SCRIPT_DIR}" && git rev-parse --short HEAD 2>/dev/null || echo "unknown")}" 20 + export AC_BUILD_TS="${AC_BUILD_TS:-$(date -u '+%Y-%m-%dT%H:%M')}" 21 + export AC_BUILD_NAME="${AC_BUILD_NAME:-$(cd "${SCRIPT_DIR}" && bash scripts/build-name.sh 2>/dev/null || echo "unknown")}" 22 + 18 23 log() { echo -e "\033[0;36m[ac-os]\033[0m $*"; } 19 24 err() { echo -e "\033[0;31m[ac-os]\033[0m $*" >&2; } 20 25 ··· 40 45 CC_USE=gcc 41 46 fi 42 47 fi 43 - # Freeze git hash before make — HEAD may move if papers oven pushes mid-build 44 - local FROZEN_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") 45 - 46 - # Run make and capture exit code (pipefail not needed — check make directly) 48 + # Run make and capture exit code — version strings frozen at top of script 47 49 mkdir -p "${BUILD_DIR}" 48 50 local MAKE_LOG="${BUILD_DIR}/.make.log" 49 - make CC="${CC_USE}" BUILD_TS="${AC_BUILD_TS}" GIT_HASH="${FROZEN_HASH}" BUILD_NAME="${AC_BUILD_NAME}" > "${MAKE_LOG}" 2>&1 51 + make -j$(nproc) CC="${CC_USE}" BUILD_TS="${AC_BUILD_TS}" GIT_HASH="${AC_GIT_HASH}" BUILD_NAME="${AC_BUILD_NAME}" > "${MAKE_LOG}" 2>&1 50 52 local MAKE_RC=$? 51 53 grep -E "Built:|error:" "${MAKE_LOG}" || true 52 54 if [ ${MAKE_RC} -ne 0 ]; then ··· 55 57 exit 1 56 58 fi 57 59 # Verify the binary embeds the frozen git hash 58 - if strings "${BUILD_DIR}/ac-native" | grep -q "${FROZEN_HASH}"; then 59 - log "Binary verified: contains ${FROZEN_HASH}" 60 + if strings "${BUILD_DIR}/ac-native" | grep -q "${AC_GIT_HASH}"; then 61 + log "Binary verified: contains ${AC_GIT_HASH}" 60 62 else 61 - err "Binary does NOT contain git hash ${FROZEN_HASH} — stale build!" 63 + err "Binary does NOT contain git hash ${AC_GIT_HASH} — stale build!" 62 64 exit 1 63 65 fi 64 66 ··· 414 416 log "Node not available — skipping MongoDB build record" 415 417 return 0 416 418 fi 417 - local GIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") 418 - local BUILD_TS="${AC_BUILD_TS:-$(date -u '+%Y-%m-%dT%H:%M')}" 419 419 local SHA=$(sha256sum "${VMLINUZ}" 2>/dev/null | cut -d' ' -f1) 420 420 local SIZE=$(stat -c%s "${VMLINUZ}" 2>/dev/null || echo 0) 421 - # Use pre-computed build name from case block (avoids cwd issues after build_kernel cd) 422 - local BUILD_NAME="${AC_BUILD_NAME:-$(cd "${SCRIPT_DIR}" && bash scripts/build-name.sh 2>/dev/null || echo "unknown")}" 423 421 424 422 cd "${SCRIPT_DIR}" 425 - log "Recording build: ${BUILD_NAME} (${GIT_HASH})" 423 + log "Recording build: ${AC_BUILD_NAME} (${AC_GIT_HASH})" 426 424 echo "{ 427 - \"name\": \"${BUILD_NAME}\", 425 + \"name\": \"${AC_BUILD_NAME}\", 428 426 \"buildNum\": -1, 429 - \"version\": \"${GIT_HASH}-${BUILD_TS}\", 427 + \"version\": \"${AC_GIT_HASH}-${AC_BUILD_TS}\", 430 428 \"sha256\": \"${SHA}\", 431 429 \"size\": ${SIZE}, 432 - \"git_hash\": \"${GIT_HASH}\", 433 - \"build_ts\": \"${BUILD_TS}\", 430 + \"git_hash\": \"${AC_GIT_HASH}\", 431 + \"build_ts\": \"${AC_BUILD_TS}\", 434 432 \"url\": \"local\", 435 433 \"target\": \"${1:-build}\", 436 434 \"user\": \"${AC_USER_SUB:-${ADMIN_SUB:-unknown}}\" ··· 759 757 760 758 # Build metadata (use pre-computed name from top level, skip dirty check — 761 759 # require_clean already ensured clean state and stashed any hook artifacts) 762 - local GIT_HASH=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown") 763 - local BUILD_TS="${AC_BUILD_TS:-$(date -u '+%Y-%m-%dT%H:%M')}" 764 - local BUILD_NAME="${AC_BUILD_NAME:-$(bash scripts/build-name.sh 2>/dev/null || echo "upload-$(date +%s)")}" 765 760 local COMMIT_MSG=$(git log -1 --format=%s HEAD 2>/dev/null | head -c 200) 766 761 local SIZE=$(stat -c%s "${VMLINUZ}") 767 762 local SIZE_MB=$(( SIZE / 1048576 )) 768 763 local SHA=$(sha256sum "${VMLINUZ}" | cut -d' ' -f1) 769 764 770 - log "Uploading ${BUILD_NAME} (${GIT_HASH}, ${SIZE_MB}MB)..." 765 + log "Uploading ${AC_BUILD_NAME} (${AC_GIT_HASH}, ${SIZE_MB}MB)..." 771 766 772 767 local UPLOAD_URL="${AC_UPLOAD_URL:-https://aesthetic.computer/api/os-release-upload}" 773 768 ··· 775 770 local STEP1 776 771 STEP1=$(curl -sf -X POST "${UPLOAD_URL}" \ 777 772 -H "Authorization: Bearer ${AC_TOKEN}" \ 778 - -H "X-Build-Name: ${BUILD_NAME}" \ 779 - -H "X-Git-Hash: ${GIT_HASH}" \ 780 - -H "X-Build-Ts: ${BUILD_TS}" \ 773 + -H "X-Build-Name: ${AC_BUILD_NAME}" \ 774 + -H "X-Git-Hash: ${AC_GIT_HASH}" \ 775 + -H "X-Build-Ts: ${AC_BUILD_TS}" \ 781 776 -H "X-Commit-Msg: ${COMMIT_MSG}" \ 782 777 -H "X-Handle: ${AC_USER_HANDLE}" \ 783 778 --max-time 30) || { ··· 809 804 local RESPONSE 810 805 RESPONSE=$(curl -sf -X POST "${UPLOAD_URL}" \ 811 806 -H "Authorization: Bearer ${AC_TOKEN}" \ 812 - -H "X-Build-Name: ${BUILD_NAME}" \ 813 - -H "X-Git-Hash: ${GIT_HASH}" \ 814 - -H "X-Build-Ts: ${BUILD_TS}" \ 807 + -H "X-Build-Name: ${AC_BUILD_NAME}" \ 808 + -H "X-Git-Hash: ${AC_GIT_HASH}" \ 809 + -H "X-Build-Ts: ${AC_BUILD_TS}" \ 815 810 -H "X-Commit-Msg: ${COMMIT_MSG}" \ 816 811 -H "X-Finalize: true" \ 817 812 -H "X-Sha256: ${SHA}" \ ··· 831 826 log " URL: ${URL}" 832 827 833 828 # Step 3b: Upload versioned archive (for rollback support) 834 - local VERSIONED_KEY="os/builds/${BUILD_NAME}.vmlinuz" 829 + local VERSIONED_KEY="os/builds/${AC_BUILD_NAME}.vmlinuz" 835 830 local VERSIONED_STEP 836 831 VERSIONED_STEP=$(curl -sf -X POST "${UPLOAD_URL}" \ 837 832 -H "Authorization: Bearer ${AC_TOKEN}" \ 838 - -H "X-Build-Name: ${BUILD_NAME}" \ 833 + -H "X-Build-Name: ${AC_BUILD_NAME}" \ 839 834 -H "X-Versioned-Upload: true" \ 840 835 -H "X-Versioned-Key: ${VERSIONED_KEY}" \ 841 836 --max-time 30 2>/dev/null) || true ··· 860 855 local ISO_STEP 861 856 ISO_STEP=$(curl -sf -X POST "${UPLOAD_URL}" \ 862 857 -H "Authorization: Bearer ${AC_TOKEN}" \ 863 - -H "X-Build-Name: ${BUILD_NAME}" \ 858 + -H "X-Build-Name: ${AC_BUILD_NAME}" \ 864 859 -H "X-Template-Upload: true" \ 865 860 --max-time 30) || { log "Template presign failed (non-fatal)"; } 866 861 ··· 880 875 local MANIFEST_STEP 881 876 MANIFEST_STEP=$(curl -sf -X POST "${UPLOAD_URL}" \ 882 877 -H "Authorization: Bearer ${AC_TOKEN}" \ 883 - -H "X-Build-Name: ${BUILD_NAME}" \ 878 + -H "X-Build-Name: ${AC_BUILD_NAME}" \ 884 879 -H "X-Manifest-Upload: true" \ 885 880 --max-time 30 2>/dev/null) || true 886 881 if [ -n "${MANIFEST_STEP}" ]; then ··· 908 903 # Record in MongoDB 909 904 if command -v node &>/dev/null; then 910 905 echo "{ 911 - \"name\": \"${BUILD_NAME}\", 906 + \"name\": \"${AC_BUILD_NAME}\", 912 907 \"buildNum\": -1, 913 - \"version\": \"${GIT_HASH}-${BUILD_TS}\", 908 + \"version\": \"${AC_GIT_HASH}-${AC_BUILD_TS}\", 914 909 \"sha256\": \"${SHA}\", 915 910 \"size\": ${SIZE}, 916 - \"git_hash\": \"${GIT_HASH}\", 917 - \"build_ts\": \"${BUILD_TS}\", 911 + \"git_hash\": \"${AC_GIT_HASH}\", 912 + \"build_ts\": \"${AC_BUILD_TS}\", 918 913 \"url\": \"${URL}\", 919 914 \"target\": \"upload\", 920 915 \"user\": \"${AC_USER_SUB:-${ADMIN_SUB:-unknown}}\" ··· 977 972 VERSION_INFO=$(curl -sf "${VERSION_URL}") || { err "Failed to fetch version from CDN"; exit 1; } 978 973 local BUILD_NAME=$(echo "${VERSION_INFO}" | head -1) 979 974 local KERNEL_SIZE=$(echo "${VERSION_INFO}" | tail -1) 980 - log "Latest OTA: ${BUILD_NAME} (${KERNEL_SIZE} bytes)" 975 + log "Latest OTA: ${AC_BUILD_NAME} (${KERNEL_SIZE} bytes)" 981 976 982 977 # Download kernel (use /tmp — build dir may be a broken symlink in devcontainers) 983 978 local PULL_DIR="/tmp/ac-os-pull" ··· 1004 999 # Override VMLINUZ and build name so flash_usb uses the downloaded kernel 1005 1000 # (not the locally-generated name from scripts/build-name.sh) 1006 1001 VMLINUZ="${PULLED_KERNEL}" 1007 - export AC_BUILD_NAME="${BUILD_NAME}" 1008 - log "Ready to flash: ${BUILD_NAME}" 1002 + export AC_BUILD_NAME="${AC_BUILD_NAME}" 1003 + log "Ready to flash: ${AC_BUILD_NAME}" 1009 1004 } 1010 1005 1011 1006 case "${CMD}" in