From: Sen Hastings <sen@phobosdpl.com>
To: buildroot@buildroot.org
Cc: Sen Hastings <sen@phobosdpl.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: [Buildroot] [PATCH 1/2] support/scripts/pkg-stats: fix duplicate package class names across rows
Date: Wed, 27 Jul 2022 21:14:43 -0500 [thread overview]
Message-ID: <20220728021444.135820-2-sen@phobosdpl.com> (raw)
In-Reply-To: <20220728021444.135820-1-sen@phobosdpl.com>
Like all good problems, disparate pieces work together to create
a "synergistically" hairy mess.
The sortGrid() overhaul highlighted a flaw in pkg-stats allowing
for duplicate package class names across rows.
As an example,
boot/barebox/barebox.mk and boot/barebox/barebox/barebox.mk
both get the classname ._barebox and so sortGrid() sticks them on
the same line giving a table with a vestigal row sticking out
of the right side like some kind of appendage.
Also I neglected to add a "_" to the current version column's cells
pkgname class so instead of "._pkgname" we had ".pkgname" and so
the cells were not collected properly as part of the row.
These issues explain the formatting weirdness.
package classnames are now ".path_to_package_makefile" without suffix
(.mk) (so ._boot_barebox_barebox and ._boot_barebox_barebox_barebox
instead of ._barebox) in order to guarantee uniqueness.
and what was *accidentally*
class="centered current_version data .barebox" is now
class="centered current_version data ._boot_barebox_barebox"
just like *all* the other cells in the row. :p
Signed-off-by: Sen Hastings <sen@phobosdpl.com>
---
support/scripts/pkg-stats | 53 ++++++++++++++++++++-------------------
1 file changed, 27 insertions(+), 26 deletions(-)
diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
index 9c37506cd4..d3ec65edbb 100755
--- a/support/scripts/pkg-stats
+++ b/support/scripts/pkg-stats
@@ -885,12 +885,13 @@ def boolean_str(b):
def dump_html_pkg(f, pkg):
- f.write(f'<div id=\"package__{pkg.name}\" \
- class=\"package data _{pkg.name}\">{pkg.path}</div>\n')
+ pkg_css_class = pkg.path.replace("/", "_")[:-3]
+ f.write(f'<div id=\"package__{pkg_css_class}\" \
+ class=\"package data _{pkg_css_class}\">{pkg.path}</div>\n')
# Patch count
- data_field_id = f'patch_count__{pkg.name}'
+ data_field_id = f'patch_count__{pkg_css_class}'
div_class = ["centered patch_count data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.patch_count == 0:
div_class.append("nopatches")
elif pkg.patch_count < 5:
@@ -901,10 +902,10 @@ def dump_html_pkg(f, pkg):
\">{str(pkg.patch_count)}</div>\n')
# Infrastructure
- data_field_id = f'infrastructure__{pkg.name}'
+ data_field_id = f'infrastructure__{pkg_css_class}'
infra = infra_str(pkg.infras)
div_class = ["centered infrastructure data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if infra == "Unknown":
div_class.append("wrong")
else:
@@ -913,9 +914,9 @@ def dump_html_pkg(f, pkg):
\">{infra_str(pkg.infras)}</div>\n')
# License
- data_field_id = f'license__{pkg.name}'
+ data_field_id = f'license__{pkg_css_class}'
div_class = ["centered license data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.is_status_ok('license'):
div_class.append("correct")
else:
@@ -924,9 +925,9 @@ def dump_html_pkg(f, pkg):
\">{boolean_str(pkg.is_status_ok("license"))}</div>\n')
# License files
- data_field_id = f'license_files__{pkg.name}'
+ data_field_id = f'license_files__{pkg_css_class}'
div_class = ["centered license_files data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.is_status_ok('license-files'):
div_class.append("correct")
else:
@@ -935,9 +936,9 @@ def dump_html_pkg(f, pkg):
\">{boolean_str(pkg.is_status_ok("license-files"))}</div>\n')
# Hash
- data_field_id = f'hash_file__{pkg.name}'
+ data_field_id = f'hash_file__{pkg_css_class}'
div_class = ["centered hash_file data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.is_status_ok('hash'):
div_class.append("correct")
else:
@@ -946,17 +947,17 @@ def dump_html_pkg(f, pkg):
\">{boolean_str(pkg.is_status_ok("hash"))}</div>\n')
# Current version
- data_field_id = f'current_version__{pkg.name}'
+ data_field_id = f'current_version__{pkg_css_class}'
if len(pkg.current_version) > 20:
current_version = pkg.current_version[:20] + "..."
else:
current_version = pkg.current_version
f.write(f' <div id=\"{data_field_id}\" \
- class=\"centered current_version data {pkg.name}\">{current_version}</div>\n')
+ class=\"centered current_version data _{pkg_css_class}\">{current_version}</div>\n')
# Latest version
- data_field_id = f'latest_version__{pkg.name}'
- div_class.append(f'_{pkg.name}')
+ data_field_id = f'latest_version__{pkg_css_class}'
+ div_class.append(f'_{pkg_css_class}')
div_class.append("latest_version data")
if pkg.latest_version['status'] == RM_API_STATUS_ERROR:
div_class.append("version-error")
@@ -988,9 +989,9 @@ def dump_html_pkg(f, pkg):
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{latest_version_text}</div>\n')
# Warnings
- data_field_id = f'warnings__{pkg.name}'
+ data_field_id = f'warnings__{pkg_css_class}'
div_class = ["centered warnings data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.warnings == 0:
div_class.append("correct")
else:
@@ -998,9 +999,9 @@ def dump_html_pkg(f, pkg):
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{pkg.warnings}</div>\n')
# URL status
- data_field_id = f'upstream_url__{pkg.name}'
+ data_field_id = f'upstream_url__{pkg_css_class}'
div_class = ["centered upstream_url data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
url_str = pkg.status['url'][1]
if pkg.status['url'][0] in ("error", "warning"):
div_class.append("missing_url")
@@ -1013,9 +1014,9 @@ def dump_html_pkg(f, pkg):
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">{url_str}</div>\n')
# CVEs
- data_field_id = f'cves__{pkg.name}'
+ data_field_id = f'cves__{pkg_css_class}'
div_class = ["centered cves data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.is_status_ok("cve"):
div_class.append("cve-ok")
elif pkg.is_status_error("cve"):
@@ -1037,9 +1038,9 @@ def dump_html_pkg(f, pkg):
f.write(" </div>\n")
# CVEs Ignored
- data_field_id = f'ignored_cves__{pkg.name}'
+ data_field_id = f'ignored_cves__{pkg_css_class}'
div_class = ["centered data ignored_cves"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.ignored_cves:
div_class.append("cve_ignored")
f.write(f' <div id=\"{data_field_id}\" class=\"{" ".join(div_class)}\">\n')
@@ -1048,9 +1049,9 @@ def dump_html_pkg(f, pkg):
f.write(" </div>\n")
# CPE ID
- data_field_id = f'cpe_id__{pkg.name}'
+ data_field_id = f'cpe_id__{pkg_css_class}'
div_class = ["left cpe_id data"]
- div_class.append(f'_{pkg.name}')
+ div_class.append(f'_{pkg_css_class}')
if pkg.is_status_ok("cpe"):
div_class.append("cpe-ok")
elif pkg.is_status_error("cpe"):
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-07-28 2:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-28 2:14 [Buildroot] [PATCH 0/2] support/scripts/pkg-stats: fix row/column ordering issues Sen Hastings
2022-07-28 2:14 ` Sen Hastings [this message]
2022-07-28 2:14 ` [Buildroot] [PATCH 2/2] support/scripts/pkg-stats: fixed sortGrid() performance Sen Hastings
2022-07-28 7:30 ` [Buildroot] [PATCH 0/2] support/scripts/pkg-stats: fix row/column ordering issues Thomas Petazzoni via buildroot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220728021444.135820-2-sen@phobosdpl.com \
--to=sen@phobosdpl.com \
--cc=buildroot@buildroot.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox