Message ID | 20250922080354.86861-3-dwagenknecht@emlix.com |
---|---|
State | New |
Headers | show |
Series | [v2] os-release: do not add empty parentheses to VERSION | expand |
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb index e1906d05d..1d2bb0818 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}"
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. Signed-off-by: Daniel Wagenknecht <dwagenknecht@emlix.com> --- v2: Incorporated suggestion by Peter to properly handle both unset and empty DISTRO_CODENAME variable meta/recipes-core/os-release/os-release.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)