Widget packaging rework 84/24484/4
authorScott Murray <scott.murray@konsulko.com>
Tue, 28 Apr 2020 21:10:50 +0000 (21:10 +0000)
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>
Tue, 12 May 2020 12:51:12 +0000 (12:51 +0000)
aglwgt.bbclass changes:
- Made the autobuild/agl/autobuild script a hard requirement, as all
  upstream widgets have it, and this is the first step to actually
  using it in the class to drive building the widgets after a
  subsequent round of autobuild script updates.
- Reworked wgt packaging to simplify the logic and split the test,
  debug, and coverage widgets into separate packages to allow
  installing them separately.
- The on target install directories for the widgets have been changed
  to release, test, debug, and coverage under /usr/AGL/apps, with the
  previous logic with respect to the AGLWGT_AUTOINSTALL variable
  being retained for the few widgets that need to go into the
  manualinstall directory. An "autoinstall" symlink has been added to
  point at the release directory to maintain previous behavior.
  This should allow a simple path to configuring installation of the
  debug or coverage widgets on first boot with future changes.
- Added logic to only assume test widgets exist for recipes with
  names starting with "agl-service-". This can be over-ridden by
  defining AGLWGT_HAVE_TESTS as "true" in a recipe.
- Added AGLWGT_EXTRA_BUILD_ARGS variable for passing extra arguments
  to widget builds. Currently its default value includes the previous
  VERBOSE=true that was passed to every autobuild invocation, and
  "${PARALLEL_MAKE}" which has been added to improve build speed.
- Added AGLWGT_PACKAGE_WARN variable to control extra warnings
  around the existence of test/debug/coverage widgets when packaging.
  Once further build rework is done, the default for this will likely
  be changed to "true", currently the output is too verbose to do so.
- Removed over-rides to force building of test widget when building
  with the agl-ptest feature set, as it is now unnecessary and will
  result in an undesired extra copy of the test widget in the release
  folder.

Other changes:
- Created new devel and test packagegroup variants for several of the
  existing packagegroups to contain the associated widgets.
- Added agl-devel-wgt and agl-test-wgt IMAGE_FEATURES to control the
  addition of dbg/coverage and test widgets to images.  Additions to
  the FEATURE_PACKAGES variables have been added in several places to
  add the corresponding widget packagegroups.
- Added the agl-devel-wgt image feature to the agl-devel feature
  template definition to match current behavior.

Bug-AGL: SPEC-3300

Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Change-Id: I3a28615db94bbc04e30e98ac3dce8cae942a499f

meta-agl-profile-core/conf/include/agl-devel.inc
meta-agl-profile-core/conf/include/base-agl.inc
meta-agl-profile-core/recipes-devtools/packagegroups/packagegroup-agl-core-devel.bb
meta-agl-profile-core/recipes-platform/packagegroups/packagegroup-agl-core-services.bb
meta-agl-profile-graphical/conf/include/agl-profile-graphical.inc [new file with mode: 0644]
meta-agl-profile-graphical/recipes-platform/packagegroups/packagegroup-agl-graphical-services.bb
meta-app-framework/classes/aglwgt.bbclass
templates/feature/agl-profile-graphical/50_local.conf.inc [new file with mode: 0644]
templates/feature/agl-ptest/90_local.conf.inc

index 914ab39..aca49c8 100644 (file)
@@ -9,6 +9,8 @@ IMAGE_INSTALL_append = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic.vmdk wic.
 # Install libdrm-test, including modetest, to images with GUI
 IMAGE_INSTALL_append = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland', ' libdrm-tests', '', d)}"
 
+IMAGE_FEATURES_append = " agl-devel-wgt"
+
 # disable install of debug files in SDK
 # initial value: SDKIMAGE_FEATURES="dev-pkgs dbg-pkgs staticdev-pkgs"
 SDKIMAGE_FEATURES="dev-pkgs"
index c5cf1a5..d568b06 100644 (file)
@@ -2,6 +2,10 @@
 # Comment this out to be able to select the kernel modules yourself.
 IMAGE_INSTALL_append = " kernel-modules"
 
+# Base image feature package definitions for agl-test-wgt and agl-devel-wgt
+FEATURE_PACKAGES_agl-test-wgt = "packagegroup-agl-core-services-test"
+FEATURE_PACKAGES_agl-devel-wgt = "packagegroup-agl-core-services-devel"
+
 # Likewise as we included all kernel modules by default in the filesystem,
 # we do not need a separate tarball stored.
 # Comment this out to receive the separate modules tarball again.
