Lines Matching refs:pkg

467 async def check_url_status(session, pkg, npkgs, retry=True):  argument
471 async with session.get(pkg.url) as resp:
473 pkg.status['url'] = ("error", "invalid {}".format(resp.status))
475 print("[%04d/%04d] %s" % (check_url_count, npkgs, pkg.name))
479 return await check_url_status(session, pkg, npkgs, retry=False)
481 pkg.status['url'] = ("error", "invalid (err)")
483 print("[%04d/%04d] %s" % (check_url_count, npkgs, pkg.name))
486 pkg.status['url'] = ("ok", "valid")
488 print("[%04d/%04d] %s" % (check_url_count, npkgs, pkg.name))
497 for pkg in packages:
498 tasks.append(asyncio.ensure_future(check_url_status(sess, pkg, len(packages))))
502 def check_package_latest_version_set_status(pkg, status, version, identifier): argument
503 pkg.latest_version = {
509 if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
510 pkg.status['version'] = ('warning', "Release Monitoring API error")
511 elif pkg.latest_version['status'] == RM_API_STATUS_NOT_FOUND:
512 pkg.status['version'] = ('warning', "Package not found on Release Monitoring")
514 if pkg.latest_version['version'] is None:
515 pkg.status['version'] = ('warning', "No upstream version available on Release Monitoring")
516 elif pkg.latest_version['version'] != pkg.current_version:
517pkg.status['version'] = ('error', "The newer version {} is available upstream".format(pkg.latest_v…
519 pkg.status['version'] = ('ok', 'up-to-date')
522 async def check_package_get_latest_version_by_distro(session, pkg, retry=True): argument
523 url = "https://release-monitoring.org/api/project/Buildroot/%s" % pkg.name
536 check_package_latest_version_set_status(pkg,
544 return await check_package_get_latest_version_by_distro(session, pkg, retry=False)
549 async def check_package_get_latest_version_by_guess(session, pkg, retry=True): argument
550 url = "https://release-monitoring.org/api/projects/?pattern=%s" % pkg.name
558 … projects = [p for p in data['projects'] if p['name'] == pkg.name and 'stable_versions' in p]
567 check_package_latest_version_set_status(pkg,
575 return await check_package_get_latest_version_by_guess(session, pkg, retry=False)
583 async def check_package_latest_version_get(session, pkg, npkgs): argument
586 if await check_package_get_latest_version_by_distro(session, pkg):
588 print("[%04d/%04d] %s" % (check_latest_count, npkgs, pkg.name))
591 if await check_package_get_latest_version_by_guess(session, pkg):
593 print("[%04d/%04d] %s" % (check_latest_count, npkgs, pkg.name))
596 check_package_latest_version_set_status(pkg,
600 print("[%04d/%04d] %s" % (check_latest_count, npkgs, pkg.name))
618 for pkg in [p for p in packages if not p.is_actual_package]:
619 pkg.status['version'] = ("na", "no valid package infra")
625 for pkg in packages:
626 … tasks.append(asyncio.ensure_future(check_package_latest_version_get(sess, pkg, len(packages))))
634 for pkg in cpe_product_pkgs[product]:
635 cve_status = cve.affects(pkg.name, pkg.current_version, pkg.ignored_cves, pkg.cpeid)
637 pkg.cves.append(cve.identifier)
639 pkg.unsure_cves.append(cve.identifier)
647 for pkg in packages:
648 if not pkg.is_actual_package:
649 pkg.status['cve'] = ("na", "N/A")
651 if not pkg.current_version:
652 pkg.status['cve'] = ("na", "no version information available")
654 if pkg.cpeid:
655 cpe_product = cvecheck.cpe_product(pkg.cpeid)
656 cpe_product_pkgs[cpe_product].append(pkg)
658 cpe_product_pkgs[pkg.name].append(pkg)
663 for pkg in packages:
664 if 'cve' not in pkg.status:
665 if pkg.cves or pkg.unsure_cves:
666 pkg.status['cve'] = ("error", "affected by CVEs")
668 pkg.status['cve'] = ("ok", "not affected by CVEs")
674 for pkg in packages:
679 if len(pkg.infras) > 0:
680 infra = pkg.infras[0][1]
684 if pkg.is_status_ok('license'):
688 if pkg.is_status_ok('license-files'):
692 if pkg.is_status_ok('hash'):
696 if pkg.latest_version['status'] == RM_API_STATUS_FOUND_BY_DISTRO:
700 if not pkg.latest_version['version']:
702 elif pkg.latest_version['version'] == pkg.current_version:
706 stats["patches"] += pkg.patch_count
707 stats["total-cves"] += len(pkg.cves)
708 stats["total-unsure-cves"] += len(pkg.unsure_cves)
709 if len(pkg.cves) != 0:
711 if len(pkg.unsure_cves) != 0:
713 if pkg.cpeid:
911 def dump_html_pkg(f, pkg): argument
912 pkg_css_class = pkg.path.replace("/", "_")[:-3]
914 class="tree data _{pkg_css_class}">{pkg.tree}</div>\n')
916 class="package data _{pkg_css_class}">{pkg.path}</div>\n')
921 if pkg.patch_count == 0:
923 elif pkg.patch_count < 5:
932 infra = infra_str(pkg.infras)
946 if pkg.is_status_ok('license'):
957 if pkg.is_status_ok('license-files'):
968 if pkg.is_status_ok('hash'):
977 current_version = pkg.current_version
986 if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
988 if pkg.latest_version['version'] is None:
990 elif pkg.latest_version['version'] != pkg.current_version:
995 if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
997 elif pkg.latest_version['status'] == RM_API_STATUS_NOT_FOUND:
1000 if pkg.latest_version['version'] is None:
1008 if pkg.latest_version['status'] == RM_API_STATUS_FOUND_BY_DISTRO:
1019 if pkg.warnings == 0:
1021 elif pkg.warnings < 5:
1031 url_str = pkg.status['url'][1]
1032 if pkg.status['url'][0] in ("error", "warning"):
1034 if pkg.status['url'][0] == "error":
1046 if len(pkg.cves) > 10:
1048 if pkg.is_status_ok("cve"):
1050 elif pkg.is_status_error("cve"):
1052 elif pkg.is_status_na("cve") and not pkg.is_actual_package:
1057 if len(pkg.cves) > 10:
1058 cve_total = len(pkg.cves) + 1
1061 if pkg.is_status_error("cve"):
1062 for cve in cvecheck.CVE.sort_id(pkg.cves):
1064 for cve in cvecheck.CVE.sort_id(pkg.unsure_cves):
1066 elif pkg.is_status_na("cve"):
1076 if pkg.ignored_cves:
1079 for ignored_cve in pkg.ignored_cves:
1087 if pkg.is_status_ok("cpe"):
1089 elif pkg.is_status_error("cpe"):
1091 elif pkg.is_status_na("cpe") and not pkg.is_actual_package:
1096 if pkg.cpeid:
1097 cpeid_begin = ":".join(pkg.cpeid.split(":")[0:4]) + ":"
1098 cpeid_formatted = pkg.cpeid.replace(cpeid_begin, cpeid_begin + "<wbr>")
1100 if not pkg.is_status_ok("cpe"):
1101 if pkg.is_actual_package and pkg.current_version:
1102 if pkg.cpeid:
1109 f.write(" %s\n" % pkg.status['cpe'][1])
1146 for pkg in sorted(packages):
1147 dump_html_pkg(f, pkg)
1216 pkg.name: {
1218 for k, v in pkg.__dict__.items()
1220 } for pkg in packages
1313 for pkg in packages:
1314 pkg.set_infra(show_info_js)
1315 pkg.set_license()
1316 pkg.set_hash_info()
1317 pkg.set_patch_count()
1319 pkg.set_check_package_warnings()
1320 pkg.set_current_version()
1321 pkg.set_cpeid()
1322 pkg.set_url()
1323 pkg.set_ignored_cves()
1324 pkg.set_developers(developers)