os-release: Fix VERSION_CODENAME in case it is empty

If DISTRO_CODENAME was not set, VERSION_CODENAME field was populated
with unparsed string. This resulted in the following line in os-release
file:

  VERSION_CODENAME="${DISTRO_CODENAME}"

According to systemd documentation, this field is optional.
Fix the problem by setting VERSION_CODENAME conditionally, only if
DISTRO_CODENAME was set.

(From OE-Core rev: 70a0b8bc1d846c857be90ce2e97e60c5ee32558e)

Signed-off-by: Daniel Semkowicz <dse@thaumatec.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Daniel Semkowicz
2024-06-20 15:03:31 +02:00
committed by Richard Purdie
parent 8de3508743
commit 0ed32141fe

View File

@@ -24,7 +24,7 @@ ID = "${DISTRO}"
NAME = "${DISTRO_NAME}"
VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}"
VERSION_ID = "${DISTRO_VERSION}"
VERSION_CODENAME = "${DISTRO_CODENAME}"
VERSION_CODENAME = "${@d.getVar('DISTRO_CODENAME') or ''}"
PRETTY_NAME = "${DISTRO_NAME} ${VERSION}"
# The vendor field is hardcoded to "openembedded" deliberately. We'd