CI: use PKG_SOURCE instead of PKG_NAME
authorPaul Spooren <mail@aparcar.org>
Thu, 1 Oct 2020 18:58:29 +0000 (08:58 -1000)
committerPaul Spooren <mail@aparcar.org>
Fri, 2 Oct 2020 09:39:04 +0000 (23:39 -1000)
The PKG_NAME is the installable name of a package while PKG_SOURCE is
the folder containig both `Makefile` and possibliy `test.sh`

This approach previously worked for packages where both NAME and SOURCE
are the same, e.g. `vim`, however fore more complex packages like
`mariadb` (SOURCE) the NAMES are partly
*mariadb-server-plugin-handlersocket*, which is no existing folder.

With this commit the `PKG_SOURCE` is used to find the `test.sh` script.

Signed-off-by: Paul Spooren <mail@aparcar.org>
.github/workflows/entrypoint.sh

index c85674d94b91c6cf0a78ca23ae78e70822c071a1..7ec81c46d45f92bbb7ee104cb46a426eb14d95ba 100755 (executable)
@@ -10,12 +10,15 @@ for PKG in /ci/*.ipk; do
        PKG_NAME=$(sed -ne 's#^Package: \(.*\)$#\1#p' ./control)
        # package version without release
        PKG_VERSION=$(sed -ne 's#^Version: \(.*\)-[0-9]*$#\1#p' ./control)
+       # package source contianing test.sh script
+       PKG_SOURCE=$(sed -ne 's#^Source: .*/\(.*\)$#\1#p' ./control)
 
-       echo "Testing package $PKG_NAME ($PKG_VERSION)"
+       echo "Testing package $PKG_NAME in version $PKG_VERSION from $PKG_SOURCE"
 
        opkg install "$PKG"
 
-       TEST_SCRIPT=$(find /ci/ -name "$PKG_NAME" -type d)/test.sh
+       TEST_SCRIPT=$(find /ci/ -name "$PKG_SOURCE" -type d)/test.sh
+
        if [ -f "$TEST_SCRIPT" ]; then
                echo "Use package specific test.sh"
                if sh "$TEST_SCRIPT" "$PKG_NAME" "$PKG_VERSION"; then