connectcore-demo: separate in several packages

This commit separates the original 'connectcore-demo-example' package in 3
packages:

  1. 'server' package. It contains the 'demoserver.py' script and its
     corresponding systemd service and init script.
     This script is required for the local demo and to be used with the
     Bluetooth application (during the get started process)

  2. 'example' package. It contains the html and required resources (images,
     javascript, etc.) to use the demo locally, except for the multimedia
     resources.
     This package depends (in runtime) on the 'server' package.

  3. 'multimedia' package. It contains the multimedia html and required
     resources (images, javascript, videos, etc.) to use the multimedia demo
     features locally.
     This package depends (in runtime) on the 'example' package and also on
     'video-examples' and 'webglsamples' packages.

This split allows to select the required demo packages per platform and image
type.

By default, the 'multimedia' package is the one included in the webkit images,
but the 'example' package is the one included in the rest of images.

Signed-off-by: Tatiana Leon <Tatiana.Leon@digi.com>
This commit is contained in:
Tatiana Leon 2023-02-03 13:10:09 +01:00
parent bb12e4b7c8
commit 0b9b73afc8
9 changed files with 107 additions and 56 deletions

View File

@ -1,5 +1,5 @@
# #
# Copyright (C) 2020, Digi International Inc. # Copyright (C) 2020-2023, Digi International Inc.
# #
SUMMARY = "WebKit packagegroup for DEY image" SUMMARY = "WebKit packagegroup for DEY image"
@ -9,6 +9,6 @@ inherit packagegroup
# Include WPE WebKit, launcher (cog) and examples # Include WPE WebKit, launcher (cog) and examples
RDEPENDS:${PN} += " \ RDEPENDS:${PN} += " \
cog \ cog \
connectcore-demo-example-webkit \ connectcore-demo-example-webkit-multimedia \
wpewebkit \ wpewebkit \
" "

View File

@ -1,12 +1,55 @@
# Copyright (C) 2022 Digi International. # Copyright (C) 2022, 2023 Digi International.
require recipes-digi/dey-examples/connectcore-demo-example.inc require recipes-digi/dey-examples/connectcore-demo-example.inc
RDEPENDS:${PN} += " \ WESTON_SERVICE ?= "weston.service"
cog \ WESTON_SERVICE:ccmp15 ?= "weston-launch.service"
video-examples \
webglsamples \ CC_DEMO_DISPLAY ?= "wayland-0"
CC_DEMO_DISPLAY:ccmp15 ?= "wayland-1"
CC_DEMO_ENV ?= "DISPLAY=:0.0 XDG_RUNTIME_DIR=/run/user/0 WAYLAND_DISPLAY=\${DEMO_DISPLAY}"
CC_DEMO_ENV:ccimx6ul ?= ""
FILESEXTRAPATHS:prepend := "${THISDIR}/../../../../recipes-digi/dey-examples/connectcore-demo-example:"
SRC_URI += " \
file://connectcore-demo-example-init \
file://connectcore-demo-example.service \
" "
do_install:append() {
# Install systemd service
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
# Install systemd unit files
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/connectcore-demo-example.service ${D}${systemd_unitdir}/system/
sed -i -e "s,##WESTON_SERVICE##,${WESTON_SERVICE},g" \
"${D}${systemd_unitdir}/system/connectcore-demo-example.service"
fi
# Install connectcore-demo-example-init
install -d ${D}${sysconfdir}/init.d/
install -m 755 ${WORKDIR}/connectcore-demo-example-init ${D}${sysconfdir}/connectcore-demo-example
sed -i -e "s@##CC_DEMO_ENV##@${CC_DEMO_ENV}@g" \
-e "s@##CC_DEMO_DISPLAY##@${CC_DEMO_DISPLAY}@g" \
"${D}${sysconfdir}/connectcore-demo-example"
ln -sf ${sysconfdir}/connectcore-demo-example ${D}${sysconfdir}/init.d/connectcore-demo-example
}
FILES:${PN}:append = " \
${systemd_unitdir}/system/connectcore-demo-example.service \
${sysconfdir}/connectcore-demo-example \
${sysconfdir}/init.d/connectcore-demo-example \
"
RDEPENDS:${PN} += " cog"
INITSCRIPT_PACKAGES += "${PN}"
INITSCRIPT_NAME:${PN} = "connectcore-demo-example"
INITSCRIPT_PARAMS:${PN} = "start 19 2 3 4 5 . stop 21 0 1 6 ."
SYSTEMD_PACKAGES += "${PN}"
SYSTEMD_SERVICE:${PN} = "connectcore-demo-example.service"
RREPLACES:${PN} = "connectcore-demo-example" RREPLACES:${PN} = "connectcore-demo-example"
RCONFLICTS:${PN} = "connectcore-demo-example" RCONFLICTS:${PN} = "connectcore-demo-example"