index b6f8f07..9f70159 100644 (file)
@@ -3,14 +3,25 @@ LICENSE = "MIT"
 
 inherit packagegroup
 
+PROVIDES = "${PACKAGES}"
 PACKAGES = "\
     packagegroup-agl-core-services \
+    packagegroup-agl-core-services-test \
+    packagegroup-agl-core-services-devel \
     "
 
-ALLOW_EMPTY_${PN} = "1"
-
 RDEPENDS_${PN} += "\
-agl-service-data-persistence \
-agl-service-network \
-agl-service-platform-info \
+    agl-service-data-persistence \
+    agl-service-network \
+    agl-service-platform-info \
+    "
+
+RDEPENDS_${PN}-test = "\
+    ${@' '.join([x + '-test' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
+    afb-test \
+    "
+
+RDEPENDS_${PN}-devel = "\
+    ${@' '.join([x + '-dbg' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
+    ${@' '.join([x + '-coverage' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
     "
diff --git a/meta-agl-profile-graphical/conf/include/agl-profile-graphical.inc b/meta-agl-profile-graphical/conf/include/agl-profile-graphical.inc
new file mode 100644 (file)
index 0000000..519e791
--- /dev/null
@@ -0,0 +1,3 @@
+# Extend image feature package definitions for agl-test-wgt and agl-devel-wgt
+FEATURE_PACKAGES_agl-test-wgt_append = " packagegroup-agl-graphical-services-test"
+FEATURE_PACKAGES_agl-devel-wgt_append = " packagegroup-agl-graphical-services-devel"
index 2ebb3d6..0601606 100644 (file)
@@ -3,13 +3,25 @@ LICENSE = "MIT"
 
 inherit packagegroup
 
+PROVIDES = "${PACKAGES}"
 PACKAGES = "\
     packagegroup-agl-graphical-services \
+    packagegroup-agl-graphical-services-test \
+    packagegroup-agl-graphical-services-devel \
     "
 
 ALLOW_EMPTY_${PN} = "1"
 
-RDEPENDS_${PN} += "\
-${@bb.utils.contains('DISTRO_FEATURES', 'pipewire', 'agl-service-mediaplayer', '', d)} \
-${@bb.utils.contains('DISTRO_FEATURES', 'pipewire', 'agl-service-radio', '', d)} \
+RDEPENDS_${PN} = "\
+    ${@bb.utils.contains('DISTRO_FEATURES', 'pipewire', 'agl-service-mediaplayer', '', d)} \
+    ${@bb.utils.contains('DISTRO_FEATURES', 'pipewire', 'agl-service-radio', '', d)} \
+    "
+
+RDEPENDS_${PN}-test = "\
+    ${@' '.join([x + '-test' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
+    "
+
+RDEPENDS_${PN}-devel = "\
+    ${@' '.join([x + '-dbg' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
+    ${@' '.join([x + '-coverage' for x in str.split(d.getVar('RDEPENDS_${PN}'))])} \
     "
index 7420bae..faa17e3 100644 (file)
@@ -8,7 +8,6 @@
 # The makefile needs to use wgtpkg-pack.
 #
 
-
 # 'wgtpkg-pack' in af-main-native is required.
 DEPENDS_append = " af-main-native"
 
@@ -21,57 +20,64 @@ DEPENDS_append = " cmake-apps-module-native"
 # for hal bindings genskel is required.
 DEPENDS_append = " af-binder-devtools-native"
 
-EXTRA_OECMAKE_append_agl-ptest = " -DBUILD_TEST_WGT=TRUE"
+# Set the default build type for cmake based projects
+# NOTE: This can be removed after switching to using the autobuild
+#       script to do compilation
+EXTRA_OECMAKE_append = " -DCMAKE_BUILD_TYPE=RELEASE"
 
 # FIXME: Remove once CMake+ninja issues are resolved
 OECMAKE_GENERATOR = "Unix Makefiles"
 
-do_aglwgt_package()  {
+AGLWGT_EXTRA_BUILD_ARGS = "VERBOSE=TRUE ${PARALLEL_MAKE}"
 
-    mkdir -p ${S}/build-test
-    mkdir -p ${S}/build-debug
-    mkdir -p ${S}/build-coverage
+# Only widgets with recipe names starting with agl-service- are
+# assumed to have tests by default, set this to "true" to force
+# building/packaging of the test widget for other widgets.
+AGLWGT_HAVE_TESTS = "false"
+
+# Warning on missing test/debug/coverage packages disabled by default
+# for now to reduce build output clutter.
+AGLWGT_PACKAGE_WARN = "false"
 
+# There are some widgets with build issues wrt test/debug/coverage
+# that are currently non-fatal but do not yield a widget, allow empty
+# test and coverage packages for now to allow the build to proceed.
+# This matches the default behavior for -dbg packages.
+#
+# NOTE: This should revisited after a round of autobuild script rework
+#       to address SPEC-3300.
+ALLOW_EMPTY_${PN}-coverage = "1"
+ALLOW_EMPTY_${PN}-test = "1"
+
+
+do_aglwgt_package()  {
     bldcmd=${S}/autobuild/agl/autobuild
     if [ ! -x "$bldcmd" ]; then
-        bldcmd=${S}/conf.d/autobuild/agl/autobuild
-        if [ -x "$bldcmd" ]; then
-            bbwarn "OBSOLETE: Your autobuild script should be located in :"
-            bbwarn "autobuild/agl/ from the project root source folder"
-            bbwarn "and generate a .wgt file using wgtpack in the build"
-            bbwarn "root folder calling:"
-            bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>"
-            bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes"
-        else
-            bbwarn "OBSOLETE: You must have an autobuild script located in:"
-            bbwarn "autobuild/agl/ from the project root source folder"
-            bbwarn "with filename autobuild which should generate"
-            bbwarn "a .wgt file using wgtpack in the build"
-            bbwarn "root folder calling:"
-            bbwarn "./autobuild/agl/autobuild package DEST=<BUILDDIR>"
-            bbwarn "Fix your package as it will not work within the SDK"
-            bbwarn "See: https://wiki.automotivelinux.org/troubleshooting/app-recipes"
-            bldcmd=make
-        fi
+        bbfatal "Missing autobuild/agl/autobuild script"
     fi
 
     cd ${B}
-    if ! $bldcmd package BUILD_DIR=${B} DEST=${S}/widgets VERBOSE=TRUE; then
+    if ! $bldcmd package BUILD_DIR=${B} DEST=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}; then
         bbwarn "Target: package failed"
     fi
 
-    cd ${S}/build-test
-    if ! $bldcmd package-test BUILD_DIR=${S}/build-test DEST=${S}/widgets VERBOSE=TRUE; then
-        bbwarn "Target: package-test failed"
+    if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "true" ]; then
+        mkdir -p ${S}/build-test
+        cd ${S}/build-test
+        if ! $bldcmd package-test BUILD_DIR=${S}/build-test DEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS}; then
+            bbwarn "Target: package-test failed"
+        fi
     fi
 
+    mkdir -p ${S}/build-debug
     cd ${S}/build-debug
-    if ! $bldcmd package-debug BUILD_DIR=${S}/build-debug DEST=${S}/widgets VERBOSE=TRUE; then
+    if ! $bldcmd package-debug BUILD_DIR=${S}/build-debug DEST=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS}; then
         bbwarn "Target: package-debug failed"
     fi
 
+    mkdir -p ${S}/build-coverage
     cd ${S}/build-coverage
-    if ! $bldcmd package-coverage BUILD_DIR=${S}/build-coverage DEST=${S}/widgets VERBOSE=TRUE; then
+    if ! $bldcmd package-coverage BUILD_DIR=${S}/build-coverage DEST=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}; then
         bbwarn "Target: package-coverage failed"
     fi
 }
