aboutcode-org / aboutcode-org/purldb
purlcli: purl2scan
- Ngôn ngữ chính
- HTML
- Star
- 67
- Fork
- 69
- Merge trung bình
- 8 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 1
Mô tả
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
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.