diff mbox series

[isar-cip-core,v2,1/3] swupdate-config: move swupdate.cfg from customizations to own recipe

Message ID 20240207134505.3286003-2-Quirin.Gylstorff@siemens.com (mailing list archive)
State Changes Requested
Headers show
Series Reduce difference to debian | expand

Commit Message

Gylstorff Quirin Feb. 7, 2024, 1:44 p.m. UTC
From: Quirin Gylstorff <quirin.gylstorff@siemens.com>

This allows downstream customizations without including unwanted
packages.

It also adds the possibilty to set the SWU_HW_COMPAT

Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
---
 recipes-core/customizations/common.inc        |  8 ++----
 .../swupdate-config/files/hwrevision.tmpl     |  1 +
 .../files/swupdate.cfg                        |  0
 .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
 4 files changed, 30 insertions(+), 6 deletions(-)
 create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
 rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
 create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb

Comments

Jan Kiszka Feb. 12, 2024, 6:46 p.m. UTC | #1
On 07.02.24 14:44, Quirin Gylstorff wrote:
> From: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> 
> This allows downstream customizations without including unwanted
> packages.
> 
> It also adds the possibilty to set the SWU_HW_COMPAT

You likely mean MACHINE_HW_VERSION.

This "HW" in SWU_SW_COMPAT and MACHINE_HW_VERSION confuses me, and both
variables are not documented. What does the HW stand for, and can we
please fix the documentation?

Jan

