aboutcode-org / aboutcode-org/purldb

purlcli: purl2scan

未關閉
#277 4 則留言 0 個 reaction 已指派 1 人 已被 @johnmhoran 認領 在 GitHub 檢視
主要語言
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 還沒有評估資料。

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

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