aboutcode-org / aboutcode-org/purldb

purlcli: purl2scan

Aberta
#277 4 comentários 0 reações 1 responsável Reivindicada por @johnmhoran Ver no GitHub
Linguagem predominante
HTML
Estrelas
67
Forks
69
Merge médio
8d 8h
PRs com merge (30d)
1

Descrição

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

Guia de contribuição

Nenhum guia de contribuição indexado para este repositório

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.