コード例 #1
0
 def _report_category(self, label, warnings, group_counts, summary):
     width = 70
     cols_1 = [width]
     cols_2 = [8, width - 8]
     cols_4 = textbox.even_columns(4, width)
     cols_2_4 = textbox.merge_columns([cols_2, cols_4])
     s = textbox.line(cols_1, line='=', marker='+', indent=1)
     s += textbox.row(cols_1, [' ' + label], indent=1)
     s += textbox.line(cols_1, marker='+', indent=1)
     builds = ['common'] + sorted([b for b in warnings if b != 'common'])
     common = warnings['common']
     for build in builds:
         build_warnings = warnings[build]
         if build != 'common':
             build_warnings = [w for w in build_warnings if w not in common]
         s += textbox.row(
             cols_1, [' %s : %d warning(s)' % (build, len(build_warnings))],
             indent=1)
         if len(build_warnings) == 0:
             s += textbox.line(cols_1, marker='+', indent=1)
         else:
             s += textbox.line(cols_4, marker='+', indent=1)
             if build not in group_counts:
                 gs = [0 for group in self.groups['groups']]
             else:
                 gs = []
                 for g in range(0, len(self.groups['groups'])):
                     group = self.groups['groups'][g]
                     if group in group_counts[build]:
                         count = group_counts[build][group]
                     else:
                         count = 0
                     gs += [
                         '%*s' % (int(cols_4[g % 4] - 2), '%s : %4d' %
                                  (group, count))
                     ]
                 for row in range(0, len(self.groups['groups']), 4):
                     if row + 4 > len(self.groups['groups']):
                         d = gs[row:] + \
                             ['' for r in range(row,
                                                len(self.groups['groups']))]
                     else:
                         d = gs[row:+4]
                     s += textbox.row(cols_4, d, indent=1)
             s += textbox.line(cols_2_4, marker='+', indent=1)
             if not summary:
                 vw = sorted([(w, warnings[build][w])
                              for w in build_warnings],
                             key=operator.itemgetter(1),
                             reverse=True)
                 for w in vw:
                     c1 = '%6d' % w[1]
                     for l in textwrap.wrap(' ' + w[0],
                                            width=cols_2[1] - 3):
                         s += textbox.row(cols_2, [c1, l], indent=1)
                         c1 = ' ' * 6
                 s += textbox.line(cols_2, marker='+', indent=1)
     return s
コード例 #2
0
 def _report_warning_map(self):
     builds = self.messages['warnings']
     width = 70
     cols_1 = [width]
     s = textbox.line(cols_1, line = '=', marker = '+', indent = 1)
     s += textbox.row(cols_1, [' Warning Map'], indent = 1)
     s += textbox.line(cols_1, marker = '+', indent = 1)
     for build in builds:
         messages = builds[build]
         s += textbox.row(cols_1, [' %s : %d' % (build, len(messages))], indent = 1)
         s += textbox.line(cols_1, marker = '+', indent = 1)
         for msg in messages:
             for l in textwrap.wrap(msg, width = width - 3):
                 s += textbox.row(cols_1, [' ' + l], indent = 1)
             for l in textwrap.wrap(messages[msg], width = width - 3 - 4):
                 s += textbox.row(cols_1, ['    ' + l], indent = 1)
         s += textbox.line(cols_1, marker = '+', indent = 1)
     return s
