aboutcode-org / aboutcode-org/scancode-toolkit

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

未關閉
#2,674 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
bug
主要語言
Python
星號
2.6k
分支
791
平均合併
1 天 12 小時
30 天內合併 PR
5

描述

### 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](https://github.com/nexB/scancode-toolkit/blob/develop/requirements.txt)

**Problem**: When generating a scancode report the cli tools from [spdx-tool / tools-python](https://github.com/spdx/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
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

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。