diff options
author | Anton Gerasimov <anton@advancedtelematic.com> | 2018-04-20 14:29:21 +0200 |
---|---|---|
committer | Laurent Bonnans <laurent.bonnans@here.com> | 2018-04-23 17:10:28 +0200 |
commit | f3b670dda20e903b3c23628f480c733abcafdd8a (patch) | |
tree | 9a39ab040323d7f7345461c7982e894d439c3334 | |
parent | bef28641031578e09a31addc74ba0aa07f44ffe9 (diff) | |
download | meta-updater-f3b670dda20e903b3c23628f480c733abcafdd8a.tar.gz |
Backport GARAGE_SIGN_VERSION variable from rocko
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 5 | ||||
-rw-r--r-- | recipes-sota/aktualizr/garage-sign-version.inc | 23 |
2 files changed, 27 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 650ae85..e7a98f7 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -28,13 +28,16 @@ S = "${WORKDIR}/git" | |||
28 | inherit cmake | 28 | inherit cmake |
29 | 29 | ||
30 | inherit systemd | 30 | inherit systemd |
31 | |||
31 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" | 32 | SYSTEMD_SERVICE_${PN} = "aktualizr.service" |
32 | 33 | ||
33 | BBCLASSEXTEND =+ "native" | 34 | BBCLASSEXTEND =+ "native" |
34 | 35 | ||
36 | require garage-sign-version.inc | ||
37 | |||
35 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " | 38 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " |
36 | EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " | 39 | EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " |
37 | EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF -DBUILD_SYSTEMD=OFF " | 40 | 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}" |
38 | 41 | ||
39 | do_install_append () { | 42 | do_install_append () { |
40 | rm -fr ${D}${libdir}/systemd | 43 | rm -fr ${D}${libdir}/systemd |
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc new file mode 100644 index 0000000..66e3ffd --- /dev/null +++ b/recipes-sota/aktualizr/garage-sign-version.inc | |||
@@ -0,0 +1,23 @@ | |||
1 | |||
2 | python () { | ||
3 | if d.getVar("GARAGE_SIGN_VERSION", True) or not d.getVar("SOTA_PACKED_CREDENTIALS", True): | ||
4 | return | ||
5 | import json | ||
6 | import urllib.request | ||
7 | import zipfile | ||
8 | with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS", True), 'r') as zip_ref: | ||
9 | try: | ||
10 | with zip_ref.open('tufrepo.url', mode='r') as url_file: | ||
11 | url = url_file.read().decode() + '/health/version' | ||
12 | except (KeyError, ValueError, RuntimeError): | ||
13 | return | ||
14 | r = urllib.request.urlopen(url) | ||
15 | if r.code != 200: | ||
16 | return | ||
17 | resp = r.read().decode('utf-8') | ||
18 | j = json.loads(resp) | ||
19 | version = 'cli-' + j['version'] + '.tgz' | ||
20 | d.setVar("GARAGE_SIGN_VERSION", version) | ||
21 | } | ||
22 | |||
23 | # vim:set ts=4 sw=4 sts=4 expandtab: | ||