@@ -255,22 +255,54 @@ The output files are::
255255Step 5: Collect expected resolved packages
256256----------------------------------------------
257257
258- TODO: explain how to do this in details
258+ Run this python script to generate text file with expected purls
259+
260+ ::
261+
262+ import json
263+ with open("~/tmp/pyinsp-example/codebase/output/deployed-scan-output.json") as f:
264+ scancode_data = json.load(f)
265+ scancode_purls = []
266+ for package in scancode_data["packages"]:
267+ if package["purl"] not in scancode_purls:
268+ scancode_purls.append(package["purl"])
269+ scancode_purls = sorted(scancode_purls)
270+ with open("~/tmp/pyinsp-example/codebase/output/scan.txt", "w") as f:
271+ f.writelines("\n".join(scancode_purls))
272+
259273
260274The output is a list of expected purls with a version.
261275
262276
263277Step 6: Collect actual resolved packages
264278----------------------------------------------
265279
266- TODO: explain how to do this in details
280+ Run this python script to generate text file with actual purls
281+
282+ ::
283+
284+ import json
285+ py_insp_purls = []
286+ for json_file in [
287+ "~/tmp/pyinsp-example/output/resolved-rtd-requirements.txt.json",
288+ "~/tmp/pyinsp-example/output/resolved-requirements.txt.json",
289+ ]:
290+ with open(json_file) as f:
291+ py_insp_data = json.load(f)
292+ for package in py_insp_data["packages"]:
293+ if package["purl"] not in py_insp_purls:
294+ py_insp_purls.append(package["purl"])
295+ py_insp_purls = sorted(py_insp_purls)
296+ with open("~/tmp/pyinsp-example/codebase/output/py-insp.txt", "w") as f:
297+ f.writelines("\n".join(py_insp_purls))
298+
267299
268300The output is a list of actual purls with a version.
269301
270302
271303Step 7: Compare expected with actual resolved packages
272304---------------------------------------------------------
273305
274- TODO: explain how to do this in details
275-
306+ We run a sdiff command::
276307
308+ sdiff ~/tmp/pyinsp-example/codebase/output/py-insp.txt ~/tmp/pyinsp-example/codebase/output/scan.txt
0 commit comments