From: Sen Hastings <sen@phobosdpl.com>
To: buildroot@buildroot.org
Cc: Sen Hastings <sen@phobosdpl.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [Buildroot] [PATCH 2/2] support/scripts/pkg-stats: remove remaining double quote escaping
Date: Thu, 18 Aug 2022 17:36:03 -0500 [thread overview]
Message-ID: <20220818223603.45459-2-sen@phobosdpl.com> (raw)
In-Reply-To: <20220818223603.45459-1-sen@phobosdpl.com>
On 8/6/22 16:56, Thomas Petazzoni wrote:
> This is done either by switching to single quoted f-strings, triple
> double quoted f-strings when needed, or simply single-quoted strings.
>
> The renderer HTML is exactly identical before/after this commit.
>
yeah looks good.
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Tested-By: Sen Hastings <sen@phobosdpl.com>
Acked-By: Sen Hastings <sen@phobosdpl.com>
> ---
> support/scripts/pkg-stats | 67 +++++++++++++++++++--------------------
> 1 file changed, 32 insertions(+), 35 deletions(-)
>
> diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats
> index 572757b7ea..aa3b49c809 100755
> --- a/support/scripts/pkg-stats
> +++ b/support/scripts/pkg-stats
> @@ -1010,13 +1010,12 @@ def dump_html_pkg(f, pkg):
> if pkg.latest_version['version'] is None:
> latest_version_text = "<b>Found, but no version</b>"
> else:
> - latest_version_text = "<a href=\"https://release-monitoring.org/project/%s\"><b>%s</b></a>" % \
> - (pkg.latest_version['id'], str(pkg.latest_version['version']))
> + latest_version_text = f"""<a href="https://release-monitoring.org/project/{pkg.latest_version['id']}"><b>{str(pkg.latest_version['version'])}</b></a>"""
>
> latest_version_text += "<br/>"
>
> if pkg.latest_version['status'] == RM_API_STATUS_FOUND_BY_DISTRO:
> - latest_version_text += "found by <a href=\"https://release-monitoring.org/distro/Buildroot/\">distro</a>"
> + latest_version_text += f'found by <a href="https://release-monitoring.org/distro/Buildroot/">distro</a>'
> else:
> latest_version_text += "found by guess"
>
> @@ -1041,10 +1040,10 @@ def dump_html_pkg(f, pkg):
> div_class.append("missing_url")
> if pkg.status['url'][0] == "error":
> div_class.append("invalid_url")
> - url_str = "<a href=\"%s\">%s</a>" % (pkg.url, pkg.status['url'][1])
> + url_str = f"""<a href="{pkg.url}">{pkg.status['url'][1]}</a>"""
> else:
> div_class.append("good_url")
> - url_str = "<a href=\"%s\">Link</a>" % pkg.url
> + url_str = f'<a href="{pkg.url}">Link</a>'
> f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">{url_str}</div>\n')
>
> # CVEs
> @@ -1068,11 +1067,11 @@ def dump_html_pkg(f, pkg):
> class="see-more centered cve_ignored">see all ({cve_total}) ▾</div>\n')
> if pkg.is_status_error("cve"):
> for cve in pkg.cves:
> - f.write(" <a href=\"https://security-tracker.debian.org/tracker/%s\">%s</a><br/>\n" % (cve, cve))
> + f.write(f' <a href="https://security-tracker.debian.org/tracker/{cve}">{cve}</a><br/>\n')
> for cve in pkg.unsure_cves:
> - f.write(" <a href=\"https://security-tracker.debian.org/tracker/%s\">%s <i>(unsure)</i></a><br/>\n" % (cve, cve))
> + f.write(f' <a href="https://security-tracker.debian.org/tracker/{cve}">{cve} <i>(unsure)</i></a><br/>\n')
> elif pkg.is_status_na("cve"):
> - f.write(" %s" % pkg.status['cve'][1])
> + f.write(f""" {pkg.status['cve'][1]}""")
> else:
> f.write(" N/A\n")
> f.write(" </div>\n")
> @@ -1085,7 +1084,7 @@ def dump_html_pkg(f, pkg):
> div_class.append("cve_ignored")
> f.write(f' <div id="{data_field_id}" class="{" ".join(div_class)}">\n')
> for ignored_cve in pkg.ignored_cves:
> - f.write(" <a href=\"https://security-tracker.debian.org/tracker/%s\">%s</a><br/>\n" % (ignored_cve, ignored_cve))
> + f.write(f' <a href="https://security-tracker.debian.org/tracker/{ignored_cve}">{ignored_cve}</a><br/>\n')
> f.write(" </div>\n")
>
> # CPE ID
> @@ -1108,11 +1107,9 @@ def dump_html_pkg(f, pkg):
> if not pkg.is_status_ok("cpe"):
> if pkg.is_actual_package and pkg.current_version:
> if pkg.cpeid:
> - f.write(" <br/>%s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" % # noqa: E501
> - (pkg.status['cpe'][1], ":".join(pkg.cpeid.split(":")[0:5])))
> + f.write(f""" <br/>{pkg.status['cpe'][1]} <a href="https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword={":".join(pkg.cpeid.split(":")[0:5])}">(Search)</a>\n""") # noqa: E501
> else:
> - f.write(" %s <a href=\"https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword=%s\">(Search)</a>\n" % # noqa: E501
> - (pkg.status['cpe'][1], pkg.name))
> + f.write(f""" {pkg.status['cpe'][1]} <a href="https://nvd.nist.gov/products/cpe/search/results?namingFormat=2.3&keyword={pkg.name}">(Search)</a>\n""") # noqa: E501
> else:
> f.write(" %s\n" % pkg.status['cpe'][1])
>
> @@ -1155,49 +1152,49 @@ def dump_html_all_pkgs(f, packages):
>
>
> def dump_html_stats(f, stats):
> - f.write("<a id=\"results\"></a>\n")
> - f.write("<div class=\"data\" id=\"results-grid\">\n")
> + f.write('<a id="results"></a>\n')
> + f.write('<div class="data" id="results-grid">\n')
> infras = [infra[6:] for infra in stats.keys() if infra.startswith("infra-")]
> for infra in infras:
> - f.write(" <div class=\"data\">Packages using the <i>%s</i> infrastructure</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages using the <i>%s</i> infrastructure</div><div class="data">%s</div>\n' %
> (infra, stats["infra-%s" % infra]))
> - f.write(" <div class=\"data\">Packages having license information</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages having license information</div><div class="data">%s</div>\n' %
> stats["license"])
> - f.write(" <div class=\"data\">Packages not having license information</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages not having license information</div><div class="data">%s</div>\n' %
> stats["no-license"])
> - f.write(" <div class=\"data\">Packages having license files information</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages having license files information</div><div class="data">%s</div>\n' %
> stats["license-files"])
> - f.write(" <div class=\"data\">Packages not having license files information</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages not having license files information</div><div class="data">%s</div>\n' %
> stats["no-license-files"])
> - f.write(" <div class=\"data\">Packages having a hash file</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages having a hash file</div><div class="data">%s</div>\n' %
> stats["hash"])
> - f.write(" <div class=\"data\">Packages not having a hash file</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Packages not having a hash file</div><div class="data">%s</div>\n' %
> stats["no-hash"])
> - f.write(" <div class=\"data\">Total number of patches</div><div class=\"data\">%s</div>\n" %
> + f.write(' <div class="data">Total number of patches</div><div class="data">%s</div>\n' %
> stats["patches"])
> - f.write("<div class=\"data\">Packages having a mapping on <i>release-monitoring.org</i></div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages having a mapping on <i>release-monitoring.org</i></div><div class="data">%s</div>\n' %
> stats["rmo-mapping"])
> - f.write("<div class=\"data\">Packages lacking a mapping on <i>release-monitoring.org</i></div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages lacking a mapping on <i>release-monitoring.org</i></div><div class="data">%s</div>\n' %
> stats["rmo-no-mapping"])
> - f.write("<div class=\"data\">Packages that are up-to-date</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages that are up-to-date</div><div class="data">%s</div>\n' %
> stats["version-uptodate"])
> - f.write("<div class=\"data\">Packages that are not up-to-date</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages that are not up-to-date</div><div class="data">%s</div>\n' %
> stats["version-not-uptodate"])
> - f.write("<div class=\"data\">Packages with no known upstream version</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages with no known upstream version</div><div class="data">%s</div>\n' %
> stats["version-unknown"])
> - f.write("<div class=\"data\">Packages affected by CVEs</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages affected by CVEs</div><div class="data">%s</div>\n' %
> stats["pkg-cves"])
> - f.write("<div class=\"data\">Total number of CVEs affecting all packages</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Total number of CVEs affecting all packages</div><div class="data">%s</div>\n' %
> stats["total-cves"])
> - f.write("<div class=\"data\">Packages affected by unsure CVEs</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages affected by unsure CVEs</div><div class="data">%s</div>\n' %
> stats["pkg-unsure-cves"])
> - f.write("<div class=\"data\">Total number of unsure CVEs affecting all packages</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Total number of unsure CVEs affecting all packages</div><div class="data">%s</div>\n' %
> stats["total-unsure-cves"])
> - f.write("<div class=\"data\">Packages with CPE ID</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages with CPE ID</div><div class="data">%s</div>\n' %
> stats["cpe-id"])
> - f.write("<div class=\"data\">Packages without CPE ID</div><div class=\"data\">%s</div>\n" %
> + f.write('<div class="data">Packages without CPE ID</div><div class="data">%s</div>\n' %
> stats["no-cpe-id"])
> - f.write("</div>\n")
> + f.write('</div>\n')
>
>
> def dump_html_gen_info(f, date, commit):
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-08-18 22:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-18 22:36 [Buildroot] [PATCH 1/2] support/scripts/pkg-stats: remove useless escaping of double quotes Sen Hastings
2022-08-18 22:36 ` Sen Hastings [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-08-06 21:56 Thomas Petazzoni via buildroot
2022-08-06 21:56 ` [Buildroot] [PATCH 2/2] support/scripts/pkg-stats: remove remaining double quote escaping 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=20220818223603.45459-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