コード例 #3
0
 def report(self, profiles=True, builds=True, architectures=True):
     width = 70
     cols_1 = [width]
     cols_2 = [10, width - 10]
     s = textbox.line(cols_1, line='=', marker='+', indent=1)
     s1 = ' File(s)'
     for f in self.config.files():
         colon = ':'
         for l in textwrap.wrap(f, width=cols_2[1] - 3):
             s += textbox.row(cols_2, [s1, ' ' + l], marker=colon, indent=1)
             colon = ' '
             s1 = ' ' * len(s1)
     s += textbox.line(cols_1, marker='+', indent=1)
     s += os.linesep
     if profiles:
         s += textbox.line(cols_1, line='=', marker='+', indent=1)
         profiles = sorted(self.profiles['profiles'])
         archs = []
         bsps = []
         for profile in profiles:
             archs += self.profiles[profile]['archs']
             for arch in sorted(self.profiles[profile]['archs']):
                 bsps += self.profiles[profile]['bsps_%s' % (arch)]
         archs = len(set(archs))
         bsps = len(set(bsps))
         s += textbox.row(cols_1,
                          [' Profiles : %d (archs:%d, bsps:%d)' % \
                           (len(profiles), archs, bsps)],
                          indent = 1)
         for profile in profiles:
             textbox.row(cols_2, [profile, self.profiles[profile]['name']],
                         indent=1)
         s += textbox.line(cols_1, marker='+', indent=1)
         for profile in profiles:
             s += textbox.row(cols_1, [' %s' % (profile)], indent=1)
             profile = self.profiles[profile]
             archs = sorted(profile['archs'])
             for arch in archs:
                 arch_bsps = ', '.join(profile['bsps_%s' % (arch)])
                 if len(arch_bsps) > 0:
                     s += textbox.line(cols_2, marker='+', indent=1)
                     s1 = ' ' + arch
                     for l in textwrap.wrap(arch_bsps, width=cols_2[1] - 3):
                         s += textbox.row(cols_2, [s1, ' ' + l], indent=1)
                         s1 = ' ' * len(s1)
             s += textbox.line(cols_2, marker='+', indent=1)
         s += os.linesep
     if builds:
         s += textbox.line(cols_1, line='=', marker='+', indent=1)
         s += textbox.row(
             cols_1, [' Builds:  %s (default)' % (self.builds_['default'])],
             indent=1)
         builds = self.builds_['builds']
         bsize = 0
         for build in builds:
             if len(build) > bsize:
                 bsize = len(build)
         cols_b = [bsize + 2, width - bsize - 2]
         s += textbox.line(cols_b, marker='+', indent=1)
         for build in builds:
             s1 = ' ' + build
             for l in textwrap.wrap(', '.join(builds[build]),
                                    width=cols_b[1] - 3):
                 s += textbox.row(cols_b, [s1, ' ' + l], indent=1)
                 s1 = ' ' * len(s1)
             s += textbox.line(cols_b, marker='+', indent=1)
         configs = self.builds_['config']
         s += textbox.row(cols_1,
                          [' Configure Options: %d' % (len(configs))],
                          indent=1)
         csize = 0
         for config in configs:
             if len(config) > csize:
                 csize = len(config)
         cols_c = [csize + 3, width - csize - 3]
         s += textbox.line(cols_c, marker='+', indent=1)
         for config in configs:
             s1 = ' ' + config
             for l in textwrap.wrap(configs[config], width=cols_c[1] - 3):
                 s += textbox.row(cols_c, [s1, ' ' + l], indent=1)
                 s1 = ' ' * len(s1)
             s += textbox.line(cols_c, marker='+', indent=1)
         s += os.linesep
     if architectures:
         s += textbox.line(cols_1, line='=', marker='+', indent=1)
         archs = sorted(list(self.archs.keys()))
         bsps = 0
         asize = 0
         for arch in archs:
             if len(arch) > asize:
                 asize = len(arch)
             bsps += len(self.archs[arch]['bsps'])
         s += textbox.row(
             cols_1,
             [' Architectures : %d (bsps: %d)' % (len(archs), bsps)],
             indent=1)
         cols_a = [asize + 2, width - asize - 2]
         s += textbox.line(cols_a, marker='+', indent=1)
         for arch in archs:
             s += textbox.row(
                 cols_a,
                 [' ' + arch,
                  ' %d' % (len(self.archs[arch]['bsps']))],
                 indent=1)
         s += textbox.line(cols_a, marker='+', indent=1)
         for archn in archs:
             arch = self.archs[archn]
             if len(arch['bsps']) > 0:
                 bsize = 0
                 for bsp in arch['bsps']:
                     if len(bsp) > bsize:
                         bsize = len(bsp)
                 cols_b = [bsize + 3, width - bsize - 3]
                 s += textbox.row(cols_1, [' ' + archn + ':'], indent=1)
                 s += textbox.line(cols_b, marker='+', indent=1)
                 for bsp in arch['bsps']:
                     s1 = ' ' + bsp
                     bspopts = ' '.join(arch[bsp]['bspopts'])
                     if len(bspopts):
                         for l in textwrap.wrap('bopt: ' + bspopts,
                                                width=cols_b[1] - 3):
                             s += textbox.row(cols_b, [s1, ' ' + l],
                                              indent=1)
                             s1 = ' ' * len(s1)
                     excludes = []
                     for exclude in arch['excludes']:
                         if 'all' in arch['excludes'][exclude] or \
                            bsp in arch['excludes'][exclude]:
                             excludes += [exclude]
                     excludes = ', '.join(excludes)
                     if len(excludes):
                         for l in textwrap.wrap('ex: ' + excludes,
                                                width=cols_b[1] - 3):
                             s += textbox.row(cols_b, [s1, ' ' + l],
                                              indent=1)
                             s1 = ' ' * len(s1)
                     if len(bspopts) == 0 and len(excludes) == 0:
                         s += textbox.row(cols_b, [s1, ' '], indent=1)
                 s += textbox.line(cols_b, marker='+', indent=1)
         s += os.linesep
     return s