summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Gerasimov <anton@advancedtelematic.com>2018-04-20 14:29:21 +0200
committerAnton Gerasimov <anton@advancedtelematic.com>2018-04-20 14:29:21 +0200
commitae3cf4ffd01ec7d4659993ebf901afa3eb853e94 (patch)
tree2d203da8656950f145b80a937b51b1a4e4f06614
parent0b3732d3f1b915ad3be61765aaea840e136c6f60 (diff)
downloadmeta-updater-ae3cf4ffd01ec7d4659993ebf901afa3eb853e94.tar.gz
Backport GARAGE_SIGN_VERSION variable from rocko
-rw-r--r--recipes-sota/aktualizr/aktualizr_git.bb5
-rw-r--r--recipes-sota/aktualizr/garage-sign-version.inc23
2 files changed, 27 insertions, 1 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index dfe520a..16bd552 100644
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -28,13 +28,16 @@ S = "${WORKDIR}/git"
28inherit cmake 28inherit cmake
29 29
30inherit systemd 30inherit systemd
31
31SYSTEMD_SERVICE_${PN} = "aktualizr.service" 32SYSTEMD_SERVICE_${PN} = "aktualizr.service"
32 33
33BBCLASSEXTEND =+ "native" 34BBCLASSEXTEND =+ "native"
34 35
36require garage-sign-version.inc
37
35EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " 38EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} "
36EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " 39EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} "
37EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF -DBUILD_SYSTEMD=OFF " 40EXTRA_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
39do_install_append () { 42do_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
2python () {
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: