summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Vacek <patrickvacek@gmail.com>2019-01-15 09:29:37 +0100
committerGitHub <noreply@github.com>2019-01-15 09:29:37 +0100
commitf4e46ffa9992ee41cc6ac1dff71f2c9907290a81 (patch)
tree29f2542d8695ab4596525b1c37c7a361bff285bb
parentc6cbeda3876003f9d5a179f96a406432549ae68b (diff)
parentd49ae8261680ae2cfd4c0179eff013d2def92e1b (diff)
downloadmeta-updater-f4e46ffa9992ee41cc6ac1dff71f2c9907290a81.tar.gz
Merge pull request #456 from liuming50/master
Some cleaning up
-rw-r--r--classes/image_types_ostree.bbclass2
-rw-r--r--classes/image_types_ota.bbclass8
-rw-r--r--classes/sota.bbclass2
-rw-r--r--classes/sota_sanity.bbclass10
-rw-r--r--recipes-sota/aktualizr/aktualizr-auto-prov.bb2
-rw-r--r--recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb2
-rw-r--r--recipes-sota/aktualizr/aktualizr-hsm-prov.bb2
-rw-r--r--recipes-sota/aktualizr/credentials.inc2
-rw-r--r--recipes-sota/aktualizr/garage-sign-version.inc4
9 files changed, 17 insertions, 17 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 138e02e..29da78e 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -10,7 +10,7 @@ OSTREE_DEPLOY_DEVICETREE ??= "0"
10 10
11BUILD_OSTREE_TARBALL ??= "1" 11BUILD_OSTREE_TARBALL ??= "1"
12 12
13SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" 13SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager') == 'systemd', 'true', '')}"
14 14
15IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*" 15IMAGE_CMD_TAR = "tar --xattrs --xattrs-include=*"
16CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]" 16CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}; ${IMAGE_CMD_TAR} --numeric-owner -cf ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${type}.tar -C ${OTA_IMAGE_ROOTFS} . || [ $? -eq 1 ]"
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index 9883a68..a31cbd1 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -42,8 +42,8 @@ OTA_IMAGE_ROOTFS_task-image-ota = "${OTA_SYSROOT}"
42IMAGE_TYPEDEP_ota = "ostreecommit" 42IMAGE_TYPEDEP_ota = "ostreecommit"
43do_image_ota[dirs] = "${OTA_SYSROOT}" 43do_image_ota[dirs] = "${OTA_SYSROOT}"
44do_image_ota[cleandirs] = "${OTA_SYSROOT}" 44do_image_ota[cleandirs] = "${OTA_SYSROOT}"
45do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER', True) == 'grub' else ''} \ 45do_image_ota[depends] = "${@'grub:do_populate_sysroot' if d.getVar('OSTREE_BOOTLOADER') == 'grub' else ''} \
46 ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot' else ''}" 46 ${@'virtual/bootloader:do_deploy' if d.getVar('OSTREE_BOOTLOADER') == 'u-boot' else ''}"
47IMAGE_CMD_ota () { 47IMAGE_CMD_ota () {
48 ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT} 48 ostree admin --sysroot=${OTA_SYSROOT} init-fs ${OTA_SYSROOT}
49 ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME} 49 ostree admin --sysroot=${OTA_SYSROOT} os-init ${OSTREE_OSNAME}
@@ -93,7 +93,7 @@ IMAGE_CMD_ota () {
93IMAGE_TYPEDEP_ota-ext4 = "ota" 93IMAGE_TYPEDEP_ota-ext4 = "ota"
94do_image_ota_ext4[depends] = "e2fsprogs-native:do_populate_sysroot" 94do_image_ota_ext4[depends] = "e2fsprogs-native:do_populate_sysroot"
95IMAGE_CMD_ota-ext4 () { 95IMAGE_CMD_ota-ext4 () {
96 # Calculate image type 96 # Calculate image size
97 OTA_ROOTFS_SIZE=$(calculate_size `du -ks ${OTA_SYSROOT} | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}") 97 OTA_ROOTFS_SIZE=$(calculate_size `du -ks ${OTA_SYSROOT} | cut -f 1` "${IMAGE_OVERHEAD_FACTOR}" "${IMAGE_ROOTFS_SIZE}" "${IMAGE_ROOTFS_MAXSIZE}" `expr ${IMAGE_ROOTFS_EXTRA_SPACE}` "${IMAGE_ROOTFS_ALIGNMENT}")
98 98
99 if [ ${OTA_ROOTFS_SIZE} -lt 0 ]; then 99 if [ ${OTA_ROOTFS_SIZE} -lt 0 ]; then
@@ -110,4 +110,4 @@ IMAGE_CMD_ota-ext4 () {
110 mkfs.ext4 -O ^64bit ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ota-ext4 -L otaroot -d ${OTA_SYSROOT} 110 mkfs.ext4 -O ^64bit ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.ota-ext4 -L otaroot -d ${OTA_SYSROOT}
111} 111}
112 112
113do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME', True), '', d)}" 113do_image_wic[depends] += "${@bb.utils.contains('DISTRO_FEATURES', 'sota', '%s:do_image_ota_ext4' % d.getVar('IMAGE_BASENAME'), '', d)}"
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 93f59eb..ccc4526 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -21,7 +21,7 @@ WKS_FILE_sota ?= "sdimage-sota.wks"
21 21
22EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native" 22EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native"
23 23
24INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" 24INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER') == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}"
25 25
26# Please redefine OSTREE_REPO in order to have a persistent OSTree repo 26# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
27export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" 27export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
diff --git a/classes/sota_sanity.bbclass b/classes/sota_sanity.bbclass
index e47de19..8e80acb 100644
--- a/classes/sota_sanity.bbclass
+++ b/classes/sota_sanity.bbclass
@@ -1,17 +1,17 @@
1# Sanity check the sota setup for common misconfigurations 1# Sanity check the sota setup for common misconfigurations
2 2
3def sota_check_overrides(status, d): 3def sota_check_overrides(status, d):
4 for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST', True) or "").split(): 4 for var in (d.getVar('SOTA_OVERRIDES_BLACKLIST') or "").split():
5 if var in d.getVar('OVERRIDES', True).split(':'): 5 if var in d.getVar('OVERRIDES').split(':'):
6 status.addresult("%s should not be a overrides, because it is a image fstype in updater layer, please check your OVERRIDES setting.\n" % var) 6 status.addresult("%s should not be a overrides, because it is a image fstype in updater layer, please check your OVERRIDES setting.\n" % var)
7 7
8def sota_check_required_variables(status, d): 8def sota_check_required_variables(status, d):
9 for var in (d.getVar('SOTA_REQUIRED_VARIABLES', True) or "").split(): 9 for var in (d.getVar('SOTA_REQUIRED_VARIABLES') or "").split():
10 if not d.getVar(var, True): 10 if not d.getVar(var):
11 status.addresult("%s should be set in your local.conf.\n" % var) 11 status.addresult("%s should be set in your local.conf.\n" % var)
12 12
13def sota_raise_sanity_error(msg, d): 13def sota_raise_sanity_error(msg, d):
14 if d.getVar("SANITY_USE_EVENTS", True) == "1": 14 if d.getVar("SANITY_USE_EVENTS") == "1":
15 bb.event.fire(bb.event.SanityCheckFailed(msg), d) 15 bb.event.fire(bb.event.SanityCheckFailed(msg), d)
16 return 16 return
17 17
diff --git a/recipes-sota/aktualizr/aktualizr-auto-prov.bb b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
index f506cab..308f552 100644
--- a/recipes-sota/aktualizr/aktualizr-auto-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-auto-prov.bb
@@ -6,7 +6,7 @@ LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" 6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
7 7
8DEPENDS = "aktualizr-native zip-native" 8DEPENDS = "aktualizr-native zip-native"
9RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" 9RDEPENDS_${PN}_append = "${@' aktualizr-auto-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}"
10PV = "1.0" 10PV = "1.0"
11PR = "6" 11PR = "6"
12 12
diff --git a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb
index 5893ed2..8dcda99 100644
--- a/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-ca-implicit-prov.bb
@@ -10,7 +10,7 @@ LICENSE = "MPL-2.0"
10LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" 10LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
11 11
12DEPENDS = "aktualizr aktualizr-native openssl-native" 12DEPENDS = "aktualizr aktualizr-native openssl-native"
13RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" 13RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}"
14 14
15PV = "1.0" 15PV = "1.0"
16PR = "1" 16PR = "1"
diff --git a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb
index 7947edd..27aba0f 100644
--- a/recipes-sota/aktualizr/aktualizr-hsm-prov.bb
+++ b/recipes-sota/aktualizr/aktualizr-hsm-prov.bb
@@ -6,7 +6,7 @@ LICENSE = "MPL-2.0"
6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad" 6LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MPL-2.0;md5=815ca599c9df247a0c7f619bab123dad"
7 7
8DEPENDS = "aktualizr aktualizr-native" 8DEPENDS = "aktualizr aktualizr-native"
9RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds softhsm-testtoken' if d.getVar('SOTA_DEPLOY_CREDENTIALS', True) == '1' else ''}" 9RDEPENDS_${PN}_append = "${@' aktualizr-ca-implicit-prov-creds softhsm-testtoken' if d.getVar('SOTA_DEPLOY_CREDENTIALS') == '1' else ''}"
10 10
11SRC_URI = "" 11SRC_URI = ""
12PV = "1.0" 12PV = "1.0"
diff --git a/recipes-sota/aktualizr/credentials.inc b/recipes-sota/aktualizr/credentials.inc
index 256c8ff..7c44257 100644
--- a/recipes-sota/aktualizr/credentials.inc
+++ b/recipes-sota/aktualizr/credentials.inc
@@ -1 +1 @@
SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS', True)) if d.getVar('SOTA_PACKED_CREDENTIALS', True) else ''}" SRC_URI_append = "${@('file://' + d.getVar('SOTA_PACKED_CREDENTIALS')) if d.getVar('SOTA_PACKED_CREDENTIALS') else ''}"
diff --git a/recipes-sota/aktualizr/garage-sign-version.inc b/recipes-sota/aktualizr/garage-sign-version.inc
index 1b89a3d..2cea6c9 100644
--- a/recipes-sota/aktualizr/garage-sign-version.inc
+++ b/recipes-sota/aktualizr/garage-sign-version.inc
@@ -1,11 +1,11 @@
1 1
2python () { 2python () {
3 if d.getVar("GARAGE_SIGN_VERSION", True) or not d.getVar("SOTA_PACKED_CREDENTIALS", True): 3 if d.getVar("GARAGE_SIGN_VERSION") or not d.getVar("SOTA_PACKED_CREDENTIALS"):
4 return 4 return
5 import json 5 import json
6 import urllib.request 6 import urllib.request
7 import zipfile 7 import zipfile
8 with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS", True), 'r') as zip_ref: 8 with zipfile.ZipFile(d.getVar("SOTA_PACKED_CREDENTIALS"), 'r') as zip_ref:
9 try: 9 try:
10 with zip_ref.open('tufrepo.url', mode='r') as url_file: 10 with zip_ref.open('tufrepo.url', mode='r') as url_file:
11 url = url_file.read().decode().strip(' \t\n') + '/health/version' 11 url = url_file.read().decode().strip(' \t\n') + '/health/version'