@le-space/rootfs 0.1.47 → 0.1.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@le-space/rootfs",
3
- "version": "0.1.47",
3
+ "version": "0.1.49",
4
4
  "description": "Shared rootfs contract parsing, reference profile assets, and build helpers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,6 +28,7 @@ require go
28
28
 
29
29
  cleanup() {
30
30
  if [ -n "${ROOTFS_BUILD_TMPDIR}" ] && [ -d "${ROOTFS_BUILD_TMPDIR}" ]; then
31
+ chmod -R u+w "${ROOTFS_BUILD_TMPDIR}" 2>/dev/null || true
31
32
  rm -rf "${ROOTFS_BUILD_TMPDIR}"
32
33
  fi
33
34
  }
@@ -70,6 +71,7 @@ ROOTFS_BUILD_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/uc-go-peer-build.XXXXXX")"
70
71
  cd "${PROJECT_DIR}/go-peer"
71
72
  GOMODCACHE="${ROOTFS_BUILD_TMPDIR}/gomodcache" \
72
73
  GOCACHE="${ROOTFS_BUILD_TMPDIR}/gocache" \
74
+ GOFLAGS="-modcacherw" \
73
75
  CGO_ENABLED=0 \
74
76
  go build -ldflags="-w -s" -o "${APP_BINARY}" .
75
77
  )
@@ -16,10 +16,6 @@ SKIP_BUILD="${SKIP_BUILD:-0}"
16
16
  IPFS_ADD_URL="${IPFS_ADD_URL:-https://ipfs.aleph.cloud/api/v0/add}"
17
17
  IPFS_GATEWAY_URL="${IPFS_GATEWAY_URL:-https://ipfs.aleph.cloud/ipfs}"
18
18
  ALEPH_API_HOST="${ALEPH_API_HOST:-https://api2.aleph.im}"
19
- ALEPH_MESSAGE_WAIT_ATTEMPTS="${ALEPH_MESSAGE_WAIT_ATTEMPTS:-60}"
20
- ALEPH_MESSAGE_WAIT_DELAY_SECONDS="${ALEPH_MESSAGE_WAIT_DELAY_SECONDS:-5}"
21
- ALEPH_PIN_ATTEMPTS="${ALEPH_PIN_ATTEMPTS:-4}"
22
- ALEPH_PIN_DELAY_SECONDS="${ALEPH_PIN_DELAY_SECONDS:-10}"
23
19
  IPFS_GATEWAY_WAIT_ATTEMPTS="${IPFS_GATEWAY_WAIT_ATTEMPTS:-30}"
24
20
  IPFS_GATEWAY_WAIT_DELAY_SECONDS="${IPFS_GATEWAY_WAIT_DELAY_SECONDS:-10}"
25
21
  ROOTFS_CID=""
@@ -69,20 +65,6 @@ resolve_rootfs_version() {
69
65
  printf 'uc-go-peer-v0.1.0\n'
70
66
  }
71
67
 
72
- resolve_aleph_bin() {
73
- if [ -n "${ALEPH_BIN:-}" ]; then
74
- printf '%s\n' "${ALEPH_BIN}"
75
- return
76
- fi
77
-
78
- if command -v aleph >/dev/null 2>&1; then
79
- command -v aleph
80
- return
81
- fi
82
-
83
- die "Missing aleph CLI. Set ALEPH_BIN=/path/to/aleph or install aleph-client."
84
- }
85
-
86
68
  build_with_host_tools() {
87
69
  echo "Using host virt-customize/qemu-img toolchain."
88
70
  ROOTFS_CONTRACT_FILE="${ROOTFS_CONTRACT_FILE}" \
@@ -338,9 +320,6 @@ PY
338
320
  }
339
321
 
