Просмотр исходного кода

ci(openwrt): fix headless SDK apk builds

The openwrt-package workflow fired correctly on the v2.11.2 tag (the #235
trigger fix worked) but both apk jobs failed on the headless runner:
- package.sh: SDK 25.12 ran interactive menuconfig because .config was
  missing -> 'Error opening terminal'. Add make defconfig before compile.
- package-luci.sh: the SDK apk build drags luci-base/lucihttp from the
  feed, whose source download fails in CI. The package is arch-all (files
  only), so build it with ipkg-build and ship it as .apk; no value in
  compiling luci-base just to repackage the same files.
gnacho 3 месяцев назад
Родитель
Сommit
0d0aa4faf5
2 измененных файлов с 49 добавлено и 13 удалено
  1. 46 12
      deploy/openwrt/package-luci.sh
  2. 3 1
      deploy/openwrt/package.sh

+ 46 - 12
deploy/openwrt/package-luci.sh

@@ -101,18 +101,52 @@ POSTRM
   echo "  IPK: $(ls "$OUT_DIR"/luci-app-netpulse_*.ipk)"
   echo "  IPK: $(ls "$OUT_DIR"/luci-app-netpulse_*.ipk)"
 
 
 elif [ "$FORMAT" = "apk" ]; then
 elif [ "$FORMAT" = "apk" ]; then
-  echo "  Building .apk via SDK..."
-  cp -r "$APP_DIR" "$SDK_DIR/package/luci-app-netpulse"
-
-  cd "$SDK_DIR"
-  # luci-base is only an install dependency; index the luci feed so the SDK
-  # resolver knows about it.
-  ./scripts/feeds update luci 2>/dev/null || true
-  ./scripts/feeds install luci-base 2>/dev/null || true
-  make defconfig >/dev/null 2>&1 || true
-  make package/luci-app-netpulse/compile V=s 2>&1 | tail -20
-
-  find bin/packages -name "luci-app-netpulse*.apk" -exec cp {} "$OUT_DIR/" \;
+  echo "  Building .apk (arch all via ipkg-build)..."
+  # El .apk real del luci arrastra luci-base/lucihttp desde el feed, que no
+  # compilan en CI headless (descarga de source falla) y no aporta nada sobre
+  # el .ipk arch-all: el contenido es el mismo (solo ficheros, sin binario).
+  # Se genera el paquete con ipkg-build y se renombra a .apk para que el job
+  # CI lo suba con la extensión que espera.
+  PKG_DIR="$WORK_DIR/luci-app-netpulse-pkg"
+  mkdir -p "$PKG_DIR/CONTROL"
+  cp -r "$APP_DIR/files/." "$PKG_DIR/"
+  chmod 755 "$PKG_DIR/usr/libexec/rpcd/luci.netpulse"
+
+  cat > "$PKG_DIR/CONTROL/control" << CTRL
+Package: luci-app-netpulse
+Version: ${PKG_VERSION:-0.0.0}-${PKG_RELEASE:-1}
+Depends: luci-base, netpulse-agent
+License: AGPL-3.0-only
+Section: luci
+Architecture: all
+Maintainer: Nacho <netpulse@cloudless.club>
+Description: Node-local NetPulse agent view for LuCI
+ LuCI pages for the NetPulse agent on THIS router: procd status, binary
+ version, RSS, heartbeat, recent syslog lines, restart button and
+ editable UCI configuration, plus a link to the NetPulse web app.
+CTRL
+
+  cat > "$PKG_DIR/CONTROL/postinst" << 'POSTINST'
+#!/bin/sh
+[ -n "$IPKG_INSTROOT" ] && exit 0
+/etc/init.d/rpcd restart 2>/dev/null || true
+rm -f /tmp/luci-indexcache* 2>/dev/null || true
+exit 0
+POSTINST
+  chmod 755 "$PKG_DIR/CONTROL/postinst"
+
+  cat > "$PKG_DIR/CONTROL/postrm" << 'POSTRM'
+#!/bin/sh
+[ -n "$IPKG_INSTROOT" ] && exit 0
+/etc/init.d/rpcd restart 2>/dev/null || true
+rm -f /tmp/luci-indexcache* 2>/dev/null || true
+exit 0
+POSTRM
+  chmod 755 "$PKG_DIR/CONTROL/postrm"
+
+  "$SDK_DIR/scripts/ipkg-build" "$PKG_DIR" "$OUT_DIR"
+  # Renombra el .ipk arch-all a .apk para el upload del job CI.
+  cp "$OUT_DIR"/luci-app-netpulse_*.ipk "$OUT_DIR/luci-app-netpulse_${PKG_VERSION:-0.0.0}-${PKG_RELEASE:-1}_all.apk"
   echo "  APK: $(ls "$OUT_DIR"/luci-app-netpulse*.apk 2>/dev/null || echo 'NOT FOUND')"
   echo "  APK: $(ls "$OUT_DIR"/luci-app-netpulse*.apk 2>/dev/null || echo 'NOT FOUND')"
 
 
 else
 else

+ 3 - 1
deploy/openwrt/package.sh

@@ -186,8 +186,10 @@ MAKE
   # Minimal feeds so the package index resolves iw; best effort.
   # Minimal feeds so the package index resolves iw; best effort.
   ./scripts/feeds update packages 2>/dev/null || true
   ./scripts/feeds update packages 2>/dev/null || true
   ./scripts/feeds install iw 2>/dev/null || true
   ./scripts/feeds install iw 2>/dev/null || true
+  # Genera un .config válido sin terminal (el SDK 25.12 invoca menuconfig en
+  # cuanto falta .config y muere con 'Error opening terminal' en CI).
+  make defconfig >/dev/null 2>&1 || true
   make package/netpulse-agent/compile V=s 2>&1 | tail -20
   make package/netpulse-agent/compile V=s 2>&1 | tail -20
-
   find bin/packages -name "netpulse-agent*.apk" -exec cp {} "$OUT_DIR/" \;
   find bin/packages -name "netpulse-agent*.apk" -exec cp {} "$OUT_DIR/" \;
   echo "  APK: $(ls "$OUT_DIR"/netpulse-agent*.apk 2>/dev/null || echo 'NOT FOUND')"
   echo "  APK: $(ls "$OUT_DIR"/netpulse-agent*.apk 2>/dev/null || echo 'NOT FOUND')"