- ax = fig.add_subplot(121)
- plot_datehist(ax, data, 10, [code for code in cfg.options('release codenames') if cfg.get('release codenames', code).count('Debian')], title="Debian", ymax=ymax)
- ax = fig.add_subplot(122)
- plot_datehist(ax, data, 10, [code for code in cfg.options('release codenames') if cfg.get('release codenames', code).count('Ubuntu')], title="Ubuntu", ymax=ymax)
+ distros = ('Debian', 'Ubuntu')
+ # Sorting is actually seems to be not needed on Python 2.7
+ # which probably returns release codenames in the order as
+ # in the config file which is already correct
+ # But since our server is still on previous stable release
+ # let's sort for now explicitly
+ # 9999 for 'nd' == 'sid'
+ sorting_ids = dict([(x[0], len(x[1])>2 and float(x[1][2:]) or 9999)
+ for x in cfg.items('release backport ids')])
+ for idistro, distro in enumerate(distros):
+ ax = fig.add_subplot(1, len(distros), idistro+1)
+ suites = [code for code in cfg.options('release codenames')
+ if cfg.get('release codenames', code).count(distro)]
+ # sort suites according to backport ids
+ # and in reverse order so the freshiest is on top
+ suites = sorted(suites,
+ cmp=lambda x,y: cmp(sorting_ids[x], sorting_ids[y]),
+ reverse=True)
+ plot_datehist(ax, data, 10, suites, title=distro, ymax=ymax)