parameters: (self)
return_statement: return 0
docstring: Track the progress of the GYP->GN migration on the bots.
docstring_summary: Track the progress of the GYP->GN migration on the bots.
docstring_tokens: Track the progress of the GYP - > GN migration on the bots .
function: def CmdAudit(self):
      """Track the progress of the GYP->GN migration on the bots."""
  
      # First, make sure the config file is okay, but don't print anything
      # if it is (it will throw an error if it isn't).
      self.CmdValidate(print_ok=False)
  
      stats = OrderedDict()
      STAT_MASTER_ONLY = 'Master only'
      STAT_CONFIG_ONLY = 'Config only'
      STAT_TBD = 'Still TBD'
      STAT_GYP = 'Still GYP'
      STAT_DONE = 'Done (on GN)'
      stats[STAT_MASTER_ONLY] = 0
      stats[STAT_CONFIG_ONLY] = 0
      stats[STAT_TBD] = 0
      stats[STAT_GYP] = 0
      stats[STAT_DONE] = 0
  
      def PrintBuilders(heading, builders, notes):
        stats.setdefault(heading, 0)
        stats[heading] += len(builders)
        if builders:
          self.Print('  %s:' % heading)
          for builder in sorted(builders):
            self.Print('    %s%s' % (builder, notes[builder]))
  
      self.ReadConfigFile()
  
      masters = self.args.master or self.masters
      for master in sorted(masters):
        url = self.args.url_template.replace('{master}', master)
  
        self.Print('Auditing %s' % master)
  
        MASTERS_TO_SKIP = (
          'client.skia',
          'client.v8.fyi',
          'tryserver.v8',
        )
        if master in MASTERS_TO_SKIP:
          # Skip these bots because converting them is the responsibility of
          # those teams and out of scope for the Chromium migration to GN.
          self.Print('  Skipped (out of scope)')
          self.Print('')
          continue
  
        INTERNAL_MASTERS = ('official.desktop', 'official.desktop.continuous',
                            'internal.client.kitchensync')
        if master in INTERNAL_MASTERS and not self.args.internal:
          # Skip these because the servers aren't accessible by default ...
          self.Print('  Skipped (internal)')
          self.Print('')
          continue
  
        try:
          # Fetch the /builders contents from the buildbot master. The
          # keys of the dict are the builder names themselves.
          json_contents = self.Fetch(url)
          d = json.loads(json_contents)
        except Exception as e:
          self.Print(str(e))
          return 1
  
        config_builders = set(self.masters[master])
        master_builders = set(d.keys())
        both = master_builders & config_builders
        master_only = master_builders - config_builders
        config_only = config_builders - master_builders
        tbd = set()
        gyp = set()
        done = set()
        notes = {builder: '' for builder in config_builders | master_builders}
  
        for builder in both:
          config = self.masters[master][builder]
          if config == 'tbd':
            tbd.add(builder)
          elif isinstance(config, list):
            vals = self.FlattenConfig(config[0])
            if vals['type'] == 'gyp':
              gyp.add(builder)
            else:
              done.add(builder)
          elif config.startswith('//'):
            done.add(builder)
          else:
            vals = self.FlattenConfig(config)
            if vals['type'] == 'gyp':
              gyp.add(builder)
            else:
              done.add(builder)
  
        if self.args.check_compile and (tbd or master_only):
          either = tbd | master_only
          for builder in either:
            notes[builder] = ' (' + self.CheckCompile(master, builder) +')'
  
        if master_only or config_only or tbd or gyp:
          PrintBuilders(STAT_MASTER_ONLY, master_only, notes)
          PrintBuilders(STAT_CONFIG_ONLY, config_only, notes)
          PrintBuilders(STAT_TBD, tbd, notes)
          PrintBuilders(STAT_GYP, gyp, notes)
        else:
          self.Print('  All GN!')
  
        stats[STAT_DONE] += len(done)
  
        self.Print('')
  
      fmt = '{:<27} {:>4}'
      self.Print(fmt.format('Totals', str(sum(int(v) for v in stats.values()))))
      self.Print(fmt.format('-' * 27, '----'))
      for stat, count in stats.items():
        self.Print(fmt.format(stat, str(count)))
  
      return 0
