cache-domains: added pre-test.sh CI step
authorGerard Ryan <G.M0N3Y.2503@gmail.com>
Sat, 29 Apr 2023 06:25:49 +0000 (16:25 +1000)
committerRosen Penev <rosenp@gmail.com>
Mon, 1 May 2023 10:38:17 +0000 (13:38 +0300)
Some packages variants have conflicting dependencies with the
base packages and the CI test will fail to install before anything
can be done by the packages to setup the system for install.

This change adds a pre-test.sh that runs before the install so things
like the default libustream variant can be swapped out as shown in the
updated cache-domains.

Signed-off-by: Gerard Ryan <G.M0N3Y.2503@gmail.com>
.github/workflows/entrypoint.sh
utils/cache-domains/Makefile
utils/cache-domains/pre-test.sh [new file with mode: 0755]

index 76dd8cbcc9f2c8bb5b019aad466f460338925797..7587aa8b785159e4075f53cc7cc9f37414508df8 100755 (executable)
@@ -26,10 +26,24 @@ for PKG in /ci/*.ipk; do
 
        echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
 
-       opkg install "$PKG"
-
        export PKG_NAME PKG_VERSION CI_HELPER
 
+       PRE_TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/pre-test.sh
+
+       if [ -f "$PRE_TEST_SCRIPT" ]; then
+               echo "Use package specific pre-test.sh"
+               if sh "$PRE_TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then
+                       echo "Pre-test successful"
+               else
+                       echo "Pre-test failed"
+                       exit 1
+               fi
+       else
+               echo "No pre-test.sh script available"
+       fi
+
+       opkg install "$PKG"
+
        TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
 
        if [ -f "$TEST_SCRIPT" ]; then
index c9e8e2632df3831fc16b6b8abd0178dfbebe7b9d..0e12ec32c8c3f703331c734e0fde4e51cd34106b 100644 (file)
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cache-domains
 PKG_VERSION:=2.3.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_MAINTAINER:=Gerard Ryan <G.M0N3Y.2503@gmail.com>
 
diff --git a/utils/cache-domains/pre-test.sh b/utils/cache-domains/pre-test.sh
new file mode 100755 (executable)
index 0000000..0b3e517
--- /dev/null
@@ -0,0 +1,24 @@
+#! /bin/sh
+
+set -o errexit
+
+case "${PKG_NAME}" in
+    cache-domains-openssl)
+        LIBUSTREAM_DEPS="libustream-openssl libopenssl3"
+        LIBUSTREAM_DEPS="${LIBUSTREAM_DEPS} libatomic1" # arm_cortex-a15_neon-vfpv4 extra dep
+        ;;
+    cache-domains-mbedtls)
+        LIBUSTREAM_DEPS="libustream-mbedtls libmbedtls"
+        ;;
+    cache-domains-wolfssl)
+        LIBUSTREAM_DEPS="libustream-wolfssl libwolfssl"
+        ;;
+esac
+
+# Replace the current libustream with the one PKG_NAME depends on.
+# opkg depends on libustream for https so we need to download the
+# replacement first and replace it offline.
+opkg download ${LIBUSTREAM_DEPS}
+opkg remove 'libustream-*'
+opkg install --offline-root / ./*.ipk
+rm ./*.ipk