Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH next 3/5] support/scripts/pkg-stats-new: add current version information
Date: Thu, 15 Feb 2018 23:03:43 +0100	[thread overview]
Message-ID: <20180215220345.8532-4-thomas.petazzoni@bootlin.com> (raw)
In-Reply-To: <20180215220345.8532-1-thomas.petazzoni@bootlin.com>

This commit adds a new column in the HTML output containing the
current version of a package in Buildroot. As such, it isn't terribly
useful, but combined with the latest upstream version added in a
follow-up commit, it will become very useful.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
 support/scripts/pkg-stats-new | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/support/scripts/pkg-stats-new b/support/scripts/pkg-stats-new
index d018e1fed4..32227a8906 100755
--- a/support/scripts/pkg-stats-new
+++ b/support/scripts/pkg-stats-new
@@ -18,6 +18,7 @@ class Package:
         self.has_hash = False
         self.patch_count = 0
         self.warnings = 0
+        self.current_version = None
     def __str__(self):
         return "%s (path='%s', license='%s', license_files='%s', hash='%s', patches=%d)" % \
             (self.name, self.path, self.has_license, self.has_license_files, self.has_hash, self.patch_count)
@@ -114,6 +115,7 @@ def pkgname_to_pkgvar(pkgname):
 def add_pkg_make_info(packages):
     licenses = list()
     license_files = list()
+    versions = dict()
 
     # Licenses
     o = subprocess.check_output(["make", "-s", "printvars", "VARS=%_LICENSE"])
@@ -151,12 +153,32 @@ def add_pkg_make_info(packages):
 
         license_files.append(pkgvar)
 
+    # Version
+    o = subprocess.check_output(["make", "-s", "printvars", "VARS=%_VERSION"])
+    for l in o.splitlines():
+        # Get variable name and value
+        pkgvar, value = l.split("=")
+
+        # If present, strip HOST_ from variable name
+        if pkgvar.startswith("HOST_"):
+            pkgvar = pkgvar[5:]
+
+        if pkgvar.endswith("_DL_VERSION"):
+            continue
+
+        # Strip _VERSION
+        pkgvar = pkgvar[:-8]
+
+        versions[pkgvar] = value
+
     for name, pkg in packages.iteritems():
         var = pkgname_to_pkgvar(name)
         if var in licenses:
             pkg.has_license = True
         if var in license_files:
             pkg.has_license_files = True
+        if versions.has_key(var):
+            pkg.current_version = versions[var]
 
 # Fills in the .has_hash field of all Package objects
 def add_hash_info(packages):
@@ -346,6 +368,9 @@ def dump_html_pkg(f, pkg):
     f.write("  <td class=\"%s\">%s</td>" % \
             (" ".join(td_class), boolean_str(pkg.has_hash)))
 
+    # Current version
+    f.write("  <td class=\"centered\">%s</td>" % pkg.current_version)
+
     # Warnings
     td_class = ["centered"]
     if pkg.warnings == 0:
@@ -367,6 +392,7 @@ def dump_html_all_pkgs(f, packages):
 <td class=\"centered\">License</td>
 <td class=\"centered\">License files</td>
 <td class=\"centered\">Hash file</td>
+<td class=\"centered\">Current version</td>
 <td class=\"centered\">Warnings</td>
 </tr>""")
     for name, pkg in sorted(packages.iteritems()):
-- 
2.14.3

  parent reply	other threads:[~2018-02-15 22:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-15 22:03 [Buildroot] [PATCH next 0/5] New pkg-stats, with upstream version comparison Thomas Petazzoni
2018-02-15 22:03 ` [Buildroot] [PATCH next 1/5] support/scripts/pkg-stats-new: rewrite in Python Thomas Petazzoni
2018-02-19  2:48   ` Ricardo Martincoski
2018-02-19 20:57     ` Thomas Petazzoni
2018-02-22  1:55       ` Ricardo Martincoski
2018-02-15 22:03 ` [Buildroot] [PATCH next 2/5] support/scripts/pkg-stats-new: add -n and -p options Thomas Petazzoni
2018-02-15 22:03 ` Thomas Petazzoni [this message]
2018-02-15 22:03 ` [Buildroot] [PATCH next 4/5] support/scripts/pkg-stats-new: add latest upstream version information Thomas Petazzoni
2018-02-15 22:03 ` [Buildroot] [PATCH next 5/5] support/scripts/pkg-stats: replace with new Python version Thomas Petazzoni

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=20180215220345.8532-4-thomas.petazzoni@bootlin.com \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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