@le-space/rootfs 0.1.46 → 0.1.47

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.46",
3
+ "version": "0.1.47",
4
4
  "description": "Shared rootfs contract parsing, reference profile assets, and build helpers.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -11,6 +11,7 @@ BASE_IMAGE="${OUT_DIR}/debian-12-genericcloud-amd64.qcow2"
11
11
  IMAGE="${OUT_DIR}/aleph-uc-go-peer.qcow2"
12
12
  APP_BINARY="${OUT_DIR}/universal-chat-go"
13
13
  ROOTFS_IMAGE_SIZE="${ROOTFS_IMAGE_SIZE:-20G}"
14
+ ROOTFS_BUILD_TMPDIR=""
14
15
 
15
16
  require() {
16
17
  command -v "$1" >/dev/null 2>&1 || {
@@ -25,6 +26,14 @@ require virt-customize
25
26
  require python3
26
27
  require go
27
28
 
29
+ cleanup() {
30
+ if [ -n "${ROOTFS_BUILD_TMPDIR}" ] && [ -d "${ROOTFS_BUILD_TMPDIR}" ]; then
31
+ rm -rf "${ROOTFS_BUILD_TMPDIR}"
32
+ fi
33
+ }
34
+
35
+ trap cleanup EXIT
36
+
28
37
  eval "$(python3 "${SCRIPT_DIR}/read-rootfs-contract.py" "${ROOTFS_CONTRACT_FILE}")"
29
38
 
30
39
  ROOTFS_CONTRACT_BINARY_PATH="${ROOTFS_CONTRACT_BINARY_PATH:-/usr/local/bin/universal-chat-go}"
@@ -56,16 +65,15 @@ cp "${BASE_IMAGE}" "${IMAGE}"
56
65
  qemu-img resize "${IMAGE}" "${ROOTFS_IMAGE_SIZE}"
57
66
 
58
67
  echo "Building universal-chat-go outside the guest image"
68
+ ROOTFS_BUILD_TMPDIR="$(mktemp -d "${TMPDIR:-/tmp}/uc-go-peer-build.XXXXXX")"
59
69
  (
60
70
  cd "${PROJECT_DIR}/go-peer"
61
- GOMODCACHE="${OUT_DIR}/gomodcache" \
62
- GOCACHE="${OUT_DIR}/gocache" \
71
+ GOMODCACHE="${ROOTFS_BUILD_TMPDIR}/gomodcache" \
72
+ GOCACHE="${ROOTFS_BUILD_TMPDIR}/gocache" \
63
73
  CGO_ENABLED=0 \
64
74
  go build -ldflags="-w -s" -o "${APP_BINARY}" .
65
75
  )
66
76
 
67
- rm -rf "${OUT_DIR}/gomodcache" "${OUT_DIR}/gocache"
68
-
69
77
  virt-customize \
70
78
  -a "${IMAGE}" \
71
79
  --mkdir "${ROOTFS_CONTRACT_INSTALL_DIR}" \