浏览代码

scripts/machine-summary: put more version information into the context

As well as storing the truncated PV, also store the original PV and
whether the recipe needs updating, to avoid the templates needing to
do that logic.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
Ross Burton 3 年之前
父节点
当前提交
b1b0f37da7
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 13 2
      scripts/machine-summary.py

+ 13 - 2
scripts/machine-summary.py

@@ -15,6 +15,15 @@ def trim_pv(pv):
     """
     return "".join(pv.partition("+git")[:2])
 
+def needs_update(version, upstream):
+    """
+    Do a dumb comparison to determine if the version needs to be updated.
+    """
+    if "+git" in version:
+        # strip +git and see if this is a post-release snapshot
+        version = version.replace("+git", "")
+    return version != upstream
+
 def layer_path(layername, d):
     """
     Return the path to the specified layer, or None if the layer isn't present.
@@ -88,14 +97,16 @@ def harvest_data(machines, recipes):
                 details = versions[machine][recipe] = {}
                 details["recipe"] = d.getVar("PN")
                 details["version"] = trim_pv(d.getVar("PV"))
+                details["fullversion"] = d.getVar("PV")
                 details["patches"] = [extract_patch_info(p, d) for p in oe.patch.src_patches(d)]
                 details["patched"] = bool(details["patches"])
 
     # Now backfill the upstream versions
     for machine in versions:
         for recipe in versions[machine]:
-            versions[machine][recipe]["upstream"] = upstreams[recipe]
-
+            data = versions[machine][recipe]
+            data["upstream"] = upstreams[recipe]
+            data["needs_update"] = needs_update(data["version"], data["upstream"])
     return upstreams, versions
 
 # TODO can this be inferred from the list of recipes in the layer