aboutcode-toolkit
aboutcode-toolkit copied to clipboard
Simplify attribution when using nexB-specific inventories
I am using the develop branch of aboutcode-toolkit
.
It would be nice to have aboutcode toolkit generate attribution from a nexB inventory workbook without the use of vartext or aliases.
When I run about attrib <path to inventory workbook> <path to attribution report>
, I get these errors:
Command completed with 2 errors or warnings.
ERROR: Field name: ['issue ref#', 'resource path', 'resource name', 'item ref', 'item type', 'component name', 'component version', 'package type', 'package namespace', 'package name', 'package version', 'license category(ies)', 'license name(s)', 'concluded license expression', 'concluded copyright holder', 'internal use only', 'analysis notes', 'homepage url', 'download url', 'license url', 'detected license expression', 'detected copyright'] contains illegal name characters (or empty spaces) and is ignored.
CRITICAL: Field name is required and empty
My workaround is to create another xlsx sheet where I:
- take the component name and package names and put them into the same column named
name
- collect the component and package versions into the
version
column - take the the concluded license expressions and rename the column
license_expression
- take the concluded holders and rename the column
copyright
Here are couple of items to address:
- For the renaming/key mapping process, we can use the
transform
utility to help (https://aboutcode-toolkit.readthedocs.io/en/latest/reference.html#transform) - The errors shown above (Both ERROR and CRITICAL) are rules in the SPEC:
- ABCTK does not allow special characters (including space)
- name is the "Required" field
- You brought up a good sample of potential issue as AbcTK only has 1
name
field while the input may contains more than 1 name field such asComponent Name
andPackage Name
. We cannot do something like the following config file with thetransform
utility
field_renamings:
about_resource : 'Directory / Filename'
name : `Component Name`
name: 'Package Name'
because whatever come last will be used for the mapping.
As a result, from the above config, the name
will use the Package Name
and whenever the Package Name
is empty, it'll cause error as name
is a required field.
There are 2 solutions:
- As suggested in the ticket, manually created a new column called
name
and then copy the value fromComponent Name
orPackage Name
so that user have the full control or what is the name to use - Implement some logic to choose which should be the name used if there are 2
name
(same field name) in the config file.
Feedback and sugggestions are welcome.
I think the transform
is the way for this issue. That's to create a sepecifc transform config file for the field renaming for the nexB-specific inventories.