summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMing Liu <liu.ming50@gmail.com>2018-11-19 10:48:58 +0100
committerMing Liu <liu.ming50@gmail.com>2018-11-24 12:12:25 +0100
commitf4cf0698a88631af150782dce9b3dafcb0dbc5d5 (patch)
treebb5fded9e29d420c46759b626ecbc34dcb32f65b
parent4eaec14b8204ab5cb2e4a3fa2f19c39326909101 (diff)
downloadmeta-updater-f4cf0698a88631af150782dce9b3dafcb0dbc5d5.tar.gz
meta: drop redundant export syntax
There are quite a few 'export' syntax, they are either not necessary or being redundant. Actually only the variables being referred in ostree or aktualizr need to be exported, we can move them into sota.bbclass so they can be exported once only for all other classes referring to them. And drop all other unnecessary exports. Signed-off-by: Ming Liu <liu.ming50@gmail.com>
-rw-r--r--classes/image_types_ostree.bbclass13
-rw-r--r--classes/image_types_ota.bbclass10
-rw-r--r--classes/sota.bbclass11
3 files changed, 11 insertions, 23 deletions
diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass
index 71cacc6..44a3aa4 100644
--- a/classes/image_types_ostree.bbclass
+++ b/classes/image_types_ostree.bbclass
@@ -7,17 +7,12 @@ do_image_ostree[depends] += "ostree-native:do_populate_sysroot \
7" 7"
8do_image_ostree[lockfiles] += "${OSTREE_REPO}/ostree.lock" 8do_image_ostree[lockfiles] += "${OSTREE_REPO}/ostree.lock"
9 9
10export OSTREE_REPO
11export OSTREE_BRANCHNAME
12export GARAGE_TARGET_NAME
13
14OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" 10OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}"
15
16OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" 11OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}"
17OSTREE_COMMIT_BODY ??= "" 12OSTREE_COMMIT_BODY ??= ""
18OSTREE_UPDATE_SUMMARY ??= "0" 13OSTREE_UPDATE_SUMMARY ??= "0"
19 14
20export SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" 15SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}"
21 16
22IMAGE_CMD_ostree () { 17IMAGE_CMD_ostree () {
23 if [ -z "$OSTREE_REPO" ]; then 18 if [ -z "$OSTREE_REPO" ]; then
@@ -62,7 +57,7 @@ IMAGE_CMD_ostree () {
62 fi 57 fi
63 done 58 done
64 59
65 if [ -n "$SYSTEMD_USED" ]; then 60 if [ -n "${SYSTEMD_USED}" ]; then
66 mkdir -p usr/etc/tmpfiles.d 61 mkdir -p usr/etc/tmpfiles.d
67 tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf 62 tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf
68 echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} 63 echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf}
@@ -98,7 +93,7 @@ IMAGE_CMD_ostree () {
98 bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" 93 bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr"
99 fi 94 fi
100 95
101 if [ -n "$SYSTEMD_USED" ]; then 96 if [ -n "${SYSTEMD_USED}" ]; then
102 echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} 97 echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf}
103 else 98 else
104 echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} 99 echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf}
@@ -113,7 +108,7 @@ IMAGE_CMD_ostree () {
113 bbfatal "Data in /root directory is not preserved by OSTree." 108 bbfatal "Data in /root directory is not preserved by OSTree."
114 fi 109 fi
115 110
116 if [ -n "$SYSTEMD_USED" ]; then 111 if [ -n "${SYSTEMD_USED}" ]; then
117 echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} 112 echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf}
118 else 113 else
119 echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf} 114 echo "mkdir -p /var/roothome; chown 755 /var/roothome" >>${tmpfiles_conf}
diff --git a/classes/image_types_ota.bbclass b/classes/image_types_ota.bbclass
index 790ac31..79de909 100644
--- a/classes/image_types_ota.bbclass
+++ b/classes/image_types_ota.bbclass
@@ -43,14 +43,7 @@ calculate_size () {
43 echo "${SIZE}" 43 echo "${SIZE}"
44} 44}
45 45
46export OSTREE_OSNAME 46OTA_SYSROOT = "${WORKDIR}/ota-sysroot"
47export OSTREE_BRANCHNAME
48export OSTREE_REPO
49export OSTREE_BOOTLOADER
50
51export GARAGE_TARGET_NAME
52
53export OTA_SYSROOT="${WORKDIR}/ota-sysroot"
54 47
55## Common OTA image setup 48## Common OTA image setup
56fakeroot do_otasetup () { 49fakeroot do_otasetup () {
@@ -88,7 +81,6 @@ fakeroot do_otasetup () {
88 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) 81 ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME})
89 82
90 ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} 83 ostree --repo=${OTA_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash}
91 export OSTREE_BOOT_PARTITION="/boot"
92 kargs_list="" 84 kargs_list=""
93 for arg in ${OSTREE_KERNEL_ARGS}; do 85 for arg in ${OSTREE_KERNEL_ARGS}; do
94 kargs_list="${kargs_list} --karg-append=$arg" 86 kargs_list="${kargs_list} --karg-append=$arg"
diff --git a/classes/sota.bbclass b/classes/sota.bbclass
index 7fb54dc..e654071 100644
--- a/classes/sota.bbclass
+++ b/classes/sota.bbclass
@@ -1,4 +1,3 @@
1export BUILD_OTA_TARBALL
2python __anonymous() { 1python __anonymous() {
3 if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d): 2 if bb.utils.contains('DISTRO_FEATURES', 'sota', True, False, d):
4 d.appendVarFlag("do_image_wic", "depends", " %s:do_image_ota_ext4" % d.getVar("IMAGE_BASENAME", True)) 3 d.appendVarFlag("do_image_wic", "depends", " %s:do_image_ota_ext4" % d.getVar("IMAGE_BASENAME", True))
@@ -29,11 +28,13 @@ EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native
29INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}" 28INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'cpio.gz.u-boot', 'cpio.gz')}"
30 29
31# Please redefine OSTREE_REPO in order to have a persistent OSTree repo 30# Please redefine OSTREE_REPO in order to have a persistent OSTree repo
32OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" 31export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo"
33OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" 32export OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}"
34OSTREE_OSNAME ?= "poky" 33export OSTREE_OSNAME ?= "poky"
34export OSTREE_BOOTLOADER ??= 'u-boot'
35export OSTREE_BOOT_PARTITION ??= "/boot"
36
35INITRAMFS_IMAGE ?= "initramfs-ostree-image" 37INITRAMFS_IMAGE ?= "initramfs-ostree-image"
36OSTREE_BOOTLOADER ??= 'u-boot'
37 38
38GARAGE_SIGN_REPO ?= "${DEPLOY_DIR_IMAGE}/garage_sign_repo" 39GARAGE_SIGN_REPO ?= "${DEPLOY_DIR_IMAGE}/garage_sign_repo"
39GARAGE_SIGN_KEYNAME ?= "garage-key" 40GARAGE_SIGN_KEYNAME ?= "garage-key"