diff options
author | cajun-rat <phil@advancedtelematic.com> | 2018-04-13 15:32:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 15:32:51 +0200 |
commit | 8182accec40381f7986604ef03ed7c306246699b (patch) | |
tree | 7bf4fb1876f04d97b8dbfd779965de4f2975e3b9 | |
parent | 609337b57ea887e400a3246e59f1d635936d7527 (diff) | |
parent | e109b8cde37bd1d0bbefc37d39c169b57b7957d4 (diff) | |
download | meta-updater-8182accec40381f7986604ef03ed7c306246699b.tar.gz |
Merge pull request #291 from advancedtelematic/feat/garage-sign-auto-version
Feat/garage sign auto version
-rw-r--r-- | recipes-sota/aktualizr/aktualizr_git.bb | 22 | ||||
-rw-r--r-- | recipes-sota/aktualizr/garage-sign-version.inc | 23 |
2 files changed, 39 insertions, 6 deletions
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index 2a803a8..abe8f5b 100644 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
@@ -22,7 +22,7 @@ SRC_URI = " \ | |||
22 | file://aktualizr-secondary.socket \ | 22 | file://aktualizr-secondary.socket \ |
23 | file://aktualizr-serialcan.service \ | 23 | file://aktualizr-serialcan.service \ |
24 | " | 24 | " |
25 | SRCREV = "930d8eef6eb584686654601c056d7c9c6fca3048" | 25 | SRCREV = "7ccfc5b4286b9a04915e74a7474a8d3451145e1c" |
26 | BRANCH ?= "master" | 26 | BRANCH ?= "master" |
27 | 27 | ||
28 | S = "${WORKDIR}/git" | 28 | S = "${WORKDIR}/git" |
@@ -37,9 +37,19 @@ SYSTEMD_SERVICE_${PN}-secondary = "aktualizr-secondary.socket" | |||
37 | 37 | ||
38 | BBCLASSEXTEND =+ "native" | 38 | BBCLASSEXTEND =+ "native" |
39 | 39 | ||
40 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF -DCMAKE_BUILD_TYPE=Release -DAKTUALIZR_VERSION=${PV} " | 40 | require garage-sign-version.inc |
41 | EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON -DBUILD_ISOTP=ON ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " | 41 | |
42 | EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON -DBUILD_OSTREE=OFF -DBUILD_SYSTEMD=OFF " | 42 | EXTRA_OECMAKE = "-DWARNING_AS_ERROR=OFF \ |
43 | -DCMAKE_BUILD_TYPE=Release \ | ||
44 | -DAKTUALIZR_VERSION=${PV} " | ||
45 | EXTRA_OECMAKE_append_class-target = " -DBUILD_OSTREE=ON \ | ||
46 | -DBUILD_ISOTP=ON \ | ||
47 | ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'hsm', '-DBUILD_P11=ON', '', d)} " | ||
48 | EXTRA_OECMAKE_append_class-native = " -DBUILD_SOTA_TOOLS=ON \ | ||
49 | -DBUILD_OSTREE=OFF \ | ||
50 | -DBUILD_SYSTEMD=OFF \ | ||
51 | -DGARAGE_SIGN_VERSION=${GARAGE_SIGN_VERSION} \ | ||
52 | -DGARAGE_SIGN_SHA256=${GARAGE_SIGN_SHA256}" | ||
43 | 53 | ||
44 | do_install_append () { | 54 | do_install_append () { |
45 | rm -fr ${D}${libdir}/systemd | 55 | rm -fr ${D}${libdir}/systemd |
@@ -65,8 +75,8 @@ do_install_append_class-native () { | |||
65 | install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml | 75 | install -m 0644 ${S}/config/sota_implicit_prov.toml ${D}/${libdir}/sota/sota_implicit_prov.toml |
66 | install -m 0644 ${S}/config/sota_implicit_prov_ca.toml ${D}/${libdir}/sota/sota_implicit_prov_ca.toml | 76 | install -m 0644 ${S}/config/sota_implicit_prov_ca.toml ${D}/${libdir}/sota/sota_implicit_prov_ca.toml |
67 | 77 | ||
68 | install -m 0755 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/bin/* ${D}${bindir} | 78 | install -m 0755 ${B}/src/sota_tools/garage-sign/bin/* ${D}${bindir} |
69 | install -m 0644 ${B}/src/sota_tools/garage-sign-prefix/src/garage-sign/lib/* ${D}${libdir} | 79 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} |
70 | } | 80 | } |
71 | 81 | ||
72 | PACKAGES =+ " ${PN}-common ${PN}-examples ${PN}-host-tools ${PN}-secondary " | 82 | PACKAGES =+ " ${PN}-common ${PN}-examples ${PN}-host-tools ${PN}-secondary " |
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc new file mode 100644 index 0000000..2d08cdf --- /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() | ||
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: | ||