mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-09-30 22:11:59 -09:00
support/scripts/pkg-stats: fixed numeral in beginning of CSS class
CSS classes are generated for each package name for sorting purposes, However some package names start with a number and this is not allowed. (see https://www.w3.org/TR/CSS2/syndata.html#value-def-identifier) Fix is to prepend a character to every class name such as "_". so every ".package" is now "._package". Signed-off-by: Sen Hastings <sen@phobosdpl.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
committed by
Thomas Petazzoni
parent
af13345d43
commit
ff3acfe13a
@@ -879,12 +879,12 @@ def boolean_str(b):
|
|||||||
|
|
||||||
|
|
||||||
def dump_html_pkg(f, pkg):
|
def dump_html_pkg(f, pkg):
|
||||||
f.write(f'<div id=\"package_{pkg.name}\" \
|
f.write(f'<div id=\"package__{pkg.name}\" \
|
||||||
class=\"package data {pkg.name}\">{pkg.path}</div>\n')
|
class=\"package data _{pkg.name}\">{pkg.path}</div>\n')
|
||||||
# Patch count
|
# Patch count
|
||||||
data_field_id = f'patch_count_{pkg.name}'
|
data_field_id = f'patch_count__{pkg.name}'
|
||||||
div_class = ["centered patch_count data"]
|
div_class = ["centered patch_count data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.patch_count == 0:
|
if pkg.patch_count == 0:
|
||||||
div_class.append("nopatches")
|
div_class.append("nopatches")
|
||||||
elif pkg.patch_count < 5:
|
elif pkg.patch_count < 5:
|
||||||
@@ -895,10 +895,10 @@ def dump_html_pkg(f, pkg):
|
|||||||
\">{str(pkg.patch_count)}</div>\n')
|
\">{str(pkg.patch_count)}</div>\n')
|
||||||
|
|
||||||
# Infrastructure
|
# Infrastructure
|
||||||
data_field_id = f'infrastructure_{pkg.name}'
|
data_field_id = f'infrastructure__{pkg.name}'
|
||||||
infra = infra_str(pkg.infras)
|
infra = infra_str(pkg.infras)
|
||||||
div_class = ["centered infrastructure data"]
|
div_class = ["centered infrastructure data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if infra == "Unknown":
|
if infra == "Unknown":
|
||||||
div_class.append("wrong")
|
div_class.append("wrong")
|
||||||
else:
|
else:
|
||||||
@@ -907,9 +907,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
\">{infra_str(pkg.infras)}</div>\n')
|
\">{infra_str(pkg.infras)}</div>\n')
|
||||||
|
|
||||||
# License
|
# License
|
||||||
data_field_id = f'license_{pkg.name}'
|
data_field_id = f'license__{pkg.name}'
|
||||||
div_class = ["centered license data"]
|
div_class = ["centered license data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.is_status_ok('license'):
|
if pkg.is_status_ok('license'):
|
||||||
div_class.append("correct")
|
div_class.append("correct")
|
||||||
else:
|
else:
|
||||||
@@ -918,9 +918,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
\">{boolean_str(pkg.is_status_ok("license"))}</div>\n')
|
\">{boolean_str(pkg.is_status_ok("license"))}</div>\n')
|
||||||
|
|
||||||
# License files
|
# License files
|
||||||
data_field_id = f'license_files_{pkg.name}'
|
data_field_id = f'license_files__{pkg.name}'
|
||||||
div_class = ["centered license_files data"]
|
div_class = ["centered license_files data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.is_status_ok('license-files'):
|
if pkg.is_status_ok('license-files'):
|
||||||
div_class.append("correct")
|
div_class.append("correct")
|
||||||
else:
|
else:
|
||||||
@@ -929,9 +929,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
\">{boolean_str(pkg.is_status_ok("license-files"))}</div>\n')
|
\">{boolean_str(pkg.is_status_ok("license-files"))}</div>\n')
|
||||||
|
|
||||||
# Hash
|
# Hash
|
||||||
data_field_id = f'hash_file_{pkg.name}'
|
data_field_id = f'hash_file__{pkg.name}'
|
||||||
div_class = ["centered hash_file data"]
|
div_class = ["centered hash_file data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.is_status_ok('hash'):
|
if pkg.is_status_ok('hash'):
|
||||||
div_class.append("correct")
|
div_class.append("correct")
|
||||||
else:
|
else:
|
||||||
@@ -940,7 +940,7 @@ def dump_html_pkg(f, pkg):
|
|||||||
\">{boolean_str(pkg.is_status_ok("hash"))}</div>\n')
|
\">{boolean_str(pkg.is_status_ok("hash"))}</div>\n')
|
||||||
|
|
||||||
# Current version
|
# Current version
|
||||||
data_field_id = f'current_version_{pkg.name}'
|
data_field_id = f'current_version__{pkg.name}'
|
||||||
if len(pkg.current_version) > 20:
|
if len(pkg.current_version) > 20:
|
||||||
current_version = pkg.current_version[:20] + "..."
|
current_version = pkg.current_version[:20] + "..."
|
||||||
else:
|
else:
|
||||||
@@ -949,8 +949,8 @@ def dump_html_pkg(f, pkg):
|
|||||||
class=\"centered current_version data {pkg.name}\">{current_version}</div>\n')
|
class=\"centered current_version data {pkg.name}\">{current_version}</div>\n')
|
||||||
|
|
||||||
# Latest version
|
# Latest version
|
||||||
data_field_id = f'latest_version_{pkg.name}'
|
data_field_id = f'latest_version__{pkg.name}'
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
div_class.append("latest_version data")
|
div_class.append("latest_version data")
|
||||||
if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
|
if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
|
||||||
div_class.append("version-error")
|
div_class.append("version-error")
|
||||||
@@ -982,9 +982,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{latest_version_text}</div>\n')
|
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{latest_version_text}</div>\n')
|
||||||
|
|
||||||
# Warnings
|
# Warnings
|
||||||
data_field_id = f'warnings_{pkg.name}'
|
data_field_id = f'warnings__{pkg.name}'
|
||||||
div_class = ["centered warnings data"]
|
div_class = ["centered warnings data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.warnings == 0:
|
if pkg.warnings == 0:
|
||||||
div_class.append("correct")
|
div_class.append("correct")
|
||||||
else:
|
else:
|
||||||
@@ -992,9 +992,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{pkg.warnings}</div>\n')
|
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{pkg.warnings}</div>\n')
|
||||||
|
|
||||||
# URL status
|
# URL status
|
||||||
data_field_id = f'upstream_url_{pkg.name}'
|
data_field_id = f'upstream_url__{pkg.name}'
|
||||||
div_class = ["centered upstream_url data"]
|
div_class = ["centered upstream_url data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
url_str = pkg.status['url'][1]
|
url_str = pkg.status['url'][1]
|
||||||
if pkg.status['url'][0] in ("error", "warning"):
|
if pkg.status['url'][0] in ("error", "warning"):
|
||||||
div_class.append("missing_url")
|
div_class.append("missing_url")
|
||||||
@@ -1007,9 +1007,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{url_str}</div>\n')
|
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{url_str}</div>\n')
|
||||||
|
|
||||||
# CVEs
|
# CVEs
|
||||||
data_field_id = f'cves_{pkg.name}'
|
data_field_id = f'cves__{pkg.name}'
|
||||||
div_class = ["centered cves data"]
|
div_class = ["centered cves data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.is_status_ok("cve"):
|
if pkg.is_status_ok("cve"):
|
||||||
div_class.append("cve-ok")
|
div_class.append("cve-ok")
|
||||||
elif pkg.is_status_error("cve"):
|
elif pkg.is_status_error("cve"):
|
||||||
@@ -1031,9 +1031,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
f.write(" </div>\n")
|
f.write(" </div>\n")
|
||||||
|
|
||||||
# CVEs Ignored
|
# CVEs Ignored
|
||||||
data_field_id = f'ignored_cves_{pkg.name}'
|
data_field_id = f'ignored_cves__{pkg.name}'
|
||||||
div_class = ["centered data ignored_cves"]
|
div_class = ["centered data ignored_cves"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.ignored_cves:
|
if pkg.ignored_cves:
|
||||||
div_class.append("cve_ignored")
|
div_class.append("cve_ignored")
|
||||||
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
|
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
|
||||||
@@ -1042,9 +1042,9 @@ def dump_html_pkg(f, pkg):
|
|||||||
f.write(" </div>\n")
|
f.write(" </div>\n")
|
||||||
|
|
||||||
# CPE ID
|
# CPE ID
|
||||||
data_field_id = f'cpe_id_{pkg.name}'
|
data_field_id = f'cpe_id__{pkg.name}'
|
||||||
div_class = ["left cpe_id data"]
|
div_class = ["left cpe_id data"]
|
||||||
div_class.append(pkg.name)
|
div_class.append(f'_{pkg.name}')
|
||||||
if pkg.is_status_ok("cpe"):
|
if pkg.is_status_ok("cpe"):
|
||||||
div_class.append("cpe-ok")
|
div_class.append("cpe-ok")
|
||||||
elif pkg.is_status_error("cpe"):
|
elif pkg.is_status_error("cpe"):
|
||||||
|
|||||||
Reference in New Issue
Block a user