> 
> Signed-off-by: Quirin Gylstorff <quirin.gylstorff@siemens.com>
> ---
>  recipes-core/customizations/common.inc        |  8 ++----
>  .../swupdate-config/files/hwrevision.tmpl     |  1 +
>  .../files/swupdate.cfg                        |  0
>  .../swupdate-config/swupdate-config_0.1.bb    | 27 +++++++++++++++++++
>  4 files changed, 30 insertions(+), 6 deletions(-)
>  create mode 100644 recipes-core/swupdate-config/files/hwrevision.tmpl
>  rename recipes-core/{customizations => swupdate-config}/files/swupdate.cfg (100%)
>  create mode 100644 recipes-core/swupdate-config/swupdate-config_0.1.bb
> 
> diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
> index 79bf80d..37872c1 100644
> --- a/recipes-core/customizations/common.inc
> +++ b/recipes-core/customizations/common.inc
> @@ -19,8 +19,6 @@ SRC_URI = " \
>      file://99-silent-printk.conf \
>      file://99-watchdog.conf"
>  
> -SRC_URI:append:swupdate = " file://swupdate.cfg"
> -
>  CUSTOM_HOSTNAME ??= "demo"
>  WIRELESS_FIRMWARE_PACKAGE ?= ""
>  INSTALL_WIRELESS_TOOLS ??= "0"
> @@ -29,12 +27,14 @@ TEMPLATE_FILES += "postinst.tmpl"
>  TEMPLATE_VARS += "CUSTOM_HOSTNAME"
>  
>  DEPENDS += "sshd-regen-keys change-root-homedir"
> +RDEPENDS:append:swupdate = " swupdate-config"
>  
>  DEBIAN_DEPENDS = " \
>      ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
>      change-root-homedir \
>      ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
>  	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
> +DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
>  
>  do_install() {
>  	install -v -d ${D}/etc/network/interfaces.d
> @@ -46,7 +46,3 @@ do_install() {
>  	install -v -d ${D}/etc/systemd/system.conf.d
>  	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
>  }
> -
> -do_install:append:swupdate() {
> -	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
> -}
> diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
> new file mode 100644
> index 0000000..ec1d667
> --- /dev/null
> +++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
> @@ -0,0 +1 @@
> +cip-${MACHINE} ${IMAGE_HW_VERSION}
> diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
> similarity index 100%
> rename from recipes-core/customizations/files/swupdate.cfg
> rename to recipes-core/swupdate-config/files/swupdate.cfg
> diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
> new file mode 100644
> index 0000000..6991321
> --- /dev/null
> +++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
> @@ -0,0 +1,27 @@
> +#
> +# CIP Core, generic profile
> +#
> +# Copyright (c) Siemens AG, 2024
> +#
> +# Authors:
> +#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
> +#
> +# SPDX-License-Identifier: MIT
> +#
> +
> +inherit dpkg-raw
> +
> +SRC_URI = "file://swupdate.cfg \
> +           file://hwrevision.tmpl"
> +
> +MACHINE_HW_VERSION ??= ""
> +TEMPLATE_FILES += "hwrevision.tmpl"
> +TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
> +
> +do_install[cleandirs] = "${D}/etc/"
> +do_install() {
> +	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
> +        if [ -n "${MACHINE_HW_VERSION}" ]; then
> +            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
> +        fi
> +}
diff mbox series

Patch

diff --git a/recipes-core/customizations/common.inc b/recipes-core/customizations/common.inc
index 79bf80d..37872c1 100644
--- a/recipes-core/customizations/common.inc
+++ b/recipes-core/customizations/common.inc
@@ -19,8 +19,6 @@  SRC_URI = " \
     file://99-silent-printk.conf \
     file://99-watchdog.conf"
 
-SRC_URI:append:swupdate = " file://swupdate.cfg"
-
 CUSTOM_HOSTNAME ??= "demo"
 WIRELESS_FIRMWARE_PACKAGE ?= ""
 INSTALL_WIRELESS_TOOLS ??= "0"
@@ -29,12 +27,14 @@  TEMPLATE_FILES += "postinst.tmpl"
 TEMPLATE_VARS += "CUSTOM_HOSTNAME"
 
 DEPENDS += "sshd-regen-keys change-root-homedir"
+RDEPENDS:append:swupdate = " swupdate-config"
 
 DEBIAN_DEPENDS = " \
     ifupdown, isc-dhcp-client, net-tools, iputils-ping, ssh, sshd-regen-keys, \
     change-root-homedir \
     ${@(', iw, wireless-regdb, ' + d.getVar('WIRELESS_FIRMWARE_PACKAGE')) \
 	if d.getVar('INSTALL_WIRELESS_TOOLS') == '1' else ''}"
+DEBIAN_DEPENDS:append:swupdate = ", swupdate-config"
 
 do_install() {
 	install -v -d ${D}/etc/network/interfaces.d
@@ -46,7 +46,3 @@  do_install() {
 	install -v -d ${D}/etc/systemd/system.conf.d
 	install -v -m 644 ${WORKDIR}/99-watchdog.conf ${D}/etc/systemd/system.conf.d/
 }
-
-do_install:append:swupdate() {
-	install -v -m 644 ${WORKDIR}/swupdate.cfg ${D}/etc/
-}
diff --git a/recipes-core/swupdate-config/files/hwrevision.tmpl b/recipes-core/swupdate-config/files/hwrevision.tmpl
new file mode 100644
index 0000000..ec1d667
--- /dev/null
+++ b/recipes-core/swupdate-config/files/hwrevision.tmpl
@@ -0,0 +1 @@ 
+cip-${MACHINE} ${IMAGE_HW_VERSION}
diff --git a/recipes-core/customizations/files/swupdate.cfg b/recipes-core/swupdate-config/files/swupdate.cfg
similarity index 100%
rename from recipes-core/customizations/files/swupdate.cfg
rename to recipes-core/swupdate-config/files/swupdate.cfg
diff --git a/recipes-core/swupdate-config/swupdate-config_0.1.bb b/recipes-core/swupdate-config/swupdate-config_0.1.bb
new file mode 100644
index 0000000..6991321
--- /dev/null
+++ b/recipes-core/swupdate-config/swupdate-config_0.1.bb
@@ -0,0 +1,27 @@ 
+#
+# CIP Core, generic profile
+#
+# Copyright (c) Siemens AG, 2024
+#
+# Authors:
+#  Quirin Gylstorff <quirin.gylstorff@siemens.com>
+#
+# SPDX-License-Identifier: MIT
+#
+
+inherit dpkg-raw
+
+SRC_URI = "file://swupdate.cfg \
+           file://hwrevision.tmpl"
+
+MACHINE_HW_VERSION ??= ""
+TEMPLATE_FILES += "hwrevision.tmpl"
+TEMPLATE_VARS += "MACHINE MACHINE_HW_VERSION"
+
+do_install[cleandirs] = "${D}/etc/"
+do_install() {
+	install -v -m 644 "${WORKDIR}"/swupdate.cfg "${D}"/etc/
+        if [ -n "${MACHINE_HW_VERSION}" ]; then
+            install -v -m 644 "${WORKDIR}"/hwrevision "${D}"/etc/
+        fi
+}