meta-app-framework: Handle html5 apps not having debug widgets 77/25377/2
authorScott Murray <scott.murray@konsulko.com>
Thu, 1 Oct 2020 19:54:53 +0000 (15:54 -0400)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Fri, 2 Oct 2020 16:30:23 +0000 (16:30 +0000)
The previous aglwgt.bbclass change to make build/package errors fatal
now trips up on the HTML5 applications, as they do not produce a debug
widget, and the logic changes assumed that all widget builds would
have one.  To handle this, if there is no debug widget present when
doing do_install, check the config.xml file in the release widget and
do not throw an error if the widget type is "text/html".

Bug-AGL: SPEC-3593

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: If58c3065464d2d2ea3d78b8ce31304d00fae6504
Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25377
Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org>
Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
meta-app-framework/classes/aglwgt.bbclass

index bdd38f6..00d3f97 100644 (file)
@@ -114,19 +114,30 @@ aglwgt_do_install() {
         DEST=manualinstall
     fi
 
-    if [ "$(find ${B}/build-release -name '*.wgt' -maxdepth 1)" ]; then
+    wgt="$(find ${B}/build-release -maxdepth 1 -name '*.wgt'| head -n 1)"
+    if [ -n "$wgt" ]; then
         install -d ${D}/usr/AGL/apps/$DEST
-        install -m 0644 ${B}/build-release/*.wgt ${D}/usr/AGL/apps/$DEST/
+        install -m 0644 $wgt ${D}/usr/AGL/apps/$DEST/
     else
         bbfatal "no package found in widget directory"
     fi
 
     for t in debug coverage test; do
-        if [ "$(find ${B}/build-${t} -name *-${t}.wgt -maxdepth 1)" ]; then
+        if [ "$(find ${B}/build-${t} -maxdepth 1 -name *-${t}.wgt)" ]; then
             install -d ${D}/usr/AGL/apps/${t}
             install -m 0644 ${B}/build-${t}/*-${t}.wgt ${D}/usr/AGL/apps/${t}/
         elif [ "$t" = "debug" ]; then
-            bbfatal "no package found in ${t} widget directory"
+            # HTML5 widgets complicate things here, need to detect them and
+            # not error out in that case.  ATM this requires looking in the
+            # config.xml of the release widget.
+            rm -rf ${B}/tmp
+            unzip $wgt config.xml -d ${B}/tmp
+            if [ -f ${B}/tmp/config.xml -a \
+                 ! cat ${B}/tmp/config.xml | \
+                     grep -q '^[[:space:]]*<content[[:space:]]\+src="[^\"]*"[[:space:]]\+type="text/html"' ]; then
+                bbfatal "no package found in ${t} widget directory"
+            fi
+            rm -rf ${B}/tmp
         elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
             if [ "$t" = "coverage" -o -f ${S}/test/CMakeLists.txt ]; then
                 bbfatal "no package found in ${t} widget directory"