Skip to content

Scancode report (RDF) can't be processed by spdx-tools #2674

Description

@hesa

Description

Background: Scancode generates SDPX version 2.1 (with --spdx-tv or --spdx-rdf) and uses spdx-tool (https://github.com/spdx/tools-python) version `0.6.1? as listed in requirements.txt

Problem: When generating a scancode report the cli tools from spdx-tool / tools-python (parser and convertor) can't process the file

How To Reproduce

$ scancode --version
ScanCode version 21.8.4

$ git clone https://github.com/spdx/tools-python.git

$ scancode   -clipe --license-text --license-text-diagnostics --classify --license-clarity-score --summary --summary-key-files --summary-with-details  -n $(cat /proc/cpuinfo | grep processor | wc -l) --spdx-rdf tools-python-spdx.rdf tools-python

$ file tools-python-spdx.rdf 
tools-python-spdx.rdf: XML 1.0 document, ASCII text

$ cd tools-python

$ virtualenv .

$ source bin/activate

$ pip install .

$ convertor --infile ../tools-python-spdx.rdf ../tools-python-spdx.tv
SPDXID must be "SPDXRef-[idstring]" where [idstring] is a unique string containing letters, numbers, ".", "-".
More than one File checksum defined.
More than one file copyright text defined.
Errors while parsing:  True

$ parser --force --file ../tools-python-spdx.rdf 
.... snip
FileCopyrightText Copyright 2014 Acme Inc. , ArtifactOfProjectName AcmeTest', ArtifactOfProjectHomePage http://www.acme.org
None, copyright None
copyright 2004-2020 Example Inc.
copyright 2004-2020 The OpenSSL Project
copyright 2004-2020 The OpenSSL Project Authors
copyrighted by the Free Software Foundation

Package summary: None
Package description: None
Package Files:
	File name: ./tools-python/spdx/cli_tools/convertor.py
Traceback (most recent call last):
  File "/home/hesa/tmp/tools-python/bin/parser", line 8, in <module>
    sys.exit(main())
  File "/home/hesa/tmp/tools-python/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/hesa/tmp/tools-python/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/hesa/tmp/tools-python/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/hesa/tmp/tools-python/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/hesa/tmp/tools-python/lib/python3.8/site-packages/spdx/cli_tools/parser.py", line 79, in main
    print("\tFile type: {0}".format(VALUES[f.type]))
KeyError: None

$ echo $?
1

System configuration

  • OS: Ubuntu", "20.04.2 LTS (Focal Fossa)"

  • Scancode version: 21.8.4

  • spdx-tools / tools-python version: 0.6.1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions