aboutcode-org / aboutcode-org/purldb
purlcli: purl2scan
- 主要语言
- HTML
- 星标
- 67
- 派生
- 69
- 平均合并
- 8 天 8 小时
- 30 天内合并 PR
- 1
描述
scan: given a PURL, fetch the URLs and call a scancode.io API and run a scan with a scan_package pipeline, then return the scan results.
Either wait for the scan to complete or poll until completion. Later implement the same with PurlDB which has code in the "priority queue" to handle this.
See also https://github.com/nexB/dejacode/blob/main/dejacode_toolkit/scancodeio.py for inspiration. And https://github.com/nexB/dejacode/blob/b06b4f169547fc4ee1a070722aadb0ee573fa24f/dejacode_toolkit/scancodeio.py#L65 in particular.
As an example:
1. Say we start with this PURL: `pkg:maven/com.drewnoakes/metadata-extractor@2.9.1?type=src`
2. Next is to get the URLs for this PURL and this would be https://repo1.maven.org/maven2/com/drewnoakes/metadata-extractor/2.9.1/metadata-extractor-2.9.1.jar
3. Create a project with a POST yo https://scancode.io/api/projects/ with this JSON payload:
```JSON
{
"name": "scan-pkg:maven/com.drewnoakes/metadata-extractor@2.9.1?type=src",
"input_urls": ["https://repo1.maven.org/maven2/com/drewnoakes/metadata-extractor/2.9.1/metadata-extractor-2.9.1.jar"],
"pipeline": "scan_single_package",
"execute_now": true
}
```
5. Wait the scan to complete
6. Go batch to the API
- Fetch the outputs from https://scancode.io/api/projects/affacf01-78d5-4cc4-adaa-3eaf666c4e83/outputs/
- Or the results from https://scancode.io/api/projects/affacf01-78d5-4cc4-adaa-3eaf666c4e83/results/
(example URLS and UUIDs... incorrect otherwise)
7. Return the result as JSON
贡献指南
这个仓库没有索引到贡献指南
评估
这个 Issue 还没有评估数据。