From 50f84f1cc73b6efc0a300d5450faa19920f100a9 Mon Sep 17 00:00:00 2001 From: Daniel Wagenknecht Date: Mon, 22 Sep 2025 10:02:08 +0200 Subject: os-release: do not add empty parentheses to VERSION Setting DISTRO_CODENAME to an empty string previously led to a VERSION field in /etc/os-release containing empty parantheses, e.g. DISTRO_VERSION = "5.0.12" DISTRO_CODENAME = "" ==> VERSION = "5.0.12 ()" This is probably not what a user expects, especially since it is quite common to set variables to empty strings to disable something in OE based builds, but using `unset VARNAME` seems pretty uncommon. Instead of adding the parentheses with the DISTRO_CODENAME if the variable is in the datastore add them only if the variable is not empty. (From OE-Core rev: e31eadaccbee4e5314e99093f2f6546555588796) Signed-off-by: Daniel Wagenknecht Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- meta/recipes-core/os-release/os-release.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb index e1906d05d8..1d2bb08186 100644 --- a/meta/recipes-core/os-release/os-release.bb +++ b/meta/recipes-core/os-release/os-release.bb @@ -22,7 +22,7 @@ OS_RELEASE_UNQUOTED_FIELDS = "ID VERSION_ID VARIANT_ID" ID = "${DISTRO}" NAME = "${DISTRO_NAME}" -VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}" +VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if (d.getVar('DISTRO_CODENAME') or '') != '' else ''}" VERSION_ID = "${DISTRO_VERSION}" VERSION_CODENAME = "${@d.getVar('DISTRO_CODENAME') or ''}" PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" -- cgit v1.2.3-54-g00ecf