From patchwork Sat Aug 6 21:56:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1664279 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4M0bsc50HHz9s5W for ; Sun, 7 Aug 2022 07:57:08 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 2D82F60F8E; Sat, 6 Aug 2022 21:57:06 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 2D82F60F8E X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rKBcUotCfw93; Sat, 6 Aug 2022 21:57:05 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id DA82660F84; Sat, 6 Aug 2022 21:57:03 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org DA82660F84 X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 169E61BF3FF for ; Sat, 6 Aug 2022 21:56:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id E2ADC41732 for ; Sat, 6 Aug 2022 21:56:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org E2ADC41732 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VdtgNsWHDY08 for ; Sat, 6 Aug 2022 21:56:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org F02D441553 Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by smtp4.osuosl.org (Postfix) with ESMTPS id F02D441553 for ; Sat, 6 Aug 2022 21:56:48 +0000 (UTC) Received: (Authenticated sender: thomas.petazzoni@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 1A9BC1C0002; Sat, 6 Aug 2022 21:56:47 +0000 (UTC) To: buildroot@buildroot.org Date: Sat, 6 Aug 2022 23:56:41 +0200 Message-Id: <20220806215641.471770-2-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220806215641.471770-1-thomas.petazzoni@bootlin.com> References: <20220806215641.471770-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1659823007; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BCWX8NjVMkilwZPkEqdrnpHCWq1tMWju3chs0eJXbzY=; b=p6jjoZeED8UhcWZXN1NGjOBY2AHyWq2z6tlcgrfQLm5x0i1N7pjYH3WRWp9/vfMmcMFjgt wceeEycPk9VCes3CrFRLKwSvd2NuSwCJiymRD+wlTQn+dYEZYPMyMf7iaAvguPU2KMO62O 1BmDYibmkX27wtKAqRkqYqiVyO2cfI0uZAt0d9vT3HeZ5HfzgXcqoLJHERwn9d0VeXLi+4 NHc/ePmckx24ISMxMbMCTypE/PDN11lYNaXyAHN1WN3FroUCLCsvO4yTuXM9/ajIUVcVaD Yo1ygQPJSYEm81WxYjpzJjPG4VvAYE0JBjqZFVMptoy/VecGv3/RzyUXL/merg== X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=gm1 header.b=p6jjoZeE Subject: [Buildroot] [PATCH 2/2] support/scripts/pkg-stats: remove remaining double quote escaping X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Thomas Petazzoni via buildroot From: Thomas Petazzoni Reply-To: Thomas Petazzoni Cc: Sen Hastings , Thomas Petazzoni Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" 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. Signed-off-by: Thomas Petazzoni --- 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 = "Found, but no version" else: - latest_version_text = "%s" % \ - (pkg.latest_version['id'], str(pkg.latest_version['version'])) + latest_version_text = f"""{str(pkg.latest_version['version'])}""" latest_version_text += "
" if pkg.latest_version['status'] == RM_API_STATUS_FOUND_BY_DISTRO: - latest_version_text += "found by distro" + latest_version_text += f'found by distro' 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 = "%s" % (pkg.url, pkg.status['url'][1]) + url_str = f"""{pkg.status['url'][1]}""" else: div_class.append("good_url") - url_str = "Link" % pkg.url + url_str = f'Link' f.write(f'
{url_str}
\n') # CVEs @@ -1068,11 +1067,11 @@ def dump_html_pkg(f, pkg): class="see-more centered cve_ignored">see all ({cve_total}) ▾\n') if pkg.is_status_error("cve"): for cve in pkg.cves: - f.write(" %s
\n" % (cve, cve)) + f.write(f' {cve}
\n') for cve in pkg.unsure_cves: - f.write(" %s (unsure)
\n" % (cve, cve)) + f.write(f' {cve} (unsure)
\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(" \n") @@ -1085,7 +1084,7 @@ def dump_html_pkg(f, pkg): div_class.append("cve_ignored") f.write(f'
\n') for ignored_cve in pkg.ignored_cves: - f.write(" %s
\n" % (ignored_cve, ignored_cve)) + f.write(f' {ignored_cve}
\n') f.write("
\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("
%s (Search)\n" % # noqa: E501 - (pkg.status['cpe'][1], ":".join(pkg.cpeid.split(":")[0:5]))) + f.write(f"""
{pkg.status['cpe'][1]} (Search)\n""") # noqa: E501 else: - f.write(" %s (Search)\n" % # noqa: E501 - (pkg.status['cpe'][1], pkg.name)) + f.write(f""" {pkg.status['cpe'][1]} (Search)\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("\n") - f.write("
\n") + f.write('\n') + f.write('
\n') infras = [infra[6:] for infra in stats.keys() if infra.startswith("infra-")] for infra in infras: - f.write("
Packages using the %s infrastructure
%s
\n" % + f.write('
Packages using the %s infrastructure
%s
\n' % (infra, stats["infra-%s" % infra])) - f.write("
Packages having license information
%s
\n" % + f.write('
Packages having license information
%s
\n' % stats["license"]) - f.write("
Packages not having license information
%s
\n" % + f.write('
Packages not having license information
%s
\n' % stats["no-license"]) - f.write("
Packages having license files information
%s
\n" % + f.write('
Packages having license files information
%s
\n' % stats["license-files"]) - f.write("
Packages not having license files information
%s
\n" % + f.write('
Packages not having license files information
%s
\n' % stats["no-license-files"]) - f.write("
Packages having a hash file
%s
\n" % + f.write('
Packages having a hash file
%s
\n' % stats["hash"]) - f.write("
Packages not having a hash file
%s
\n" % + f.write('
Packages not having a hash file
%s
\n' % stats["no-hash"]) - f.write("
Total number of patches
%s
\n" % + f.write('
Total number of patches
%s
\n' % stats["patches"]) - f.write("
Packages having a mapping on release-monitoring.org
%s
\n" % + f.write('
Packages having a mapping on release-monitoring.org
%s
\n' % stats["rmo-mapping"]) - f.write("
Packages lacking a mapping on release-monitoring.org
%s
\n" % + f.write('
Packages lacking a mapping on release-monitoring.org
%s
\n' % stats["rmo-no-mapping"]) - f.write("
Packages that are up-to-date
%s
\n" % + f.write('
Packages that are up-to-date
%s
\n' % stats["version-uptodate"]) - f.write("
Packages that are not up-to-date
%s
\n" % + f.write('
Packages that are not up-to-date
%s
\n' % stats["version-not-uptodate"]) - f.write("
Packages with no known upstream version
%s
\n" % + f.write('
Packages with no known upstream version
%s
\n' % stats["version-unknown"]) - f.write("
Packages affected by CVEs
%s
\n" % + f.write('
Packages affected by CVEs
%s
\n' % stats["pkg-cves"]) - f.write("
Total number of CVEs affecting all packages
%s
\n" % + f.write('
Total number of CVEs affecting all packages
%s
\n' % stats["total-cves"]) - f.write("
Packages affected by unsure CVEs
%s
\n" % + f.write('
Packages affected by unsure CVEs
%s
\n' % stats["pkg-unsure-cves"]) - f.write("
Total number of unsure CVEs affecting all packages
%s
\n" % + f.write('
Total number of unsure CVEs affecting all packages
%s
\n' % stats["total-unsure-cves"]) - f.write("
Packages with CPE ID
%s
\n" % + f.write('
Packages with CPE ID
%s
\n' % stats["cpe-id"]) - f.write("
Packages without CPE ID
%s
\n" % + f.write('
Packages without CPE ID
%s
\n' % stats["no-cpe-id"]) - f.write("
\n") + f.write('
\n') def dump_html_gen_info(f, date, commit):