diff mbox series

[isar-cip-core] swupdate-config: add prefix to variables

Message ID 20210430122020.13407-1-Quirin.Gylstorff@siemens.com (mailing list archive)
State New
Headers show
Series [isar-cip-core] swupdate-config: add prefix to variables | expand

Commit Message

Quirin Gylstorff April 30, 2021, 12:20 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

The variables U_BOOT and BOOTLOADER are only used for swupdate
mark add the prefix SWUPDATE to indicate the intended usage.

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 classes/swupdate-config.bbclass | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

Comments

Jan Kiszka April 30, 2021, 12:32 p.m. UTC | #1
On 30.04.21 14:20, Q. Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> The variables U_BOOT and BOOTLOADER are only used for swupdate
> mark add the prefix SWUPDATE to indicate the intended usage.

Does not fully parse to me. Do you mean

"The variables U_BOOT and BOOTLOADER are only used for swupdate.
Add the prefix SWUPDATE to indicate the intended usage."

?

> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  classes/swupdate-config.bbclass | 14 +++++++++-----
>  1 file changed, 9 insertions(+), 5 deletions(-)
> 
> diff --git a/classes/swupdate-config.bbclass b/classes/swupdate-config.bbclass
> index 9909113..8ec1104 100644
> --- a/classes/swupdate-config.bbclass
> +++ b/classes/swupdate-config.bbclass
> @@ -45,19 +45,23 @@ KFEATURE_ubi[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_ubi.snippet"
>  
>  KFEATURE_DEPS[ubi] = "mtd"
>  
> +
> +SWUPDATE_BOOTLOADER ?= "${BOOTLOADER}"

This doesn't make sense. There is no generic variable "BOOTLOADER" in Isar.

> +SWUPDATE_U_BOOT ?= "${U_BOOT}"

That one as well. What is "U_BOOT"?

>  USE_U_BOOT_CONFIG ?= "true"
> +
>  KFEATURE_u-boot = ""
>  KFEATURE_u-boot[BUILD_DEB_DEPENDS] = "libubootenv-dev"
>  KFEATURE_u-boot[DEBIAN_DEPENDS] = "${@ 'libubootenv0.1, u-boot-${MACHINE}-config' \
>                                            if d.getVar("USE_U_BOOT_CONFIG", True) == "true" \
>                                            else 'libubootenv0.1'}"
> -KFEATURE_u-boot[DEPENDS] = "${U_BOOT} libubootenv"
> +KFEATURE_u-boot[DEPENDS] = "${SWUPDATE_U_BOOT} libubootenv"
>  KFEATURE_u-boot[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_u-boot.snippet"
>  
>  SWUPDATE_LUASCRIPT ?= "swupdate_handlers.lua"
>  
>  def get_bootloader_featureset(d):
> -    bootloader = d.getVar("BOOTLOADER", True) or ""
> +    bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or ""
>      if bootloader == "efibootguard":
>          return "efibootguard"
>      if bootloader == "u-boot":
> @@ -68,11 +72,11 @@ SWUPDATE_KFEATURES ??= ""
>  KFEATURES = "${SWUPDATE_KFEATURES}"
>  KFEATURES += "${@get_bootloader_featureset(d)}"
>  
> -# Astonishingly, as an anonymous python function, BOOTLOADER is always None
> +# Astonishingly, as an anonymous python function, SWUPDATE_BOOTLOADER is always None
>  # one time before it gets set. So the following must be a task.
>  python do_check_bootloader () {
> -    bootloader = d.getVar("BOOTLOADER", True) or "None"
> +    bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "None"
>      if not bootloader in ["efibootguard", "u-boot"]:
> -        bb.warn("swupdate: BOOTLOADER set to incompatible value: " + bootloader)
> +        bb.warn("swupdate: SWUPDATE_BOOTLOADER set to incompatible value: " + bootloader)
>  }
>  addtask check_bootloader before do_fetch
> 

Please also clean up kas/opt/ebg-swu.yml, switching to the SWUPDATE
prefixed var name.

Jan
diff mbox series

Patch

diff --git a/classes/swupdate-config.bbclass b/classes/swupdate-config.bbclass
index 9909113..8ec1104 100644
--- a/classes/swupdate-config.bbclass
+++ b/classes/swupdate-config.bbclass
@@ -45,19 +45,23 @@  KFEATURE_ubi[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_ubi.snippet"
 
 KFEATURE_DEPS[ubi] = "mtd"
 
+
+SWUPDATE_BOOTLOADER ?= "${BOOTLOADER}"
+SWUPDATE_U_BOOT ?= "${U_BOOT}"
 USE_U_BOOT_CONFIG ?= "true"
+
 KFEATURE_u-boot = ""
 KFEATURE_u-boot[BUILD_DEB_DEPENDS] = "libubootenv-dev"
 KFEATURE_u-boot[DEBIAN_DEPENDS] = "${@ 'libubootenv0.1, u-boot-${MACHINE}-config' \
                                           if d.getVar("USE_U_BOOT_CONFIG", True) == "true" \
                                           else 'libubootenv0.1'}"
-KFEATURE_u-boot[DEPENDS] = "${U_BOOT} libubootenv"
+KFEATURE_u-boot[DEPENDS] = "${SWUPDATE_U_BOOT} libubootenv"
 KFEATURE_u-boot[KCONFIG_SNIPPETS] = "file://swupdate_defconfig_u-boot.snippet"
 
 SWUPDATE_LUASCRIPT ?= "swupdate_handlers.lua"
 
 def get_bootloader_featureset(d):
-    bootloader = d.getVar("BOOTLOADER", True) or ""
+    bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or ""
     if bootloader == "efibootguard":
         return "efibootguard"
     if bootloader == "u-boot":
@@ -68,11 +72,11 @@  SWUPDATE_KFEATURES ??= ""
 KFEATURES = "${SWUPDATE_KFEATURES}"
 KFEATURES += "${@get_bootloader_featureset(d)}"
 
-# Astonishingly, as an anonymous python function, BOOTLOADER is always None
+# Astonishingly, as an anonymous python function, SWUPDATE_BOOTLOADER is always None
 # one time before it gets set. So the following must be a task.
 python do_check_bootloader () {
-    bootloader = d.getVar("BOOTLOADER", True) or "None"
+    bootloader = d.getVar("SWUPDATE_BOOTLOADER", True) or "None"
     if not bootloader in ["efibootguard", "u-boot"]:
-        bb.warn("swupdate: BOOTLOADER set to incompatible value: " + bootloader)
+        bb.warn("swupdate: SWUPDATE_BOOTLOADER set to incompatible value: " + bootloader)
 }
 addtask check_bootloader before do_fetch