From 439d0a91394024911244e1058febb2933ba9ae2e Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Wed, 6 May 2020 09:25:30 -0700 Subject: [PATCH] [extras] Fixup parsing and Readme to match LinuxLink behavior. - Convert ' ' in product names to '-' - Convert ' ' in version strings to '.' - Check for 'product' in header instead of 'package' - Remove mention of ignoring '#' and blank lines in Readme We still ignore them, but LinuxLink doesn't support the same and we don't want to mis-lead users into thinking that they can rely on it being compatible with an online upload of the same file. - Remove quotes from single-license example, but add another example with a dual-license where the licenses are seperated by ',', therefore requiring quoting. - Tweak example in Readme to reflect the syntax updates: $ cat yocto-extra.csv product,version,license avahi,0.6 bash,4.0 bash,4.1,GPL 3.0 busybox, udev,,"GPLv2.0+, LGPL-2.1+" --- README.md | 21 ++++++--------------- classes/vigiles.bbclass | 9 ++++----- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 0e21b25..f2bf3d2 100644 --- a/README.md +++ b/README.md @@ -310,25 +310,16 @@ The CSV files consist of an optional header and the following fields: * (optional) Version - the version of the package used. * (optional) License - the license of the package used -Blank lines and those starting with **#** are ignored. - -One example: +The following example shows the accepted syntax for expressing extra packages: ```sh $ cat yocto-extra.csv -# Optional Header: product,version,license - -# Comments start with '#' and are ignored. - -avahi, 0.6 - -# Blank lines are also ignored - -bash, 4.0 -bash, 4.1, "GPL 3.0" - -busybox +avahi,0.6 +bash,4.0 +bash,4.1,GPL 3.0 +busybox, +udev,,"GPLv2.0+, LGPL-2.1+" ``` diff --git a/classes/vigiles.bbclass b/classes/vigiles.bbclass index a4832c0..c30eb0e 100644 --- a/classes/vigiles.bbclass +++ b/classes/vigiles.bbclass @@ -248,12 +248,12 @@ def _get_extra_packages(d): # Check for a CSV header of e.g. "package,version,license" and skip it header = extra_rows[0] - if header[0].lower() == "package": + if header[0].lower() == "product": extra_rows = extra_rows[1:] for row in extra_rows: - pkg = row[0] - ver = row[1] + pkg = row[0].replace(' ', '-') + ver = row[1].replace(' ', '.') license = row[2] license_key = pkg + ver @@ -261,8 +261,7 @@ def _get_extra_packages(d): (pkg, ver, license_key, license)) pkg_vers = set(additional['additional_packages'].get(pkg, [])) - if ver: - pkg_vers.add(ver) + pkg_vers.add(ver) additional['additional_packages'][pkg] = sorted(list(pkg_vers)) additional['additional_licenses'][license_key] = license