function_tokens: def CmdAudit ( self ) : # First, make sure the config file is okay, but don't print anything # if it is (it will throw an error if it isn't). self . CmdValidate ( print_ok = False ) stats = OrderedDict ( ) STAT_MASTER_ONLY = 'Master only' STAT_CONFIG_ONLY = 'Config only' STAT_TBD = 'Still TBD' STAT_GYP = 'Still GYP' STAT_DONE = 'Done (on GN)' stats [ STAT_MASTER_ONLY ] = 0 stats [ STAT_CONFIG_ONLY ] = 0 stats [ STAT_TBD ] = 0 stats [ STAT_GYP ] = 0 stats [ STAT_DONE ] = 0 def PrintBuilders ( heading , builders , notes ) : stats . setdefault ( heading , 0 ) stats [ heading ] += len ( builders ) if builders : self . Print ( '  %s:' % heading ) for builder in sorted ( builders ) : self . Print ( '    %s%s' % ( builder , notes [ builder ] ) ) self . ReadConfigFile ( ) masters = self . args . master or self . masters for master in sorted ( masters ) : url = self . args . url_template . replace ( '{master}' , master ) self . Print ( 'Auditing %s' % master ) MASTERS_TO_SKIP = ( 'client.skia' , 'client.v8.fyi' , 'tryserver.v8' , ) if master in MASTERS_TO_SKIP : # Skip these bots because converting them is the responsibility of # those teams and out of scope for the Chromium migration to GN. self . Print ( '  Skipped (out of scope)' ) self . Print ( '' ) continue INTERNAL_MASTERS = ( 'official.desktop' , 'official.desktop.continuous' , 'internal.client.kitchensync' ) if master in INTERNAL_MASTERS and not self . args . internal : # Skip these because the servers aren't accessible by default ... self . Print ( '  Skipped (internal)' ) self . Print ( '' ) continue try : # Fetch the /builders contents from the buildbot master. The # keys of the dict are the builder names themselves. json_contents = self . Fetch ( url ) d = json . loads ( json_contents ) except Exception as e : self . Print ( str ( e ) ) return 1 config_builders = set ( self . masters [ master ] ) master_builders = set ( d . keys ( ) ) both = master_builders & config_builders master_only = master_builders - config_builders config_only = config_builders - master_builders tbd = set ( ) gyp = set ( ) done = set ( ) notes = { builder : '' for builder in config_builders | master_builders } for builder in both : config = self . masters [ master ] [ builder ] if config == 'tbd' : tbd . add ( builder ) elif isinstance ( config , list ) : vals = self . FlattenConfig ( config [ 0 ] ) if vals [ 'type' ] == 'gyp' : gyp . add ( builder ) else : done . add ( builder ) elif config . startswith ( '//' ) : done . add ( builder ) else : vals = self . FlattenConfig ( config ) if vals [ 'type' ] == 'gyp' : gyp . add ( builder ) else : done . add ( builder ) if self . args . check_compile and ( tbd or master_only ) : either = tbd | master_only for builder in either : notes [ builder ] = ' (' + self . CheckCompile ( master , builder ) + ')' if master_only or config_only or tbd or gyp : PrintBuilders ( STAT_MASTER_ONLY , master_only , notes ) PrintBuilders ( STAT_CONFIG_ONLY , config_only , notes ) PrintBuilders ( STAT_TBD , tbd , notes ) PrintBuilders ( STAT_GYP , gyp , notes ) else : self . Print ( '  All GN!' ) stats [ STAT_DONE ] += len ( done ) self . Print ( '' ) fmt = '{:<27} {:>4}' self . Print ( fmt . format ( 'Totals' , str ( sum ( int ( v ) for v in stats . values ( ) ) ) ) ) self . Print ( fmt . format ( '-' * 27 , '----' ) ) for stat , count in stats . items ( ) : self . Print ( fmt . format ( stat , str ( count ) ) ) return 0