summaryrefslogtreecommitdiffstats
path: root/recipes-sota/aktualizr
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-sota/aktualizr')
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb34
-rwxr-xr-xrecipes-sota/aktualizr/files/run-ptest16
2 files changed, 47 insertions, 3 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 97f784f..49c4e5e 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -6,10 +6,13 @@ LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3" 6LIC_FILES_CHKSUM = "file://${S}/LICENSE;md5=9741c346eef56131163e13b9db1241b3"
7 7
8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native" 8DEPENDS = "boost curl openssl libarchive libsodium sqlite3 asn1c-native"
9DEPENDS_append = "${@bb.utils.contains('PTEST_ENABLED', '1', ' coreutils-native ostree-native aktualizr-native ', '', d)}"
9RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw" 10RDEPENDS_${PN}_class-target = "aktualizr-check-discovery aktualizr-configs lshw"
10RDEPENDS_${PN}-secondary = "aktualizr-check-discovery" 11RDEPENDS_${PN}-secondary = "aktualizr-check-discovery"
11RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}" 12RDEPENDS_${PN}-host-tools = "aktualizr aktualizr-repo aktualizr-cert-provider ${@bb.utils.contains('PACKAGECONFIG', 'sota-tools', 'garage-deploy garage-push', '', d)}"
12 13
14RDEPENDS_${PN}-ptest += "bash cmake curl python3-modules sqlite3 valgrind"
15
13PV = "1.0+git${SRCPV}" 16PV = "1.0+git${SRCPV}"
14PR = "7" 17PR = "7"
15 18
@@ -17,6 +20,7 @@ GARAGE_SIGN_PV = "0.6.0-3-gc38b9f3"
17 20
18SRC_URI = " \ 21SRC_URI = " \
19 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \ 22 gitsm://github.com/advancedtelematic/aktualizr;branch=${BRANCH} \
23 file://run-ptest \
20 file://aktualizr.service \ 24 file://aktualizr.service \
21 file://aktualizr-secondary.service \ 25 file://aktualizr-secondary.service \
22 file://aktualizr-secondary.socket \ 26 file://aktualizr-secondary.socket \
@@ -28,18 +32,22 @@ SRC_URI = " \
28SRC_URI[md5sum] = "30d7f0931e2236954679e75d1bae174f" 32SRC_URI[md5sum] = "30d7f0931e2236954679e75d1bae174f"
29SRC_URI[sha256sum] = "46d8c6448ce14cbb9af6a93eba7e29d38579e566dcd6518d22f723a8da16cad5" 33SRC_URI[sha256sum] = "46d8c6448ce14cbb9af6a93eba7e29d38579e566dcd6518d22f723a8da16cad5"
30 34
31SRCREV = "ea03a5cf57def6b8d368f783cb12b91255365a80" 35SRCREV = "2e3ccbbdd43fdf70eb815454ea64f0bd8085856c"
32BRANCH ?= "master" 36BRANCH ?= "master"
33 37
34S = "${WORKDIR}/git" 38S = "${WORKDIR}/git"
35 39
36inherit pkgconfig cmake systemd 40inherit cmake pkgconfig ptest systemd
41
42# disable ptest by default as it slows down builds quite a lot
43# can be enabled manually by setting 'PTEST_ENABLED_pn-aktualizr' to '1' in local.conf
44PTEST_ENABLED = "0"
37 45
38SYSTEMD_PACKAGES = "${PN} ${PN}-secondary" 46SYSTEMD_PACKAGES = "${PN} ${PN}-secondary"
39SYSTEMD_SERVICE_${PN} = "aktualizr.service" 47SYSTEMD_SERVICE_${PN} = "aktualizr.service"
40SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" 48SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket"
41 49
42EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV}" 50EXTRA_OECMAKE = "-DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} ${@bb.utils.contains('PTEST_ENABLED', '1', '-DTESTSUITE_VALGRIND=on', '', d)}"
43 51
44GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}" 52GARAGE_SIGN_OPS = "${@ d.expand('-DGARAGE_SIGN_ARCHIVE=${WORKDIR}/cli-${GARAGE_SIGN_PV}.tgz') if d.getVar('GARAGE_SIGN_AUTOVERSION') != '1' else ''}"
45 53
@@ -54,6 +62,26 @@ PACKAGECONFIG[load-tests] = "-DBUILD_LOAD_TESTS=ON,-DBUILD_LOAD_TESTS=OFF,"
54PACKAGECONFIG[serialcan] = ",,,slcand-start" 62PACKAGECONFIG[serialcan] = ",,,slcand-start"
55PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback" 63PACKAGECONFIG[ubootenv] = ",,,u-boot-fw-utils aktualizr-uboot-env-rollback"
56 64
65do_compile_ptest() {
66 cmake_runcmake_build --target build_tests
67}
68
69do_install_ptest() {
70 # copy the complete source directory (contains build)
71 cp -r ${B}/ ${D}/${PTEST_PATH}/build
72 cp -r ${S}/ ${D}/${PTEST_PATH}/src
73
74 # remove huge external unused repository
75 rm -rf ${D}/${PTEST_PATH}/src/partial/extern/RIOT
76
77 # remove huge build artifacts
78 find ${D}/${PTEST_PATH}/build/src -name "*.a" -delete
79
80 # fix the absolute paths
81 find ${D}/${PTEST_PATH}/build -name "CMakeFiles" | xargs rm -rf
82 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
83}
84
57do_install_append () { 85do_install_append () {
58 install -d ${D}${libdir}/sota 86 install -d ${D}${libdir}/sota
59 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml 87 install -m 0644 ${S}/config/sota_autoprov.toml ${D}/${libdir}/sota/sota_autoprov.toml
diff --git a/recipes-sota/aktualizr/files/run-ptest b/recipes-sota/aktualizr/files/run-ptest
new file mode 100755
index 0000000..e5f0d56
--- /dev/null
+++ b/recipes-sota/aktualizr/files/run-ptest
@@ -0,0 +1,16 @@
1#!/bin/sh
2
3set -e
4
5filter_logs() {
6 awk '/^.*Test[[:space:]]*#[[:digit:]]+:/ {
7 a = gensub(/^.*Test[[:space:]]*#[[:digit:]]+:[[:space:]]*([^[:space:]]+).*(Passed|Skipped|Not Run|Failed|Timeout|Exception)[[:space:]:].*$/, "\\2: \\1", "g");
8 a = gensub(/^Passed/, "PASS", "g", a);
9 a = gensub(/^(Skipped|Disabled)/, "SKIP", "g", a);
10 a = gensub(/^(Not Run|Failed|Timeout|Exception)/, "FAIL", "g", a);
11 print a;
12 }'
13}
14
15cd build
16ctest -j 8 -O /tmp/aktualizr-ptest.log --output-on-failure -LE 'noptest' 2> /dev/null | filter_logs