View File

@ -19,7 +19,6 @@
readonly DEMO_DISPLAY="##CC_DEMO_DISPLAY##" readonly DEMO_DISPLAY="##CC_DEMO_DISPLAY##"
readonly DEMO_ENV="##CC_DEMO_ENV##" readonly DEMO_ENV="##CC_DEMO_ENV##"
readonly COG_BINARY="/usr/bin/cog" readonly COG_BINARY="/usr/bin/cog"
readonly DEMOSERVER_BINARY="/srv/www/demoserver.py"
readonly STOP_TIMEOUT="5" readonly STOP_TIMEOUT="5"
wait_for_wayland() { wait_for_wayland() {
@ -48,16 +47,9 @@ stop_process() {
done done
} }
stop() {
stop_process "${COG_BINARY}"
stop_process "${DEMOSERVER_BINARY}"
}
start() { start() {
local COG_ENV="${DEMO_ENV}" local COG_ENV="${DEMO_ENV}"
${DEMOSERVER_BINARY} > /dev/null 2>&1 &
if [ -d "/usr/share/wayland" ]; then if [ -d "/usr/share/wayland" ]; then
wait_for_wayland wait_for_wayland
COG_ENV="${COG_ENV} COG_PLATFORM_WL_VIEW_FULLSCREEN=1" COG_ENV="${COG_ENV} COG_PLATFORM_WL_VIEW_FULLSCREEN=1"
@ -84,7 +76,7 @@ case "$1" in
start start
;; ;;
stop) stop)
stop stop_process "${COG_BINARY}"
;; ;;
restart) restart)
$0 stop $0 stop

View File

@ -1,6 +1,6 @@
[Unit] [Unit]
Description=Initialization of the ConnectCore demo example Description=Initialization of the ConnectCore demo example
After=busybox-httpd.service After=connectcore-demo-server
# Make sure we are started after graphic service is available # Make sure we are started after graphic service is available
After=##WESTON_SERVICE## After=##WESTON_SERVICE##

View File

