summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Bonnans <laurent.bonnans@here.com>2019-10-15 12:07:44 +0200
committerLaurent Bonnans <laurent.bonnans@here.com>2019-10-15 12:07:44 +0200
commit083927b11d44ba386882094c6ee260a22ce9e03d (patch)
treefb6e38db355b6cf44fe8f313ce1abb674bac16e6
parenta1f2ccf986e844e130ecc6ae61d2b6fc3632e2f8 (diff)
downloadmeta-updater-clean/aktualizr-real-rls.tar.gz
split aktualizr recipeclean/aktualizr-real-rls
-rw-r--r--recipes-sota/aktualizr/aktualizr.inc161
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb163
2 files changed, 164 insertions, 160 deletions
diff --git a/recipes-sota/aktualizr/aktualizr.inc b/recipes-sota/aktualizr/aktualizr.inc
new file mode 100644
index 0000000..f88c37b
--- /dev/null
+++ b/recipes-sota/aktualizr/aktualizr.inc
@@ -0,0 +1,161 @@
1SUMMARY = "Aktualizr SOTA Client"
2DESCRIPTION = "SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7
8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native"
9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native net-tools-native ostree-native aktualizr-native ', '', d)}"
10RDEPENDS_${PN}_class-target = "aktualizr-configs lshw"
11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}"
12
13RDEPENDS_${PN}-ptest += "bash cmake curl net-tools python3-core python3-misc python3-modules openssl-bin sqlite3 valgrind"
14
15
16SRC_URI = " \
17 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
18 file://run-ptest \
19 file://aktualizr.service \
20 file://aktualizr-secondary.service \
21 file://aktualizr-serialcan.service \
22 file://10-resource-control.conf \
23 ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \
24 "
25
26
27S = "${WORKDIR}/git"
28
29inherit cmake pkgconfig ptest systemd
30
31# disable ptest by default as it slows down builds quite a lot
32# can be enabled manually by setting 'PTEST_ENABLED_pn-aktualizr' to '1' in local.conf
33PTEST_ENABLED = "0"
34
35SYSTEMD_PACKAGES = "${PN} ${PN}-secondary"
36SYSTEMD_SERVICE_${PN} = "aktualizr.service"
37SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.service"
38
39EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}"
40
41GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}"
42
43PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}"
44PACKAGECONFIG_class-native = "sota-tools"
45PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF,"
46PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree,"
47PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11,"
48PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0,"
49PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd,"
50PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF,"
51PACKAGECONFIG[serialcan] = ",,,slcand-start"
52PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback"
53
54# can be overriden in configuration with `RESOURCE_xxx_pn-aktualizr`
55# see `man systemd.resource-control` for details
56
57# can be used to lower aktualizr priority, default is 100
58RESOURCE_CPU_WEIGHT = "100"
59# will be slowed down when it reaches 'high', killed when it reaches 'max'
60RESOURCE_MEMORY_HIGH = "100M"
61RESOURCE_MEMORY_MAX = "80%"
62
63do_compile_ptest() {
64 cmake_runcmake_build --target build_tests "${PARALLEL_MAKE}"
65}
66
67do_install_ptest() {
68 # copy the complete source directory (contains build)
69 cp -r ${B}/ ${D}/${PTEST_PATH}/build
70 cp -r ${S}/ ${D}/${PTEST_PATH}/src
71
72 # remove huge external unused repository
73 rm -rf ${D}/${PTEST_PATH}/src/partial/extern/RIOT
74
75 # remove huge build artifacts
76 find ${D}/${PTEST_PATH}/build/src -name "*.a" -delete
77
78 # fix the absolute paths
79 find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf
80 find ${D}/${PTEST_PATH}/build -name "*.cmake" -or -name "DartConfiguration.tcl" -or -name "run-valgrind" | xargs sed -e "s|${S}|${PTEST_PATH}/src|g" -e "s|${B}|${PTEST_PATH}/build|g" -e "s|\"--gtest_output[^\"]*\"||g" -i
81}
82
83do_install_append () {
84 install -d ${D}${libdir}/sota
85 install -m 0644 ${S}/config/sota-shared-cred.toml ${D}/${libdir}/sota/sota-shared-cred.toml
86 install -m 0644 ${S}/config/sota-device-cred-hsm.toml ${D}/${libdir}/sota/sota-device-cred-hsm.toml
87 install -m 0644 ${S}/config/sota-device-cred.toml ${D}/${libdir}/sota/sota-device-cred.toml
88 install -m 0644 ${S}/config/sota-secondary.toml ${D}/${libdir}/sota/sota-secondary.toml
89 install -m 0644 ${S}/config/sota-uboot-env.toml ${D}/${libdir}/sota/sota-uboot-env.toml
90 install -d ${D}${systemd_unitdir}/system
91 install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service
92 install -m 0700 -d ${D}${libdir}/sota/conf.d
93 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d
94
95 if [ -n "${SOTA_HARDWARE_ID}" ]; then
96 printf "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
97 fi
98
99 install -m 0755 -d ${D}${systemd_unitdir}/system
100 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)}
101 install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service
102
103 if ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'true', 'false', d)}; then
104 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir}
105 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir}
106 fi
107
108 # resource control
109 install -d ${D}/${systemd_system_unitdir}/aktualizr.service.d
110 install -m 0644 ${WORKDIR}/10-resource-control.conf ${D}/${systemd_system_unitdir}/aktualizr.service.d
111
112 sed -i -e 's|@CPU_WEIGHT@|${RESOURCE_CPU_WEIGHT}|g' \
113 -e 's|@MEMORY_HIGH@|${RESOURCE_MEMORY_HIGH}|g' \
114 -e 's|@MEMORY_MAX@|${RESOURCE_MEMORY_MAX}|g' \
115 ${D}${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf
116}
117
118PACKAGESPLITFUNCS_prepend = "split_hosttools_packages "
119
120python split_hosttools_packages () {
121 bindir = d.getVar('bindir')
122
123 # Split all binaries to their own packages except aktualizr-info,
124 # aktualizr-info should stay in main package aktualizr.
125 do_split_packages(d, bindir, r'^((?!(aktualizr-info)).*)$', '%s', 'Aktualizr tool - %s', extra_depends='aktualizr-configs', prepend=False)
126}
127
128PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*"
129
130PACKAGES =+ "${PN}-resource-control ${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools"
131
132ALLOW_EMPTY_${PN}-host-tools = "1"
133
134FILES_${PN} = " \
135 ${bindir}/aktualizr \
136 ${bindir}/aktualizr-info \
137 ${systemd_unitdir}/system/aktualizr.service \
138 "
139
140FILES_${PN}-resource-control = " \
141 ${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf \
142 "
143
144FILES_${PN}-configs = " \
145 ${sysconfdir}/sota/* \
146 ${libdir}/sota/* \
147 "
148
149FILES_${PN}-examples = " \
150 ${bindir}/hmi-stub \
151 "
152
153FILES_${PN}-secondary = " \
154 ${bindir}/aktualizr-secondary \
155 ${libdir}/sota/sota-secondary.toml \
156 ${systemd_unitdir}/system/aktualizr-secondary.service \
157 "
158
159BBCLASSEXTEND = "native"
160
161# vim:set ts=4 sw=4 sts=4 expandtab:
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index e4c9be8..42548c8 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -1,33 +1,10 @@
1SUMMARY = "Aktualizr SOTA Client" 1require aktualizr.inc
2DESCRIPTION = "SOTA Client application written in C++"
3HOMEPAGE = "https://github.com/advancedtelematic/aktualizr"
4SECTION = "base"
5LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7
8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native"
9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native net-tools-native ostree-native aktualizr-native ', '', d)}"
10RDEPENDS_${PN}_class-target = "aktualizr-configs lshw"
11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}"
12
13RDEPENDS_${PN}-ptest += "bash cmake curl net-tools python3-core python3-misc python3-modules openssl-bin sqlite3 valgrind"
14 2
15PV = "1.0+git${SRCPV}" 3PV = "1.0+git${SRCPV}"
16PR = "7" 4PR = "8"
17
18GARAGE_SIGN_PV = "0.7.0-33-g214dfb1"
19
20SRC_URI = " \
21 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
22 file://run-ptest \
23 file://aktualizr.service \
24 file://aktualizr-secondary.service \
25 file://aktualizr-serialcan.service \
26 file://10-resource-control.conf \
27 ${@ d.expand("https://ats-tuf-cli-releases.s3-eu-central-1.amazonaws.com/cli-${GARAGE_SIGN_PV}.tgz;unpack=0") if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''} \
28 "
29 5
30# for garage-sign archive 6# for garage-sign archive
7GARAGE_SIGN_PV = "0.7.0-33-g214dfb1"
31SRC_URI[md5sum] = "66ffe8dcd61d4c15646e1c4b7dde7401" 8SRC_URI[md5sum] = "66ffe8dcd61d4c15646e1c4b7dde7401"
32SRC_URI[sha256sum] = "7a7193ddf7e1a33ea60fbb20f98318a8bd78c325dab391d8c4ebd644a738abdc" 9SRC_URI[sha256sum] = "7a7193ddf7e1a33ea60fbb20f98318a8bd78c325dab391d8c4ebd644a738abdc"
33 10
@@ -35,137 +12,3 @@ SRCREV = "d13ff1ceeca2694b982287740aca8f58edad514d"
35BRANCH ?= "master" 12BRANCH ?= "master"
36 13
37S = "${WORKDIR}/git" 14S = "${WORKDIR}/git"
38
39inherit cmake pkgconfig ptest systemd
40
41# disable ptest by default as it slows down builds quite a lot
42# can be enabled manually by setting 'PTEST_ENABLED_pn-aktualizr' to '1' in local.conf
43PTEST_ENABLED = "0"
44
45SYSTEMD_PACKAGES = "${PN} ${PN}-secondary"
46SYSTEMD_SERVICE_${PN} = "aktualizr.service"
47SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.service"
48
49EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}"
50
51GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}"
52
53PACKAGECONFIG ?= "ostree ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} ${@bb.utils.filter('SOTA_CLIENT_FEATURES', 'hsm serialcan ubootenv', d)}"
54PACKAGECONFIG_class-native = "sota-tools"
55PACKAGECONFIG[warning-as-error] = "-DWARNING_AS_ERROR=ON,-DWARNING_AS_ERROR=OFF,"
56PACKAGECONFIG[ostree] = "-DBUILD_OSTREE=ON,-DBUILD_OSTREE=OFF,ostree,"
57PACKAGECONFIG[hsm] = "-DBUILD_P11=ON,-DBUILD_P11=OFF,libp11,"
58PACKAGECONFIG[sota-tools] = "-DBUILD_SOTA_TOOLS=ON ${GARAGE_SIGN_OPS},-DBUILD_SOTA_TOOLS=OFF,glib-2.0,"
59PACKAGECONFIG[systemd] = "-DBUILD_SYSTEMD=ON,-DBUILD_SYSTEMD=OFF,systemd,"
60PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF,"
61PACKAGECONFIG[serialcan] = ",,,slcand-start"
62PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback"
63
64# can be overriden in configuration with `RESOURCE_xxx_pn-aktualizr`
65# see `man systemd.resource-control` for details
66
67# can be used to lower aktualizr priority, default is 100
68RESOURCE_CPU_WEIGHT = "100"
69# will be slowed down when it reaches 'high', killed when it reaches 'max'
70RESOURCE_MEMORY_HIGH = "100M"
71RESOURCE_MEMORY_MAX = "80%"
72
73do_compile_ptest() {
74 cmake_runcmake_build --target build_tests "${PARALLEL_MAKE}"
75}
76
77do_install_ptest() {
78 # copy the complete source directory (contains build)
79 cp -r ${B}/ ${D}/${PTEST_PATH}/build
80 cp -r ${S}/ ${D}/${PTEST_PATH}/src
81
82 # remove huge external unused repository
83 rm -rf ${D}/${PTEST_PATH}/src/partial/extern/RIOT
84
85 # remove huge build artifacts
86 find ${D}/${PTEST_PATH}/build/src -name "*.a" -delete
87
88 # fix the absolute paths
89 find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf
90 find ${D}/${PTEST_PATH}/build -name "*.cmake" -or -name "DartConfiguration.tcl" -or -name "run-valgrind" | xargs sed -e "s|${S}|${PTEST_PATH}/src|g" -e "s|${B}|${PTEST_PATH}/build|g" -e "s|\"--gtest_output[^\"]*\"||g" -i
91}
92
93do_install_append () {
94 install -d ${D}${libdir}/sota
95 install -m 0644 ${S}/config/sota-shared-cred.toml ${D}/${libdir}/sota/sota-shared-cred.toml
96 install -m 0644 ${S}/config/sota-device-cred-hsm.toml ${D}/${libdir}/sota/sota-device-cred-hsm.toml
97 install -m 0644 ${S}/config/sota-device-cred.toml ${D}/${libdir}/sota/sota-device-cred.toml
98 install -m 0644 ${S}/config/sota-secondary.toml ${D}/${libdir}/sota/sota-secondary.toml
99 install -m 0644 ${S}/config/sota-uboot-env.toml ${D}/${libdir}/sota/sota-uboot-env.toml
100 install -d ${D}${systemd_unitdir}/system
101 install -m 0644 ${WORKDIR}/aktualizr-secondary.service ${D}${systemd_unitdir}/system/aktualizr-secondary.service
102 install -m 0700 -d ${D}${libdir}/sota/conf.d
103 install -m 0700 -d ${D}${sysconfdir}/sota/conf.d
104
105 if [ -n "${SOTA_HARDWARE_ID}" ]; then
106 printf "[provision]\nprimary_ecu_hardware_id = ${SOTA_HARDWARE_ID}\n" > ${D}${libdir}/sota/conf.d/40-hardware-id.toml
107 fi
108
109 install -m 0755 -d ${D}${systemd_unitdir}/system
110 aktualizr_service=${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'serialcan', '${WORKDIR}/aktualizr-serialcan.service', '${WORKDIR}/aktualizr.service', d)}
111 install -m 0644 ${aktualizr_service} ${D}${systemd_unitdir}/system/aktualizr.service
112
113 if ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'true', 'false', d)}; then
114 install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir}
115 install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir}
116 fi
117
118 # resource control
119 install -d ${D}/${systemd_system_unitdir}/aktualizr.service.d
120 install -m 0644 ${WORKDIR}/10-resource-control.conf ${D}/${systemd_system_unitdir}/aktualizr.service.d
121
122 sed -i -e 's|@CPU_WEIGHT@|${RESOURCE_CPU_WEIGHT}|g' \
123 -e 's|@MEMORY_HIGH@|${RESOURCE_MEMORY_HIGH}|g' \
124 -e 's|@MEMORY_MAX@|${RESOURCE_MEMORY_MAX}|g' \
125 ${D}${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf
126}
127
128PACKAGESPLITFUNCS_prepend = "split_hosttools_packages "
129
130python split_hosttools_packages () {
131 bindir = d.getVar('bindir')
132
133 # Split all binaries to their own packages except aktualizr-info,
134 # aktualizr-info should stay in main package aktualizr.
135 do_split_packages(d, bindir, r'^((?!(aktualizr-info)).*)$', '%s', 'Aktualizr tool - %s', extra_depends='aktualizr-configs', prepend=False)
136}
137
138PACKAGES_DYNAMIC = "^aktualizr-.* ^garage-.*"
139
140PACKAGES =+ "${PN}-resource-control ${PN}-examples ${PN}-secondary ${PN}-configs ${PN}-host-tools"
141
142ALLOW_EMPTY_${PN}-host-tools = "1"
143
144FILES_${PN} = " \
145 ${bindir}/aktualizr \
146 ${bindir}/aktualizr-info \
147 ${systemd_unitdir}/system/aktualizr.service \
148 "
149
150FILES_${PN}-resource-control = " \
151 ${systemd_system_unitdir}/aktualizr.service.d/10-resource-control.conf \
152 "
153
154FILES_${PN}-configs = " \
155 ${sysconfdir}/sota/* \
156 ${libdir}/sota/* \
157 "
158
159FILES_${PN}-examples = " \
160 ${bindir}/hmi-stub \
161 "
162
163FILES_${PN}-secondary = " \
164 ${bindir}/aktualizr-secondary \
165 ${libdir}/sota/sota-secondary.toml \
166 ${systemd_unitdir}/system/aktualizr-secondary.service \
167 "
168
169BBCLASSEXTEND = "native"
170
171# vim:set ts=4 sw=4 sts=4 expandtab: