diff options
author | Daniel Wagenknecht <dwagenknecht@emlix.com> | 2025-09-22 10:02:08 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-03 17:51:38 +0100 |
commit | cdb3e521ffee22807cec36e2af882273b73bc8cd (patch) | |
tree | efae97ab329ad0c098ff4fd5107e15bee385a8ea | |
parent | 782900aaee6e3338108b20695e2c469efc57a912 (diff) | |
download | poky-cdb3e521ffee22807cec36e2af882273b73bc8cd.tar.gz |
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 <dwagenknecht@emlix.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-core/os-release/os-release.bb | 2 |
1 files changed, 1 insertions, 1 deletions
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" | |||
22 | 22 | ||
23 | ID = "${DISTRO}" | 23 | ID = "${DISTRO}" |
24 | NAME = "${DISTRO_NAME}" | 24 | NAME = "${DISTRO_NAME}" |
25 | VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if 'DISTRO_CODENAME' in d else ''}" | 25 | VERSION = "${DISTRO_VERSION}${@' (%s)' % DISTRO_CODENAME if (d.getVar('DISTRO_CODENAME') or '') != '' else ''}" |
26 | VERSION_ID = "${DISTRO_VERSION}" | 26 | VERSION_ID = "${DISTRO_VERSION}" |
27 | VERSION_CODENAME = "${@d.getVar('DISTRO_CODENAME') or ''}" | 27 | VERSION_CODENAME = "${@d.getVar('DISTRO_CODENAME') or ''}" |
28 | PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" | 28 | PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" |