@@ -80,55 +86,48 @@ python () {
     d.setVarFlag('do_aglwgt_deploy', 'fakeroot', '1')
 }
 
-
 POST_INSTALL_LEVEL ?= "10"
 POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"
 
 EXTRA_WGT_POSTINSTALL ?= ""
 
 do_aglwgt_deploy() {
-    TEST_WGT="*-test.wgt"
-    DEBUG_WGT="*-debug.wgt"
-    COVERAGE_WGT="*-coverage.wgt"
-    if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]
-    then
-        install -d ${D}/usr/AGL/apps/manualinstall
-        install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/manualinstall || \
-        install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/manualinstall
-    else
-        install -d ${D}/usr/AGL/apps/autoinstall
-        install -m 0644 ${B}/*.wgt ${D}/usr/AGL/apps/autoinstall || \
-        install -m 0644 ${B}/package/*.wgt ${D}/usr/AGL/apps/autoinstall
-
-        install -m 0644 ${S}/widgets/*.wgt ${D}/usr/AGL/apps/autoinstall || \
-            ( bbwarn "no package found in widget directory")
-
-        if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${TEST_WGT})" ]
-        then
-                install -d ${D}/usr/AGL/apps/testwgt
-            mv ${D}/usr/AGL/apps/autoinstall/*-test.wgt ${D}/usr/AGL/apps/testwgt
-        fi
-
-        if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${DEBUG_WGT})" ]
-        then
-                install -d ${D}/usr/AGL/apps/debugwgt
-            mv ${D}/usr/AGL/apps/autoinstall/*-debug.wgt ${D}/usr/AGL/apps/debugwgt
-        fi
-
-        if [ "$(find ${D}/usr/AGL/apps/autoinstall -name ${COVERAGE_WGT})" ]
-        then
-                install -d ${D}/usr/AGL/apps/coveragewgt
-            mv ${D}/usr/AGL/apps/autoinstall/*-coverage.wgt ${D}/usr/AGL/apps/coveragewgt
-        fi
+    DEST=release
+    if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then
+        DEST=manualinstall
+    fi
 
+    if [ "$(find ${B}/build-release -name '*.wgt')" ]; then
+        install -d ${D}/usr/AGL/apps/$DEST
+        install -m 0644 ${B}/build-release/*.wgt ${D}/usr/AGL/apps/$DEST/
+    else
+        bberror "no package found in widget directory"
     fi
 
-    APP_FILES=""
-    for file in ${D}/usr/AGL/apps/autoinstall/*.wgt;do
-        APP_FILES="${APP_FILES} $(basename $file)";
+    for t in test debug coverage; do
+        if [ "$(find ${B}/build-${t} -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 [ "${AGLWGT_PACKAGE_WARN}" = "true" ]; then
+            if [ "$t" != "test" ]; then
+                bbwarn "no package found in ${t} widget directory"
+            elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "true" ]; then
+                bbwarn "no package found in ${t} widget directory"
+            fi
+        fi
     done
-    install -d ${D}/${sysconfdir}/agl-postinsts
-    cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
+
+    if [ "${AGLWGT_AUTOINSTALL_${PN}}" != "0" ]; then
+        # For now assume autoinstall of the release versions
+        rm -rf ${D}/usr/AGL/apps/autoinstall
+        ln -sf release ${D}/usr/AGL/apps/autoinstall
+
+        APP_FILES=""
+        for file in ${D}/usr/AGL/apps/autoinstall/*.wgt; do
+            APP_FILES="${APP_FILES} $(basename $file)";
+        done
+        install -d ${D}/${sysconfdir}/agl-postinsts
+        cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
 #!/bin/sh -e
 for file in ${APP_FILES}; do
     /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
@@ -136,23 +135,31 @@ done
 sync
 ${EXTRA_WGT_POSTINSTALL}
 EOF
-    chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
+        chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
+    fi
 }
 
-FILES_${PN} += "/usr/AGL/apps/autoinstall/*.wgt \
-    /usr/AGL/apps/manualinstall/*.wgt \
-    /usr/AGL/apps/testwgt/*.wgt \
-    /usr/AGL/apps/debugwgt/*.wgt \
-    /usr/AGL/apps/coveragewgt/*.wgt \
-    ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
-    "
-
 do_install() {
 }
 
 addtask aglwgt_deploy  before do_package after do_install
 addtask aglwgt_package before do_aglwgt_deploy after do_compile
 
+PACKAGES += "${PN}-test ${PN}-coverage"
+
+FILES_${PN} += " \
+    /usr/AGL/apps/release/*.wgt \
+    /usr/AGL/apps/autoinstall \
+    /usr/AGL/apps/manualinstall \
+    ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
+"
+FILES_${PN}-test = "/usr/AGL/apps/test/*.wgt"
+FILES_${PN}-dbg = "/usr/AGL/apps/debug/*.wgt"
+FILES_${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt"
+
+# Test widgets need the base widget
+RDEPENDS_${PN}-test = "${PN}"
+
 # Signature keys
 # These are default keys for development purposes !
 # Change it for production.
diff --git a/templates/feature/agl-profile-graphical/50_local.conf.inc b/templates/feature/agl-profile-graphical/50_local.conf.inc
new file mode 100644 (file)
index 0000000..e290c09
--- /dev/null
@@ -0,0 +1,2 @@
+#see meta-agl/meta-agl-profile-graphical/conf/include/agl-profile-graphical.inc
+require conf/include/agl-profile-graphical.inc
index bee38fa..554c93e 100644 (file)
@@ -2,7 +2,6 @@
 # Enabling ptest in image ...
 
 OVERRIDES .= ":agl-ptest"
-EXTRA_OECMAKE_append = " -DBUILD_TEST_WGT=TRUE"
 DISTRO_FEATURES_append = " ptest"
 EXTRA_IMAGE_FEATURES_append = " ptest-pkgs"