340
322
  upload_image() {
341
- local aleph_bin
342
- aleph_bin="$(resolve_aleph_bin)"
343
-
344
323
  require python3
345
324
  require curl
346
325
 
@@ -378,71 +357,7 @@ PY
378
357
  echo "Waiting for CID ${ROOTFS_CID} to become retrievable via ${IPFS_GATEWAY_URL}..."
379
358
  wait_for_ipfs_cid_available "${ROOTFS_CID}"
380
359
 
381
- echo "Pinning CID ${ROOTFS_CID} on Aleph Cloud..."
382
- local attempt
383
- local stderr_log="${OUT_DIR}/store-message.stderr.log"
384
- local stdout_log="${OUT_DIR}/store-message.json"
385
- local last_error_summary=""
386
-
387
- for attempt in $(seq 1 "${ALEPH_PIN_ATTEMPTS}"); do
388
- : > "${stdout_log}"
389
- : > "${stderr_log}"
390
-
391
- echo "Aleph pin attempt ${attempt}/${ALEPH_PIN_ATTEMPTS} for CID ${ROOTFS_CID}..."
392
- if "${aleph_bin}" file pin "${ROOTFS_CID}" \
393
- --channel "${CHANNEL}" \
394
- > "${stdout_log}" 2> "${stderr_log}"; then
395
- break
396
- fi
397
-
398
- last_error_summary="$(python3 - "${stderr_log}" <<'PY'
399
- import sys
400
- from pathlib import Path
401
-
402
- text = Path(sys.argv[1]).read_text(errors="replace").strip()
403
- print(text or "Aleph pin failed without stderr output")
404
- PY
405
- )"
406
-
407
- echo "Aleph pin attempt ${attempt}/${ALEPH_PIN_ATTEMPTS} failed for CID ${ROOTFS_CID}." >&2
408
- if [[ -n "${last_error_summary}" ]]; then
409
- echo "${last_error_summary}" >&2
410
- fi
411
-
412
- if [ "${attempt}" -lt "${ALEPH_PIN_ATTEMPTS}" ]; then
413
- echo "Retrying Aleph pin in ${ALEPH_PIN_DELAY_SECONDS}s..." >&2
414
- sleep "${ALEPH_PIN_DELAY_SECONDS}"
415
- continue
416
- fi
417
-
418
- die "Aleph pin failed for CID ${ROOTFS_CID} after ${ALEPH_PIN_ATTEMPTS} attempts"
419
- done
420
-
421
- if [ ! -s "${stdout_log}" ]; then
422
- if [ -n "${last_error_summary}" ]; then
423
- echo "${last_error_summary}" >&2
424
- fi
425
- die "Aleph pin returned an empty response for CID ${ROOTFS_CID}"
426
- fi
427
-
428
- ROOTFS_ITEM_HASH="$(python3 - "${stdout_log}" <<'PY'
429
- import json
430
- import sys
431
- from pathlib import Path
432
-
433
- content = Path(sys.argv[1]).read_text().strip()
434
- if not content:
435
- raise SystemExit("Aleph pin returned an empty response")
436
-
437
- payload = json.loads(content)
438
- print(payload["item_hash"])
439
- PY
440
- )" || die "Failed to extract Aleph item hash from ${OUT_DIR}/store-message.json"
441
-
442
- wait_for_aleph_message_processed "${ROOTFS_ITEM_HASH}"
443
-
444
- echo "Published rootfs CID: ${ROOTFS_CID}"
445
- echo "Published Aleph item hash: ${ROOTFS_ITEM_HASH}"
360
+ echo "Uploaded rootfs CID: ${ROOTFS_CID}"
446
361
  }
447
362
 
448
363
  mkdir -p "${OUT_DIR}"
@@ -487,5 +402,4 @@ if [ "${SKIP_UPLOAD}" = "1" ]; then
487
402
  exit 0
488
403
  fi
489
404
 
490
- upload_image
491
- write_manifest "${ROOTFS_CID}" "${ROOTFS_ITEM_HASH}"
405
+ die "Direct upload from build-rootfs.sh is deprecated. Use packages/node/src/rootfs-runner.ts for IPFS upload and Aleph publication, or rerun with SKIP_UPLOAD=1 for build-only output."