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>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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}"