@ -9,19 +9,11 @@ LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
SRC_URI += " \ SRC_URI += " \
file://connectcore-demo-example-init \ file://connectcore-demo-server-init \
file://connectcore-demo-example.service \ file://connectcore-demo-server.service \
" "
WESTON_SERVICE ?= "weston.service" RDEPENDS:${PN}-server = " \
WESTON_SERVICE:ccmp15 ?= "weston-launch.service"
CC_DEMO_DISPLAY ?= "wayland-0"
CC_DEMO_DISPLAY:ccmp15 ?= "wayland-1"
CC_DEMO_ENV ?= "DISPLAY=:0.0 XDG_RUNTIME_DIR=/run/user/0 WAYLAND_DISPLAY=\${DEMO_DISPLAY}"
CC_DEMO_ENV:ccimx6ul ?= ""
RDEPENDS:${PN} = " \
busybox-httpd \ busybox-httpd \
libdigiapix-python3 \ libdigiapix-python3 \
mpg123 \ mpg123 \
@ -48,30 +40,54 @@ do_install() {
if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
# Install systemd unit files # Install systemd unit files
install -d ${D}${systemd_unitdir}/system install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/connectcore-demo-example.service ${D}${systemd_unitdir}/system/ install -m 0644 ${WORKDIR}/connectcore-demo-server.service ${D}${systemd_unitdir}/system/
sed -i -e "s,##WESTON_SERVICE##,${WESTON_SERVICE},g" \
"${D}${systemd_unitdir}/system/connectcore-demo-example.service"
fi fi
# Install connectcore-demo-example-init # Install connectcore-demo-server-init
install -d ${D}${sysconfdir}/init.d/ install -d ${D}${sysconfdir}/init.d/
install -m 755 ${WORKDIR}/connectcore-demo-example-init ${D}${sysconfdir}/connectcore-demo-example install -m 755 ${WORKDIR}/connectcore-demo-server-init ${D}${sysconfdir}/connectcore-demo-server
sed -i -e "s@##CC_DEMO_ENV##@${CC_DEMO_ENV}@g" \ ln -sf ${sysconfdir}/connectcore-demo-server ${D}${sysconfdir}/init.d/connectcore-demo-server
-e "s@##CC_DEMO_DISPLAY##@${CC_DEMO_DISPLAY}@g" \
"${D}${sysconfdir}/connectcore-demo-example"
ln -sf ${sysconfdir}/connectcore-demo-example ${D}${sysconfdir}/init.d/connectcore-demo-example
} }
PACKAGES =+ "${PN}-server ${PN}-multimedia"
FILES:${PN} += " \ FILES:${PN} += " \
/srv/www/* \ /srv/www/* \
${systemd_unitdir}/system/connectcore-demo-example.service \
${sysconfdir}/connectcore-demo-example \
${sysconfdir}/init.d/connectcore-demo-example \
" "
INITSCRIPT_NAME = "connectcore-demo-example" FILES:${PN}-multimedia += " \
INITSCRIPT_PARAMS = "start 19 2 3 4 5 . stop 21 0 1 6 ." /srv/www/multimedia* \
/srv/www/static/images/aquarium.jpg \
/srv/www/static/images/big_buck_bunny.jpg \
/srv/www/static/images/blob.jpg \
/srv/www/static/images/cpu.png \
/srv/www/static/images/electricflower.jpg \
/srv/www/static/images/multiple-views.jpg \
/srv/www/static/images/ram.png \
/srv/www/static/images/spacerocks.jpg \
/srv/www/static/images/toon-shading.jpg \
/srv/www/static/js/multimedia.js \
"
SYSTEMD_SERVICE:${PN} = "connectcore-demo-example.service" FILES:${PN}-server = " \
/srv/www/demoserver.py \
${systemd_unitdir}/system/connectcore-demo-server.service \
${sysconfdir}/connectcore-demo-server \
${sysconfdir}/init.d/connectcore-demo-server \
"
RDEPENDS:${PN} = "${PN}-server"
RDEPENDS:${PN}-multimedia = " \
${PN} \
video-examples \
webglsamples \
"
INITSCRIPT_PACKAGES = "${PN}-server"
INITSCRIPT_NAME:${PN}-server = "connectcore-demo-server"
INITSCRIPT_PARAMS:${PN}-server = "start 19 2 3 4 5 . stop 21 0 1 6 ."
SYSTEMD_PACKAGES = "${PN}-server"
SYSTEMD_SERVICE:${PN}-server = "connectcore-demo-server.service"
PACKAGE_ARCH = "${MACHINE_ARCH}" PACKAGE_ARCH = "${MACHINE_ARCH}"

View File

@ -1,11 +0,0 @@
[Unit]
Description=Initialization of the ConnectCore demo example
After=busybox-httpd.service
[Service]
Type=forking
ExecStart=/etc/connectcore-demo-example start
ExecStop=/etc/connectcore-demo-example stop
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=Initialization of ConnectCore demo server
After=busybox-httpd.service
[Service]
Type=forking
ExecStart=/etc/connectcore-demo-server start
ExecStop=/etc/connectcore-demo-server stop
[Install]
WantedBy=multi-user.target

View File

@ -1,4 +1,4 @@
# Copyright (C) 2013-2020, Digi International Inc. # Copyright (C) 2013-2023, Digi International Inc.
SUMMARY = "DEY examples packagegroup" SUMMARY = "DEY examples packagegroup"
@ -20,7 +20,7 @@ RDEPENDS:${PN} = "\
dey-examples-cloudconnector \ dey-examples-cloudconnector \
dey-examples-digiapix \ dey-examples-digiapix \
dey-examples-rtc \ dey-examples-rtc \
connectcore-demo-example \ connectcore-demo-example-multimedia \
" "
RDEPENDS:${PN}:append:ccimx6 = "\ RDEPENDS:${PN}:append:ccimx6 = "\
${@bb.utils.contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \ ${@bb.utils.contains("MACHINE_FEATURES", "accel-graphics", "dey-examples-opengles", "", d)} \