diff options
-rw-r--r-- | meta/recipes-core/os-release/os-release.bb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb index 58364ea249..f519addd8d 100644 --- a/meta/recipes-core/os-release/os-release.bb +++ b/meta/recipes-core/os-release/os-release.bb | |||
@@ -23,11 +23,20 @@ PRETTY_NAME = "${DISTRO_NAME} ${VERSION}" | |||
23 | BUILD_ID ?= "${DATETIME}" | 23 | BUILD_ID ?= "${DATETIME}" |
24 | BUILD_ID[vardepsexclude] = "DATETIME" | 24 | BUILD_ID[vardepsexclude] = "DATETIME" |
25 | 25 | ||
26 | def sanitise_version(ver): | ||
27 | # VERSION_ID should be (from os-release(5)): | ||
28 | # lower-case string (mostly numeric, no spaces or other characters | ||
29 | # outside of 0-9, a-z, ".", "_" and "-") | ||
30 | ret = ver.replace('+', '-').replace(' ','_') | ||
31 | return ret.lower() | ||
32 | |||
26 | python do_compile () { | 33 | python do_compile () { |
27 | import shutil | 34 | import shutil |
28 | with open(d.expand('${B}/os-release'), 'w') as f: | 35 | with open(d.expand('${B}/os-release'), 'w') as f: |
29 | for field in d.getVar('OS_RELEASE_FIELDS', True).split(): | 36 | for field in d.getVar('OS_RELEASE_FIELDS', True).split(): |
30 | value = d.getVar(field, True) | 37 | value = d.getVar(field, True) |
38 | if value and field == 'VERSION_ID': | ||
39 | value = sanitise_version(value) | ||
31 | if value: | 40 | if value: |
32 | f.write('{0}="{1}"\n'.format(field, value)) | 41 | f.write('{0}="{1}"\n'.format(field, value)) |
33 | } | 42 | } |