diff options
| author | Daniel Wagenknecht <dwagenknecht@emlix.com> | 2025-09-22 10:02:08 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-10-04 15:16:04 +0100 |
| commit | b2a9b8930b549f59d32c2dc8890e42046c4356c8 (patch) | |
| tree | ec4f414f8502ef0c48f4130c5edf46ed59ae64b7 | |
| parent | 83840a21c50950dbeff9db0b73a6ef531331bb14 (diff) | |
| download | poky-b2a9b8930b549f59d32c2dc8890e42046c4356c8.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}" |
