Skip to content
This repository
Browse code

Report on app-versions found across the launch

  • Loading branch information...
commit 4b27160cdf1ec7b12442f76d49edbc4554955f5a 1 parent 26cf0fa
Tim Freeman timf authored

Showing 1 changed file with 36 additions and 5 deletions. Show diff stats Hide diff stats

  1. +36 5 src/python/epumgmt/main/em_core_versions.py
41 src/python/epumgmt/main/em_core_versions.py
@@ -7,7 +7,8 @@ class VersionsNode:
7 7 def __init__(self, vm):
8 8 self.vm = vm
9 9 self.versions = []
10   - self.gitversion = None
  10 + self.gitcommit = None
  11 + self.projectversion = None
11 12
12 13 def print_versions(p, c, m, run_name):
13 14 vnodes, counts = _gather_vnodes(p, c, m, run_name)
@@ -20,8 +21,10 @@ def _vnode_report(vnodes, counts):
20 21 txt = "Only one source of version information:\n"
21 22 for version in vnodes[0].versions:
22 23 txt += " %s\n" % version
23   - if vnodes[0].gitversion:
24   - txt += " GIT: %s" % vnodes[0].gitversion
  24 + if vnodes[0].gitcommit:
  25 + txt += " GIT: %s" % vnodes[0].gitcommit
  26 + if vnodes[0].projectversion:
  27 + txt += " Project: %s" % vnodes[0].projectversion
25 28 return txt
26 29
27 30 keys = counts.keys()
@@ -33,6 +36,32 @@ def _vnode_report(vnodes, counts):
33 36 if counts[key] != 1:
34 37 txt += "s"
35 38 txt += "\n"
  39 +
  40 + # Each combination of git + projectversion is treated as a unique package
  41 + # (This guards against any divergence in git commit vs. manual version bump.)
  42 + appv = {}
  43 + for vnode in vnodes:
  44 + tup = (vnode.projectversion, vnode.gitcommit)
  45 + if appv.has_key(tup):
  46 + appv[tup] += 1
  47 + else:
  48 + appv[tup] = 1
  49 +
  50 + keys = appv.keys()
  51 + keys.sort()
  52 + toprints = []
  53 + for key in keys:
  54 + toprints.append("%s (git: %s)" % (key[0], key[1]))
  55 +
  56 + widest = _widest_key(toprints)
  57 + txt += "\n\nApp versions from %d sources:\n" % len(vnodes)
  58 + for key in keys:
  59 + toprint = "%s (git: %s)" % (key[0], key[1])
  60 + txt += " %s %d occurence" % (_pad_txt(toprint, widest), appv[key])
  61 + if appv[key] != 1:
  62 + txt += "s"
  63 + txt += "\n"
  64 +
36 65 return txt
37 66
38 67 def _widest_key(keys):
@@ -90,8 +119,10 @@ def _init_vnodes(allvms):
90 119 for key in ev.extra.keys():
91 120 if key == "depsource":
92 121 continue
93   - elif key == "gitversion":
94   - vnode.gitversion = ev.extra[key]
  122 + elif key == "gitcommit":
  123 + vnode.gitcommit = ev.extra[key]
  124 + elif key == "projectversion":
  125 + vnode.projectversion = ev.extra[key]
95 126 elif key.startswith("dep"):
96 127 dep = _filter_dep(ev.extra[key])
97 128 if dep:

0 comments on commit 4b27160

Please sign in to comment.
Something went wrong with that request. Please try again.