summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.adoc2
-rw-r--r--README.adoc10
-rw-r--r--classes/image_types_ostree.bbclass6
-rw-r--r--classes/image_types_ota.bbclass2
-rw-r--r--classes/target_version_example.bbclass10
-rw-r--r--lib/oeqa/selftest/cases/updater.py4
-rwxr-xr-xrecipes-sota/aktualizr/aktualizr_git.bb3
-rw-r--r--recipes-test/images/secondary-image.bb4
8 files changed, 33 insertions, 8 deletions
diff --git a/CONTRIBUTING.adoc b/CONTRIBUTING.adoc
index cd6e981..8f63245 100644
--- a/CONTRIBUTING.adoc
+++ b/CONTRIBUTING.adoc
@@ -14,7 +14,7 @@ If you are developing with meta-updater, it may be helpful to read the README an
14 14
15== Contributor checklist 15== Contributor checklist
16 16
17* OTA-enabled build succeeds at least for one platform, the resulted image boots, and an update can be installed. This check is absolutely necessary for every pull request unless it only touches documentation. 17* OTA-enabled build succeeds for at least one platform, the resulting image boots, and an update can be installed. This check is absolutely necessary for every pull request unless it only touches documentation.
18* If your change touches platform code (like `classes/sota_<platform>.bbclass`), please check building and updating on this particular platform. 18* If your change touches platform code (like `classes/sota_<platform>.bbclass`), please check building and updating on this particular platform.
19* oe-selftest succeeds. To test meta-updater, run `oe-selftest -r updater` from a build directory with `MACHINE` set to `qemux86-64`. 19* oe-selftest succeeds. To test meta-updater, run `oe-selftest -r updater` from a build directory with `MACHINE` set to `qemux86-64`.
20* Updates are forwards- and backwards-compatible. You should be able to update an OTA-enabled build before the change is applied to the version with change applied and vice versa. One should pay double attention to the compatibility when bootloader code is affected. 20* Updates are forwards- and backwards-compatible. You should be able to update an OTA-enabled build before the change is applied to the version with change applied and vice versa. One should pay double attention to the compatibility when bootloader code is affected.
diff --git a/README.adoc b/README.adoc
index cccba9f..e14d7bd 100644
--- a/README.adoc
+++ b/README.adoc
@@ -170,6 +170,16 @@ There are a few settings that can be controlled in `local.conf` to simplify the
170| `TOOLCHAIN_HOST_TASK_append = " nativesdk-cmake "` | Use with `bitbake -c populate_sdk core-image-minimal` to build an SDK. See the https://github.com/advancedtelematic/aktualizr#developing-against-an-openembedded-system[aktualizr repo] for more information. 170| `TOOLCHAIN_HOST_TASK_append = " nativesdk-cmake "` | Use with `bitbake -c populate_sdk core-image-minimal` to build an SDK. See the https://github.com/advancedtelematic/aktualizr#developing-against-an-openembedded-system[aktualizr repo] for more information.
171|====================== 171|======================
172 172
173=== Overriding target version
174*Warning: overriding target version is a dangerous operation, make sure you understand this section completely before doing it.*
175
176Every time you build an image with `SOTA_PACKED_CREDENTIALS` set, a new entry in your Uptane metadata is created and you can see it in the OTA Garage UI if you're using one. Normally this version will be equal to OSTree hash of your root file system. If you want it to be different though you can override is using one of two methods:
177
1781. Set `GARAGE_TARGET_VERSION` variable in your `local.conf`.
1792. Write a recipe or a bbclass to write the desired version to `${STAGING_DATADIR_NATIVE}/target_version`. An example of such bbclass can be found in `classes/target_version_example.bbclass`.
180
181Please note that [target name, target version] pairs are expected to be unique in the system. If you build a new target with the same target version as a previously built one, the old package will be overwritten on the update server. It can have unpredictable effect on devices that have this version installed, and it is not guaranteed that information will be reported correctly for such devices or that you will be able to update them (we're doing our best though). The easiest way to avoid problems is to make sure that your overriding version is as unique as an OSTree commit hash.
182
173== QA with oe-selftest 183== QA with oe-selftest
174 184
175This layer relies on the test framework oe-selftest for quality assurance. Follow the steps below to run the tests: 185This layer relies on the test framework oe-selftest for quality assurance. Follow the steps below to run the tests:
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index d2feb50..0db8e50 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -194,7 +194,7 @@ IMAGE_CMD_ostreepush () {
194} 194}
195 195
196IMAGE_TYPEDEP_garagesign = "ostreepush" 196IMAGE_TYPEDEP_garagesign = "ostreepush"
197do_image_garage_sign[depends] += "aktualizr-native:do_populate_sysroot" 197do_image_garagesign[depends] += "aktualizr-native:do_populate_sysroot"
198IMAGE_CMD_garagesign () { 198IMAGE_CMD_garagesign () {
199 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then 199 if [ -n "${SOTA_PACKED_CREDENTIALS}" ]; then
200 # if credentials are issued by a server that doesn't support offline signing, exit silently 200 # if credentials are issued by a server that doesn't support offline signing, exit silently
@@ -220,6 +220,10 @@ IMAGE_CMD_garagesign () {
220 target_version=${ostree_target_hash} 220 target_version=${ostree_target_hash}
221 if [ -n "${GARAGE_TARGET_VERSION}" ]; then 221 if [ -n "${GARAGE_TARGET_VERSION}" ]; then
222 target_version=${GARAGE_TARGET_VERSION} 222 target_version=${GARAGE_TARGET_VERSION}
223 bbwarn "Target version is overriden with GARAGE_TARGET_VERSION variable. It is a dangerous operation, make sure you've read the respective secion in meta-updater/README.adoc"
224 elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then
225 target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version")
226 bbwarn "Target version is overriden with target_version file. It is a dangerous operation, make sure you've read the respective secion in meta-updater/README.adoc"
223 fi 227 fi
224 228
225 # Push may fail due to race condition when multiple build machines try to push simultaneously 229 # Push may fail due to race condition when multiple build machines try to push simultaneously
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index ed1d579..03fe8d8 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -115,6 +115,8 @@ fakeroot do_otasetup () {
115 target_version=${ostree_target_hash} 115 target_version=${ostree_target_hash}
116 if [ -n "${GARAGE_TARGET_VERSION}" ]; then 116 if [ -n "${GARAGE_TARGET_VERSION}" ]; then
117 target_version=${GARAGE_TARGET_VERSION} 117 target_version=${GARAGE_TARGET_VERSION}
118 elif [ -e "${STAGING_DATADIR_NATIVE}/target_version" ]; then
119 target_version=$(cat "${STAGING_DATADIR_NATIVE}/target_version")
118 fi 120 fi
119 mkdir -p ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import 121 mkdir -p ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import
120 echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${target_version}\"}" > ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import/installed_versions 122 echo "{\"${ostree_target_hash}\":\"${GARAGE_TARGET_NAME}-${target_version}\"}" > ${OTA_SYSROOT}/ostree/deploy/${OSTREE_OSNAME}/var/sota/import/installed_versions
diff --git a/classes/target_version_example.bbclass b/classes/target_version_example.bbclass
new file mode 100644
index 0000000..ef119fb
--- /dev/null
+++ b/classes/target_version_example.bbclass
@@ -0,0 +1,10 @@
1# Writes target version to be used by garage-sign
2
3HOSTTOOLS += " git "
4
5deploy_target_version () {
6 version=$(git --git-dir=${METADIR}/.repo/manifests/.git/ rev-parse HEAD)
7 echo -n ${version} > ${STAGING_DATADIR_NATIVE}/target_version
8}
9
10IMAGE_PREPROCESS_COMMAND += "deploy_target_version;"
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py
index c7b18dd..e4b2fa5 100644
--- a/lib/oeqa/selftest/cases/updater.py
+++ b/lib/oeqa/selftest/cases/updater.py
@@ -102,9 +102,6 @@ class AktualizrToolsTests(OESelftestTestCase):
102 logger.info('Running bitbake to build aktualizr-native tools') 102 logger.info('Running bitbake to build aktualizr-native tools')
103 bitbake('aktualizr-native') 103 bitbake('aktualizr-native')
104 104
105 def test_implicit_writer_help(self):
106 akt_native_run(self, 'aktualizr_implicit_writer --help')
107
108 def test_cert_provider_help(self): 105 def test_cert_provider_help(self):
109 akt_native_run(self, 'aktualizr_cert_provider --help') 106 akt_native_run(self, 'aktualizr_cert_provider --help')
110 107
@@ -228,6 +225,7 @@ class ManualControlTests(OESelftestTestCase):
228 self.assertIn(b'Fetched metadata: yes', stdout, 225 self.assertIn(b'Fetched metadata: yes', stdout,
229 'Aktualizr should have run' + stderr.decode() + stdout.decode()) 226 'Aktualizr should have run' + stderr.decode() + stdout.decode())
230 227
228
231class RpiTests(OESelftestTestCase): 229class RpiTests(OESelftestTestCase):
232 230
233 def setUpLocal(self): 231 def setUpLocal(self):
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb
index 916ab4b..50a9f16 100755
--- a/recipes-sota/aktualizr/aktualizr_git.bb
+++ b/recipes-sota/aktualizr/aktualizr_git.bb
@@ -27,7 +27,7 @@ SRC_URI = " \
27 file://aktualizr-serialcan.service \ 27 file://aktualizr-serialcan.service \
28 " 28 "
29 29
30SRCREV = "39acfec48d1cb91e7621c818ac177f6d3c73fecc" 30SRCREV = "3c1c77c005fc1f872f1e12080528ed6f8a32bbf3"
31BRANCH ?= "master" 31BRANCH ?= "master"
32 32
33S = "${WORKDIR}/git" 33S = "${WORKDIR}/git"
@@ -100,7 +100,6 @@ FILES_${PN}-examples = " \
100FILES_${PN}-host-tools = " \ 100FILES_${PN}-host-tools = " \
101 ${bindir}/aktualizr-repo \ 101 ${bindir}/aktualizr-repo \
102 ${bindir}/aktualizr_cert_provider \ 102 ${bindir}/aktualizr_cert_provider \
103 ${bindir}/aktualizr_implicit_writer \
104 ${bindir}/garage-deploy \ 103 ${bindir}/garage-deploy \
105 ${bindir}/garage-push \ 104 ${bindir}/garage-push \
106 ${libdir}/sota/sota_autoprov.toml \ 105 ${libdir}/sota/sota_autoprov.toml \
diff --git a/recipes-test/images/secondary-image.bb b/recipes-test/images/secondary-image.bb
index 9adbdc5..1a41169 100644
--- a/recipes-test/images/secondary-image.bb
+++ b/recipes-test/images/secondary-image.bb
@@ -10,9 +10,11 @@ LICENSE = "MIT"
10IMAGE_INSTALL_remove = " \ 10IMAGE_INSTALL_remove = " \
11 aktualizr \ 11 aktualizr \
12 aktualizr-auto-prov \ 12 aktualizr-auto-prov \
13 aktualizr-auto-prov-creds \
13 aktualizr-ca-implicit-prov \ 14 aktualizr-ca-implicit-prov \
15 aktualizr-ca-implicit-prov-creds \
14 aktualizr-hsm-prov \ 16 aktualizr-hsm-prov \
15 aktualizr-implicit-prov \ 17 aktualizr-uboot-env-rollback \
16 connman \ 18 connman \
17 connman-client \ 19 connman-client \
18 " 20 "