From 455bb6baac9d48a7c990566404f251584979cd29 Mon Sep 17 00:00:00 2001 From: Ming Liu Date: Mon, 19 Nov 2018 10:48:58 +0100 Subject: 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 --- classes/image_types_ostree.bbclass | 13 ++++--------- classes/image_types_ota.bbclass | 8 -------- classes/sota.bbclass | 10 ++++++---- 3 files changed, 10 insertions(+), 21 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index e3cfc9d..9574521 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -6,19 +6,14 @@ do_image_ostree[depends] += "ostree-native:do_populate_sysroot \ ${OSTREE_INITRAMFS_IMAGE}:do_image_complete" do_image_ostree[lockfiles] += "${OSTREE_REPO}/ostree.lock" -export OSTREE_REPO -export OSTREE_BRANCHNAME -export GARAGE_TARGET_NAME - RAMDISK_EXT ?= ".${OSTREE_INITRAMFS_FSTYPES}" OSTREE_KERNEL ??= "${KERNEL_IMAGETYPE}" - OSTREE_COMMIT_SUBJECT ??= "Commit-id: ${IMAGE_NAME}" OSTREE_COMMIT_BODY ??= "" OSTREE_UPDATE_SUMMARY ??= "0" -export SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" +SYSTEMD_USED = "${@oe.utils.ifelse(d.getVar('VIRTUAL-RUNTIME_init_manager', True) == 'systemd', 'true', '')}" IMAGE_CMD_ostree () { if [ -z "$OSTREE_REPO" ]; then @@ -63,7 +58,7 @@ IMAGE_CMD_ostree () { fi done - if [ -n "$SYSTEMD_USED" ]; then + if [ -n "${SYSTEMD_USED}" ]; then mkdir -p usr/etc/tmpfiles.d tmpfiles_conf=usr/etc/tmpfiles.d/00ostree-tmpfiles.conf echo "d /var/rootdirs 0755 root root -" >>${tmpfiles_conf} @@ -99,7 +94,7 @@ IMAGE_CMD_ostree () { bbwarn "Data in /$dir directory is not preserved by OSTree. Consider moving it under /usr" fi - if [ -n "$SYSTEMD_USED" ]; then + if [ -n "${SYSTEMD_USED}" ]; then echo "d /var/rootdirs/${dir} 0755 root root -" >>${tmpfiles_conf} else echo "mkdir -p /var/rootdirs/${dir}; chown 755 /var/rootdirs/${dir}" >>${tmpfiles_conf} @@ -114,7 +109,7 @@ IMAGE_CMD_ostree () { bbfatal "Data in /root directory is not preserved by OSTree." fi - if [ -n "$SYSTEMD_USED" ]; then + if [ -n "${SYSTEMD_USED}" ]; then echo "d /var/roothome 0755 root root -" >>${tmpfiles_conf} else 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 04f9851..5d85b4c 100644 --- a/classes/image_types_ota.bbclass +++ b/classes/image_types_ota.bbclass @@ -44,13 +44,6 @@ calculate_size () { echo "${SIZE}" } -export OSTREE_OSNAME -export OSTREE_BRANCHNAME -export OSTREE_REPO -export OSTREE_BOOTLOADER - -export GARAGE_TARGET_NAME - IMAGE_CMD_otaimg () { if ${@bb.utils.contains('IMAGE_FSTYPES', 'otaimg', 'true', 'false', d)}; then if [ -z "$OSTREE_REPO" ]; then @@ -85,7 +78,6 @@ IMAGE_CMD_otaimg () { ostree_target_hash=$(cat ${OSTREE_REPO}/refs/heads/${OSTREE_BRANCHNAME}) ostree --repo=${PHYS_SYSROOT}/ostree/repo pull-local --remote=${OSTREE_OSNAME} ${OSTREE_REPO} ${ostree_target_hash} - export OSTREE_BOOT_PARTITION="/boot" kargs_list="" for arg in ${OSTREE_KERNEL_ARGS}; do kargs_list="${kargs_list} --karg-append=$arg" diff --git a/classes/sota.bbclass b/classes/sota.bbclass index 246865b..1517ceb 100644 --- a/classes/sota.bbclass +++ b/classes/sota.bbclass @@ -26,11 +26,13 @@ EXTRA_IMAGEDEPENDS_append_sota = " parted-native mtools-native dosfstools-native OSTREE_INITRAMFS_FSTYPES ??= "${@oe.utils.ifelse(d.getVar('OSTREE_BOOTLOADER', True) == 'u-boot', 'ext4.gz.u-boot', 'ext4.gz')}" # Please redefine OSTREE_REPO in order to have a persistent OSTree repo -OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" -OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" -OSTREE_OSNAME ?= "poky" +export OSTREE_REPO ?= "${DEPLOY_DIR_IMAGE}/ostree_repo" +export OSTREE_BRANCHNAME ?= "${SOTA_HARDWARE_ID}" +export OSTREE_OSNAME ?= "poky" +export OSTREE_BOOTLOADER ??= 'u-boot' +export OSTREE_BOOT_PARTITION ??= "/boot" + OSTREE_INITRAMFS_IMAGE ?= "initramfs-ostree-image" -OSTREE_BOOTLOADER ??= 'u-boot' GARAGE_SIGN_REPO ?= "${DEPLOY_DIR_IMAGE}/garage_sign_repo" GARAGE_SIGN_KEYNAME ?= "garage-key" -- cgit v1.2.3-54-g00ecf