Skip to content

Commit

Permalink
[extras] Fixup parsing and Readme to match LinuxLink behavior.
Browse files Browse the repository at this point in the history
- 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+"
  • Loading branch information
mochel-timesys committed May 6, 2020
1 parent 7f3119a commit 439d0a9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 20 deletions.
21 changes: 6 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+"
```


Expand Down
9 changes: 4 additions & 5 deletions classes/vigiles.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -248,21 +248,20 @@ 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

bb.debug(1, "Extra Package: %s, Version: %s, License: %s = %s" %
(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
Expand Down

0 comments on commit 439d0a9

Please sign in to comment.