@@ -255,22 +255,58 @@ 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+
264+ with open("~/tmp/pyinsp-example/codebase/output/deployed-scan-output.json") as f:
265+ scancode_data = json.load(f)
266+
267+ scancode_purls = []
268+ for package in scancode_data["packages"]:
269+ if package["purl"] not in scancode_purls:
270+ scancode_purls.append(package["purl"])
271+ scancode_purls = sorted(scancode_purls)
272+
273+ with open("~/tmp/pyinsp-example/codebase/output/scan.txt", "w") as f:
274+ f.writelines("\n ".join(scancode_purls))
275+
276+ ```
259277
260278The output is a list of expected purls with a version.
261279
262280
263281Step 6: Collect actual resolved packages
264282----------------------------------------------
265283
266- TODO: explain how to do this in details
284+ Run this python script to generate text file with actual purls
285+
286+ ::
287+
288+ import json
289+ py_insp_purls = []
290+ for json_file in [
291+ "~/tmp/pyinsp-example/output/resolved-rtd-requirements.txt.json",
292+ "~/tmp/pyinsp-example/output/resolved-requirements.txt.json",
293+ ]:
294+ with open(json_file) as f:
295+ py_insp_data = json.load(f)
296+ for package in py_insp_data["packages"]:
297+ if package["purl"] not in py_insp_purls:
298+ py_insp_purls.append(package["purl"])
299+ py_insp_purls = sorted(py_insp_purls)
300+ with open("~/tmp/pyinsp-example/codebase/output/py-insp.txt", "w") as f:
301+ f.writelines("\n".join(py_insp_purls))
302+
267303
268304The output is a list of actual purls with a version.
269305
270306
271307Step 7: Compare expected with actual resolved packages
272308---------------------------------------------------------
273309
274- TODO: explain how to do this in details
275-
310+ We run a sdiff command::
276311
312+ sdiff ~/tmp/pyinsp-example/codebase/output/py-insp.txt ~/tmp/pyinsp-example/codebase/output/scan.txt
0 commit comments