From 6f086f7c7ccb743003e583b0dbf65ee7f2f54eae Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 31 Jan 2019 10:26:47 +0100 Subject: aktualizr: drop duplicated file from FILES_${PN} "${bindir}/aktualizr-check-discovery" is being set in both FILES_${PN} and FILES_${PN}-tools, drop it from FILES_${PN}. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 1 - 1 file changed, 1 deletion(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index eb65ae0..b392de0 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -102,7 +102,6 @@ PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " FILES_${PN} = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ - ${bindir}/aktualizr-check-discovery \ ${systemd_unitdir}/system/aktualizr.service \ ${libdir}/sota/conf.d \ ${sysconfdir}/sota/conf.d \ -- cgit v1.2.3-54-g00ecf From 3217e9205c85d91be6a4e2ea13f7a30d4343f69f Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Thu, 31 Jan 2019 17:08:45 +0100 Subject: aktualizr: introduce PACKAGECONFIG There are several flaws in current aktualizr recipe: - It builds with 'BUILD_SYSTEMD=ON' by default but does not set DEPENDS to systemd, this is not leading to compilation errors so far because systemd is deployed into recipe sysroot by ostree if 'systemd' exists in DISTRO_FEATURES, but in other cases, it will cause compilation errors. - GARAGE_SIGN_SHA256 is being passed to EXTRA_OECMAKE even it's not set anythere, this will lead a wrong GARAGE_SIGN_SHA256_ARG to be set in cmake files. - pkgconfig is being called in aktualizr CMakeFile, so it needs inherit pkgconfig.bbclass To fix the above flaws, meanwhile to keep the code cleaner, we introduce PACKAGECONFIG to handle the configurations. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 44 +++++++++++++++------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index b392de0..8bd65da 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,16 +5,9 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" -DEPENDS = "boost curl openssl libarchive libsodium asn1c-native sqlite3 " -DEPENDS_append_class-target = "ostree ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', ' libp11', '', d)} " -DEPENDS_append_class-native = "glib-2.0-native " - -RDEPENDS_${PN}_class-target = "lshw " -RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', ' slcand-start', '', d)} " -RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' u-boot-fw-utils aktualizr-uboot-env-rollback', '', d)} " - -RDEPENDS_${PN}_append_class-target = " ${PN}-tools " -RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " +DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" +RDEPENDS_${PN}_class-target = "${PN}-tools lshw" +RDEPENDS_${PN}-secondary_class-target = "${PN}-tools" PV = "1.0+git${SRCPV}" PR = "7" @@ -32,9 +25,7 @@ BRANCH ?= "master" S = "${WORKDIR}/git" -inherit cmake - -inherit systemd +inherit pkgconfig cmake systemd SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" SYSTEMD_SERVICE_${PN} = "aktualizr.service" @@ -44,17 +35,22 @@ BBCLASSEXTEND =+ "native" require garage-sign-version.inc -EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \ - -DCMAKE_BUILD_TYPE=Release \ - -DAKTUALIZR_VERSION=${PV} \ - -DBUILD_LOAD_TESTS=OFF" -EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON \ - ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " -EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON \ - -DBUILD_OSTREE=OFF \ - -DBUILD_SYSTEMD=OFF \ - -DGARAGE_SIGN_VERSION=${GARAGE_SIGN_VERSION} \ - -DGARAGE_SIGN_SHA256=${GARAGE_SIGN_SHA256}" +EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" + +GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ + ${@ '-DGARAGE_SIGN_SHA256=%s' % d.getVar('GARAGE_SIGN_SHA256') if d.getVar('GARAGE_SIGN_SHA256') is not None else ''} \ + " + +PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}" +PACKAGECONFIG_class-native = "sota-tools" +PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF," +PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree," +PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11," +PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0," +PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd," +PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF," +PACKAGECONFIG[serialcan] = ",,,slcand-start" +PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" do_install_append () { install -d ${D}${libdir}/sota -- cgit v1.2.3-54-g00ecf From 7ec1ffc436e8725e40e1853d084054b554929041 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Sun, 3 Feb 2019 13:12:29 +0100 Subject: aktualizr: split binaries to their own packages This patch mainly aims to fix the following issues: - ${libdir}/sota/conf.d is being put into aktualizr package, but ${libdir}/sota/*.toml is being put into aktualizr-host-tools, this does not make sense, if a end user only install aktualizr-host-tools to a target, he will miss the config files in ${libdir}/sota/conf.d. - A user should be able to install garage-deploy garage-push to a board if he wants to do that by choosing building aktualizr with sota-tools, but now it's not in that case, garage-deploy garage-push are only available for native. - It's not necessary to distinguish native/target when installing systemd services, they will be dropped by sstate from native sysroot any way. - It would be better that all binaries to be put into their own packages, so a end user can choose to install a package only with one binary, rather than having to install the entire aktualizr-host-tools. Introduce per-binary based packages for host tools, and gather all config files to aktualizr-configs, it will be depended by binary packages and main aktualizr package. Signed-off-by: Ming Liu --- recipes-sota/aktualizr/aktualizr_git.bb | 61 ++++++++++++++++----------------- 1 file changed, 29 insertions(+), 32 deletions(-) diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 8bd65da..fbc1bca 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb @@ -5,9 +5,12 @@ SECTION = "base" LICENSE = "MPL-2.0" LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" +require garage-sign-version.inc + DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" -RDEPENDS_${PN}_class-target = "${PN}-tools lshw" -RDEPENDS_${PN}-secondary_class-target = "${PN}-tools" +RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" +RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" +RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" PV = "1.0+git${SRCPV}" PR = "7" @@ -31,10 +34,6 @@ SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" SYSTEMD_SERVICE_${PN} = "aktualizr.service" SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" -BBCLASSEXTEND =+ "native" - -require garage-sign-version.inc - EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" GARAGE_SIGN_OPS = "${@ '-DGARAGE_SIGN_VERSION=%s' % d.getVar('GARAGE_SIGN_VERSION') if d.getVar('GARAGE_SIGN_VERSION') is not None else ''} \ @@ -80,48 +79,45 @@ do_install_append () { fi fi -} - -do_install_append_class-target () { install -m 0755 -d ${D}${systemd_unitdir}/system aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)} install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service + + if ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'true', 'false', d)}; then + install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} + install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} + fi } -do_install_append_class-native () { - install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} - install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} +PACKAGESPLITFUNCS_prepend = "split_hosttools_packages " + +python split_hosttools_packages () { + bindir = d.getVar('bindir') + + # Split all binaries to their own packages except aktualizr-info, + # aktualizr-info should stay in main package aktualizr. + do_split_packages(d, bindir, r'^((?!(aktualizr-info)).*)$', '%s', 'Aktualizr tool - %s', extra_depends='aktualizr-configs', prepend=False) } -PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " +PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*" + +PACKAGES =+ "${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools" + +ALLOW_EMPTY_${PN}-host-tools = "1" FILES_${PN} = " \ ${bindir}/aktualizr \ ${bindir}/aktualizr-info \ ${systemd_unitdir}/system/aktualizr.service \ - ${libdir}/sota/conf.d \ - ${sysconfdir}/sota/conf.d \ - ${sysconfdir}/sota/ecus/* \ " -FILES_${PN}-examples = " \ - ${bindir}/hmi-stub \ +FILES_${PN}-configs = " \ + ${sysconfdir}/sota/* \ + ${libdir}/sota/* \ " -FILES_${PN}-host-tools = " \ - ${bindir}/aktualizr-repo \ - ${bindir}/aktualizr-cert-provider \ - ${bindir}/garage-deploy \ - ${bindir}/garage-push \ - ${libdir}/sota/sota_autoprov.toml \ - ${libdir}/sota/sota_autoprov_primary.toml \ - ${libdir}/sota/sota_hsm_prov.toml \ - ${libdir}/sota/sota_implicit_prov_ca.toml \ - ${libdir}/sota/sota_uboot_env.toml \ - " - -FILES_${PN}-tools = " \ - ${bindir}/aktualizr-check-discovery \ +FILES_${PN}-examples = " \ + ${bindir}/hmi-stub \ " FILES_${PN}-secondary = " \ @@ -130,5 +126,6 @@ FILES_${PN}-secondary = " \ ${systemd_unitdir}/system/aktualizr-secondary.socket \ ${systemd_unitdir}/system/aktualizr-secondary.service \ " +BBCLASSEXTEND = "native" # vim:set ts=4 sw=4 sts=4 expandtab: -- cgit v1.2.3-54-g00ecf