From 8b090ed1713f166bbdd9e00c7073a9b664178351 Mon Sep 17 00:00:00 2001 From: Stoyan Lachev Date: Fri, 2 Dec 2022 13:45:39 +0000 Subject: [PATCH 1/3] a bbclass and bb file added Signed-off-by: Stoyan Lachev --- .../classes/kanto-auto-deployer.bbclass | 14 ++++++++++ .../files/kanto-auto-deployer.service | 2 ++ .../eclipse-leda/kanto-auto-deployer.inc | 10 +++---- .../eclipse-leda/kanto-auto-deployer_git.bb | 4 +-- .../eclipse-leda/sdv-default-containers.bb | 28 +++++++++++++++++++ .../packagegroup-sdv-additions.bb | 3 +- 6 files changed, 53 insertions(+), 8 deletions(-) create mode 100644 meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass create mode 100644 meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass b/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass new file mode 100644 index 00000000..2fa0fa94 --- /dev/null +++ b/meta-leda-components/recipes-sdv/eclipse-leda/classes/kanto-auto-deployer.bbclass @@ -0,0 +1,14 @@ +# /******************************************************************************** +# * Copyright (c) 2022 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# +KANTO_MANIFESTS_DIR ??= "/var/containers/manifests" diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service index 9e3cedd4..881ee516 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service +++ b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service @@ -21,4 +21,6 @@ Requires=container-management.service WantedBy=multi-user.target [Service] +Restart=on-failure +RestartSec=5s ExecStart=/usr/bin/kanto-auto-deployer /var/containers/manifests diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc index dbed1d37..ca2bb63f 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc @@ -17,11 +17,11 @@ FILES:${PN} += "${bindir}/kanto-auto-deployer" FILES:${PN} += "${systemd_unitdir}/system/kanto-auto-deployer.service" #containers -FILES:${PN} += "/var/containers/manifests/databroker.json" +#FILES:${PN} += "${KANTO_MANIFESTS_DIR}/databroker.json" do_install:append() { cargo_do_install - install_containers + install_service } cargo_do_install () { @@ -59,13 +59,13 @@ cargo_do_install () { } -install_containers() { +install_service() { install -d ${D}${systemd_unitdir}/system install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service ${D}${systemd_unitdir}/system - install -d ${D}/var/containers/manifests + install -d ${D}${KANTO_MANIFESTS_DIR} #containers - install ${THISDIR}/kanto-containers/databroker.json ${D}/var/containers/manifests + #install ${THISDIR}/kanto-containers/databroker.json ${D}${KANTO_MANIFESTS_DIR} } diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb index 114d1703..905c21f6 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer_git.bb @@ -21,10 +21,10 @@ SYSTEMD_SERVICE:${PN} = "${@bb.utils.contains('DISTRO_FEATURES','systemd','kanto PROVIDES:${PN} += "kanto-auto-deployer" RPROVIDES:${PN} += "kanto-auto-deployer" -inherit cargo +inherit cargo kanto-auto-deployer RDEPENDS_${PN} += " grpc protobuf nativesdk-protobuf" -DEPENDS += " protobuf protobuf-native grpc" +DEPENDS += " protobuf protobuf-native grpc git-native" SRCREV = "1a7ccb4d37c6ca6bbfce2d915c31aa4478623791" PV:append = ".AUTOINC+1a7ccb4d37" diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb b/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb new file mode 100644 index 00000000..0ee4ce1c --- /dev/null +++ b/meta-leda-components/recipes-sdv/eclipse-leda/sdv-default-containers.bb @@ -0,0 +1,28 @@ +# /******************************************************************************** +# * Copyright (c) 2022 Contributors to the Eclipse Foundation +# * +# * See the NOTICE file(s) distributed with this work for additional +# * information regarding copyright ownership. +# * +# * This program and the accompanying materials are made available under the +# * terms of the Apache License 2.0 which is available at +# * https://www.apache.org/licenses/LICENSE-2.0 +# * +# * SPDX-License-Identifier: Apache-2.0 +# ********************************************************************************/ +# +inherit kanto-auto-deployer + +DESCRIPTION = "Kanto Default Containers" +SRC_URI += "file://LICENSE" +LICENSE = "Apache-2.0" +LIC_FILES_CHKSUM = "file://${WORKDIR}/LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" + +do_install:append() { + install -d ${D}${KANTO_MANIFESTS_DIR} + install ${THISDIR}/kanto-containers/databroker.json ${D}${KANTO_MANIFESTS_DIR} +} + +PACKAGES = "${PN}" +FILES:${PN} += "${KANTO_MANIFESTS_DIR}/databroker.json" + diff --git a/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb b/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb index cbb62562..ad4e5d13 100644 --- a/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb +++ b/meta-leda-components/recipes-sdv/packagegroups/packagegroup-sdv-additions.bb @@ -25,4 +25,5 @@ RDEPENDS:${PN} = "\ system-metrics \ rauc-hawkbit-updater \ kanto-auto-deployer \ - " \ No newline at end of file + sdv-default-containers \ +" \ No newline at end of file From 3030c7f5761480e733c6614792aed7ebff5f8763 Mon Sep 17 00:00:00 2001 From: Stoyan Lachev Date: Fri, 2 Dec 2022 14:12:57 +0000 Subject: [PATCH 2/3] Coments removed Signed-off-by: Stoyan Lachev --- .../recipes-sdv/eclipse-leda/kanto-auto-deployer.inc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc index ca2bb63f..263408c4 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc @@ -16,9 +16,6 @@ PACKAGES = "${PN}" FILES:${PN} += "${bindir}/kanto-auto-deployer" FILES:${PN} += "${systemd_unitdir}/system/kanto-auto-deployer.service" -#containers -#FILES:${PN} += "${KANTO_MANIFESTS_DIR}/databroker.json" - do_install:append() { cargo_do_install install_service @@ -63,9 +60,6 @@ install_service() { install -d ${D}${systemd_unitdir}/system install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service ${D}${systemd_unitdir}/system install -d ${D}${KANTO_MANIFESTS_DIR} - - #containers - #install ${THISDIR}/kanto-containers/databroker.json ${D}${KANTO_MANIFESTS_DIR} } From 6eeb0f7aaf4545c8dbcda4c7e019cdb2f49fd740 Mon Sep 17 00:00:00 2001 From: Stoyan Lachev Date: Fri, 2 Dec 2022 15:05:34 +0000 Subject: [PATCH 3/3] Added service template Signed-off-by: Stoyan Lachev --- ....service => kanto-auto-deployer.service.template} | 2 +- .../recipes-sdv/eclipse-leda/kanto-auto-deployer.inc | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) rename meta-leda-components/recipes-sdv/eclipse-leda/files/{kanto-auto-deployer.service => kanto-auto-deployer.service.template} (93%) diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template similarity index 93% rename from meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service rename to meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template index 881ee516..64a6e272 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service +++ b/meta-leda-components/recipes-sdv/eclipse-leda/files/kanto-auto-deployer.service.template @@ -23,4 +23,4 @@ WantedBy=multi-user.target [Service] Restart=on-failure RestartSec=5s -ExecStart=/usr/bin/kanto-auto-deployer /var/containers/manifests +ExecStart=@KD_BIN_DD@/kanto-auto-deployer @KD_CFG_DD@ diff --git a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc index 263408c4..36730d6f 100644 --- a/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc +++ b/meta-leda-components/recipes-sdv/eclipse-leda/kanto-auto-deployer.inc @@ -56,9 +56,17 @@ cargo_do_install () { } +KANTO_SERVICE_DIR = "${systemd_unitdir}/system" + install_service() { - install -d ${D}${systemd_unitdir}/system - install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service ${D}${systemd_unitdir}/system + install -d ${D}${KANTO_SERVICE_DIR} + install -m 0644 ${THISDIR}/files/kanto-auto-deployer.service.template ${D}${KANTO_SERVICE_DIR}/kanto-auto-deployer.service + + # fill in the kanto auto deployer service template with the result configurations + sed -e 's,@KD_BIN_DD@,${bindir},g' \ + -e 's,@KD_CFG_DD@,${KANTO_MANIFESTS_DIR},g' \ + -i ${D}${KANTO_SERVICE_DIR}/kanto-auto-deployer.service + install -d ${D}${KANTO_MANIFESTS_DIR} }