From 4fc100549aad39340a7d51abb056d62ce8a6905f Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Fri, 19 Feb 2016 12:33:52 +0100 Subject: Format os-release file as specified in standard MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit os-release spec: https://www.freedesktop.org/software/systemd/man/os-release.html "Variable assignment values must be enclosed in double or single quotes if they include spaces, semicolons or other special characters outside of A–Z, a–z, 0–9." Some tools might fail to read the file properly. Dracut for example prints warnings when parsing os-release file. Change-Id: I678a59aa8f33aa0c0398afb8ac87384f7ed52bc8 Reviewed-by: Samuli Piippo --- recipes/os-release/os-release.bbappend | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 recipes/os-release/os-release.bbappend diff --git a/recipes/os-release/os-release.bbappend b/recipes/os-release/os-release.bbappend new file mode 100644 index 0000000..98e2d16 --- /dev/null +++ b/recipes/os-release/os-release.bbappend @@ -0,0 +1,39 @@ +############################################################################## +## +## Copyright (C) 2016 The Qt Company Ltd. +## Contact: http://www.qt.io/licensing/ +## +## This file is part of the Boot to Qt meta layer. +## +## $QT_BEGIN_LICENSE:COMM$ +## +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see http://www.qt.io/terms-conditions. For further +## information use the contact form at http://www.qt.io/contact-us. +## +## $QT_END_LICENSE$ +## +############################################################################## + +# Reported upstream https://bugzilla.yoctoproject.org/show_bug.cgi?id=9144 +python do_fix_quotes () { + with open(d.expand('${B}/os-release'), 'w') as f: + for field in d.getVar('OS_RELEASE_FIELDS', True).split(): + value = d.getVar(field, True) + if value: + f.write('{0}="{1}"\n'.format(field, value)) +} + +do_verify_if_fixed_by_upstream () { + pretty_name_first_char=$(cat ${B}/os-release | grep "^PRETTY_NAME" | cut -f 2 -d '=' | cut -c1) + if [ "${pretty_name_first_char}" = "\"" ]] ; then + bbwarn "Issue appears to be fixed by upstream, remove this workaround." + fi +} + +addtask do_verify_if_fixed_by_upstream after do_compile before do_install +addtask do_fix_quotes after do_verify_if_fixed_by_upstream before do_install -- cgit v1.2.3-54-g00ecf