diff options
| author | Patrick Vacek <patrickvacek@gmail.com> | 2018-07-17 14:43:32 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-07-17 14:43:32 +0200 |
| commit | 3ad1ac0634f4cff65f8ae4cfa78bbe73942e0bd5 (patch) | |
| tree | 14b9a9fa7145d123c9ba5ea6334826dbff7e6370 | |
| parent | ff555e8690eb47177ade42dc6912ae17a759cc45 (diff) | |
| parent | 76bba03abd7a2c75d0d419d99b5ebdf7ade1818b (diff) | |
| download | meta-updater-3ad1ac0634f4cff65f8ae4cfa78bbe73942e0bd5.tar.gz | |
Merge pull request #353 from advancedtelematic/feat/bump-aktualizr-rocko
aktualizr: Get latest for PRO-H#2 sprint. (rocko)
| -rw-r--r-- | lib/oeqa/selftest/cases/updater.py | 45 | ||||
| -rwxr-xr-x | recipes-sota/aktualizr/aktualizr_git.bb | 11 | ||||
| -rw-r--r-- | recipes-sota/aktualizr/garage-sign-version.inc | 17 |
3 files changed, 68 insertions, 5 deletions
diff --git a/lib/oeqa/selftest/cases/updater.py b/lib/oeqa/selftest/cases/updater.py index 190d85d..ed4d8d7 100644 --- a/lib/oeqa/selftest/cases/updater.py +++ b/lib/oeqa/selftest/cases/updater.py | |||
| @@ -193,6 +193,49 @@ class AutoProvTests(OESelftestTestCase): | |||
| 193 | 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode()) | 193 | 'Legacy secondary initialization failed: ' + stderr.decode() + stdout.decode()) |
| 194 | 194 | ||
| 195 | 195 | ||
| 196 | class ManualControlTests(OESelftestTestCase): | ||
| 197 | |||
| 198 | def setUpLocal(self): | ||
| 199 | layer = "meta-updater-qemux86-64" | ||
| 200 | result = runCmd('bitbake-layers show-layers') | ||
| 201 | if re.search(layer, result.output) is None: | ||
| 202 | # Assume the directory layout for finding other layers. We could also | ||
| 203 | # make assumptions by using 'show-layers', but either way, if the | ||
| 204 | # layers we need aren't where we expect them, we are out of like. | ||
| 205 | path = os.path.abspath(os.path.dirname(__file__)) | ||
| 206 | metadir = path + "/../../../../../" | ||
| 207 | self.meta_qemu = metadir + layer | ||
| 208 | runCmd('bitbake-layers add-layer "%s"' % self.meta_qemu) | ||
| 209 | else: | ||
| 210 | self.meta_qemu = None | ||
| 211 | self.append_config('MACHINE = "qemux86-64"') | ||
| 212 | self.append_config('SOTA_CLIENT_PROV = " aktualizr-auto-prov "') | ||
| 213 | self.append_config('SYSTEMD_AUTO_ENABLE_aktualizr = "disable"') | ||
| 214 | self.qemu, self.s = qemu_launch(machine='qemux86-64') | ||
| 215 | |||
| 216 | def tearDownLocal(self): | ||
| 217 | qemu_terminate(self.s) | ||
| 218 | if self.meta_qemu: | ||
| 219 | runCmd('bitbake-layers remove-layer "%s"' % self.meta_qemu, ignore_status=True) | ||
| 220 | |||
| 221 | def qemu_command(self, command): | ||
| 222 | return qemu_send_command(self.qemu.ssh_port, command) | ||
| 223 | |||
| 224 | def test_manual_running_mode_once(self): | ||
| 225 | """ | ||
| 226 | Disable the systemd service then run aktualizr manually | ||
| 227 | """ | ||
| 228 | sleep(20) | ||
| 229 | stdout, stderr, retcode = self.qemu_command('aktualizr-info') | ||
| 230 | self.assertIn(b'Fetched metadata: no', stdout, | ||
| 231 | 'Aktualizr should not have run yet' + stderr.decode() + stdout.decode()) | ||
| 232 | |||
| 233 | stdout, stderr, retcode = self.qemu_command('aktualizr --running-mode=once') | ||
| 234 | |||
| 235 | stdout, stderr, retcode = self.qemu_command('aktualizr-info') | ||
| 236 | self.assertIn(b'Fetched metadata: yes', stdout, | ||
| 237 | 'Aktualizr should have run' + stderr.decode() + stdout.decode()) | ||
| 238 | |||
| 196 | class RpiTests(OESelftestTestCase): | 239 | class RpiTests(OESelftestTestCase): |
| 197 | 240 | ||
| 198 | def setUpLocal(self): | 241 | def setUpLocal(self): |
| @@ -554,7 +597,7 @@ class SecondaryTests(OESelftestTestCase): | |||
| 554 | 597 | ||
| 555 | def test_secondary_listening(self): | 598 | def test_secondary_listening(self): |
| 556 | print('Checking aktualizr-secondary service is listening') | 599 | print('Checking aktualizr-secondary service is listening') |
| 557 | stdout, stderr, retcode = self.qemu_command('echo test | nc localhost 9030') | 600 | stdout, stderr, retcode = self.qemu_command('aktualizr-check-discovery') |
| 558 | self.assertEqual(retcode, 0, "Unable to connect to secondary") | 601 | self.assertEqual(retcode, 0, "Unable to connect to secondary") |
| 559 | 602 | ||
| 560 | 603 | ||
diff --git a/recipes-sota/aktualizr/aktualizr_git.bb b/recipes-sota/aktualizr/aktualizr_git.bb index ca0bfb6..6096c7b 100755 --- a/recipes-sota/aktualizr/aktualizr_git.bb +++ b/recipes-sota/aktualizr/aktualizr_git.bb | |||
| @@ -15,6 +15,9 @@ RDEPENDS_${PN}_append_class-target = "${@bb.utils.contains('SOTA_CLIENT_FEATURES | |||
| 15 | RDEPENDS_${PN}_append_class-target = " ${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'u-boot-fw-utils', '')}" | 15 | RDEPENDS_${PN}_append_class-target = " ${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'u-boot-fw-utils', '')}" |
| 16 | RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' aktualizr-uboot-env-rollback', '', d)} " | 16 | RDEPENDS_${PN}_append_class-target = " ${@bb.utils.contains('SOTA_CLIENT_FEATURES', 'ubootenv', ' aktualizr-uboot-env-rollback', '', d)} " |
| 17 | 17 | ||
| 18 | RDEPENDS_${PN}_append_class-target = " ${PN}-tools " | ||
| 19 | RDEPENDS_${PN}-secondary_append_class-target = " ${PN}-tools " | ||
| 20 | |||
| 18 | PV = "1.0+git${SRCPV}" | 21 | PV = "1.0+git${SRCPV}" |
| 19 | PR = "7" | 22 | PR = "7" |
| 20 | 23 | ||
| @@ -25,7 +28,7 @@ SRC_URI = " \ | |||
| 25 | file://aktualizr-secondary.socket \ | 28 | file://aktualizr-secondary.socket \ |
| 26 | file://aktualizr-serialcan.service \ | 29 | file://aktualizr-serialcan.service \ |
| 27 | " | 30 | " |
| 28 | SRCREV = "767098f45e2e05d5bbd817f9b3b3aa44844da8ec" | 31 | SRCREV = "e9faff35ffa8c31cbf3c5fb1c3c6ed4f5f50e500" |
| 29 | BRANCH ?= "master" | 32 | BRANCH ?= "master" |
| 30 | 33 | ||
| 31 | S = "${WORKDIR}/git" | 34 | S = "${WORKDIR}/git" |
| @@ -85,7 +88,7 @@ do_install_append_class-native () { | |||
| 85 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} | 88 | install -m 0644 ${B}/src/sota_tools/garage-sign/lib/* ${D}${libdir} |
| 86 | } | 89 | } |
| 87 | 90 | ||
| 88 | PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-secondary " | 91 | PACKAGES =+ " ${PN}-examples ${PN}-host-tools ${PN}-tools ${PN}-secondary " |
| 89 | 92 | ||
| 90 | FILES_${PN} = " \ | 93 | FILES_${PN} = " \ |
| 91 | ${bindir}/aktualizr \ | 94 | ${bindir}/aktualizr \ |
| @@ -116,6 +119,10 @@ FILES_${PN}-host-tools = " \ | |||
| 116 | ${libdir}/sota/sota_uboot_env.toml \ | 119 | ${libdir}/sota/sota_uboot_env.toml \ |
| 117 | " | 120 | " |
| 118 | 121 | ||
| 122 | FILES_${PN}-tools = " \ | ||
| 123 | ${bindir}/aktualizr-check-discovery \ | ||
| 124 | " | ||
| 125 | |||
| 119 | FILES_${PN}-secondary = " \ | 126 | FILES_${PN}-secondary = " \ |
| 120 | ${bindir}/aktualizr-secondary \ | 127 | ${bindir}/aktualizr-secondary \ |
| 121 | ${libdir}/sota/sota_secondary.toml \ | 128 | ${libdir}/sota/sota_secondary.toml \ |
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc index f2d04e8..1b89a3d 100644 --- a/recipes-sota/aktualizr/garage-sign-version.inc +++ b/recipes-sota/aktualizr/garage-sign-version.inc | |||
| @@ -11,8 +11,21 @@ python () { | |||
| 11 | url = url_file.read().decode().strip(' \t\n') + '/health/version' | 11 | url = url_file.read().decode().strip(' \t\n') + '/health/version' |
| 12 | except (KeyError, ValueError, RuntimeError): | 12 | except (KeyError, ValueError, RuntimeError): |
| 13 | return | 13 | return |
| 14 | r = urllib.request.urlopen(url) | 14 | connected = False |
| 15 | if r.code != 200: | 15 | tries = 3 |
| 16 | for i in range(tries): | ||
| 17 | try: | ||
| 18 | r = urllib.request.urlopen(url) | ||
| 19 | if r.code == 200: | ||
| 20 | connected = True | ||
| 21 | break | ||
| 22 | else: | ||
| 23 | print('Bad return code from server ' + url + ': ' + str(r.code) + | ||
| 24 | ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') | ||
| 25 | except urllib.error.URLError as e: | ||
| 26 | print('Error connecting to server ' + url + ': ' + str(e) + | ||
| 27 | ' (attempt ' + str(i + 1) + ' of ' + str(tries) + ')') | ||
| 28 | if not connected: | ||
| 16 | return | 29 | return |
| 17 | resp = r.read().decode('utf-8') | 30 | resp = r.read().decode('utf-8') |
| 18 | j = json.loads(resp) | 31 | j = json.loads(resp) |
