Skip to content

Commit 8fc3d74

Browse files
committed
Stuff
1 parent 82d8b0f commit 8fc3d74

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

.github/scripts/ort-scanner.es

+26-7
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ init(#{ input := AnalyzerResult, path := GitRepo } = Args) ->
150150
~"end_time" => rfctime(),
151151
~"environment" => maps:get(~"environment", maps:get(~"analyzer", Analyzer)),
152152
~"provenances" => [ Provenance ],
153+
~"scan_results" => [],
153154
~"scanners" => #{ Id => [] },
154155
~"files" => [#{ ~"provenance" => PP,
155156
~"files" => FilesSha1Sum}]
@@ -231,8 +232,26 @@ scan(#{ input := InputScanResult, strategy := Strategy, tool := Tool, path := Pa
231232
#{ ~"scan_results" := ScanResults, ~"scanners" := Scanners } = InputScanner,
232233

233234
Area = setup_scan_area(InputScanner, Path, Strategy),
235+
236+
Mappings = maps:get(~"detected_license_mapping", maps:get(~"config", InputScanner, #{}),
237+
#{ ~"LicenseRef-scancode-agpl-generic-additional-terms" => ~"NOASSERTION",
238+
~"LicenseRef-scancode-free-unknown" => ~"NOASSERTION",
239+
~"LicenseRef-scancode-generic-cla" => ~"NOASSERTION",
240+
~"LicenseRef-scancode-generic-exception" => ~"NOASSERTION",
241+
~"LicenseRef-scancode-generic-export-compliance" => ~"NOASSERTION",
242+
~"LicenseRef-scancode-generic-tos" => ~"NOASSERTION",
243+
~"LicenseRef-scancode-generic-trademark" => ~"NOASSERTION",
244+
~"LicenseRef-scancode-gpl-generic-additional-terms" => ~"NOASSERTION",
245+
~"LicenseRef-scancode-other-copyleft" => ~"NOASSERTION",
246+
~"LicenseRef-scancode-other-permissive" => ~"NOASSERTION",
247+
~"LicenseRef-scancode-patent-disclaimer" => ~"NOASSERTION",
248+
~"LicenseRef-scancode-unknown" => ~"NOASSERTION",
249+
~"LicenseRef-scancode-unknown-license-reference" => ~"NOASSERTION",
250+
~"LicenseRef-scancode-unknown-spdx" => ~"NOASSERTION",
251+
~"LicenseRef-scancode-warranty-disclaimer" => ~"NOASSERTION"}),
252+
234253
#{ ~"scanner" := #{ ~"name" := ScannerName }} = NewScanResult =
235-
scan_area(Area, InputProvenance, Tool),
254+
scan_area(Area, InputProvenance, Mappings, Tool),
236255

237256
NewScanners = #{ K => lists:usort([ScannerName | V]) || K := V <- Scanners},
238257

@@ -280,7 +299,7 @@ setup_scan_area(Scanner, GitPath, Strategy) ->
280299

281300
TmpDir.
282301

283-
scan_area(Area, Provenance, "reuse") ->
302+
scan_area(Area, Provenance, _Mappings, "reuse") ->
284303
have_tools(["reuse"]),
285304
StartTime = rfctime(),
286305
Cmd = "cd " ++ Area ++ " && reuse lint -j",
@@ -317,7 +336,7 @@ scan_area(Area, Provenance, "reuse") ->
317336
~"licenses" => LS
318337
}
319338
};
320-
scan_area(Area, Provenance, "scancode") ->
339+
scan_area(Area, Provenance, Mappings, "scancode") ->
321340
have_tools(["scancode"]),
322341
StartTime = rfctime(),
323342
ScancodeResultFile = filename:join(Area,"scancode.json"),
@@ -326,8 +345,8 @@ scan_area(Area, Provenance, "scancode") ->
326345
io:format("Running: ~ts~n", [Cmd]),
327346
cmd(Cmd),
328347
ScancodeJson = decode(ScancodeResultFile),
329-
#{ ~"headers" := [#{ ~"tool_version" := Vsn }] } = ScancodeJson,
330-
NewScanResults = get_new_results(ScancodeJson, Area, []),
348+
#{ ~"headers" := [#{ ~"tool_version" := Vsn }] } = ScancodeJson,
349+
NewScanResults = get_new_results(ScancodeJson, Area, Mappings),
331350

332351
CS = [R || R = #{ ~"statement" := _ } <- NewScanResults],
333352
LS = [R || R = #{ ~"license" := _ } <- NewScanResults],
@@ -344,8 +363,8 @@ scan_area(Area, Provenance, "scancode") ->
344363
}.
345364

346365
%% Dig deep into the scancode result and fetch all license and copyright data from it.
347-
get_new_results(#{ ~"files" := Files }, Mappings, Area) ->
348-
lists:flatmap(fun(File) -> get_new_results(File, Mappings, Area) end, Files);
366+
get_new_results(#{ ~"files" := Files }, Area, Mappings) ->
367+
lists:flatmap(fun(File) -> get_new_results(File, Area, Mappings) end, Files);
349368
get_new_results(#{ ~"type" := ~"file", ~"path" := Path,
350369
~"license_detections" := Licenses,
351370
~"copyrights" := Copyrights

.github/workflows/main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ jobs:
866866
uses: actions/upload-artifact@4cec3d8aa04e39d1a68397de0c4cd6fb9dce8ec1 # ratchet:actions/[email protected]
867867
with:
868868
name: ort-no-reuse-sbom
869-
path: $HOME/.ort/ort-results/bom.spdx.json
869+
path: /home/runner/.ort/ort-results/bom.spdx.json
870870

871871
## If this is an "OTP-*" tag that has been pushed we do some release work
872872
release:

0 commit comments

Comments
 (0)