Exemplo n.º 1
0
def main(argv):
    cros_build_lib.AssertInsideChroot()
    opts = _ParseArguments(argv)

    site_config = config_lib.GetConfig()

    logging.info('Generating board configs. This takes about 2m...')
    for key in sorted(binhost.GetChromePrebuiltConfigs(site_config)):
        binhost.GenConfigsForBoard(key.board,
                                   regen=opts.regen,
                                   error_code_ok=True)

    # Fetch all compat IDs.
    fetcher = binhost.CompatIdFetcher()
    keys = binhost.GetChromePrebuiltConfigs(site_config).keys()
    compat_ids = fetcher.FetchCompatIds(keys)

    # Save the PFQ configs.
    pfq_configs = binhost.PrebuiltMapping.Get(keys, compat_ids)
    filename_internal = binhost.PrebuiltMapping.GetFilename(
        opts.buildroot, 'chrome')
    pfq_configs.Dump(filename_internal)
    git.AddPath(filename_internal)
    git.Commit(os.path.dirname(filename_internal),
               'Update PFQ config dump',
               allow_empty=True)

    filename_external = binhost.PrebuiltMapping.GetFilename(opts.buildroot,
                                                            'chromium',
                                                            internal=False)
    pfq_configs.Dump(filename_external, internal=False)
    git.AddPath(filename_external)
    git.Commit(os.path.dirname(filename_external),
               'Update PFQ config dump',
               allow_empty=True)
Exemplo n.º 2
0
    def testDumping(self):
        """Verify Chrome prebuilts exist for all configs that build Chrome.

    This loads the list of Chrome prebuilts that were generated during the last
    Chrome PFQ run from disk and verifies that it is sufficient.
    """
        with osutils.TempDir() as tempdir:
            keys = binhost.GetChromePrebuiltConfigs(self.site_config).keys()
            pfq_configs = binhost.PrebuiltMapping.Get(keys, self.COMPAT_IDS)
            filename = os.path.join(tempdir, 'foo.json')
            pfq_configs.Dump(filename)
            self.assertEqual(pfq_configs,
                             binhost.PrebuiltMapping.Load(filename))
Exemplo n.º 3
0
    def testChromePrebuiltsPresent(self, filename=None):
        """Verify Chrome prebuilts exist for all configs that build Chrome.

    Args:
      filename: Filename to load our PFQ mappings from. By default, generate
        the PFQ mappings based on the current config.
    """
        if filename is not None:
            pfq_configs = binhost.PrebuiltMapping.Load(filename)
        else:
            keys = binhost.GetChromePrebuiltConfigs(self.site_config).keys()
            pfq_configs = binhost.PrebuiltMapping.Get(keys, self.COMPAT_IDS)

        for compat_id, pfqs in pfq_configs.by_compat_id.items():
            if len(pfqs) > 1:
                msg = 'The following Chrome PFQs produce identical prebuilts: %s -- %s'
                self.Complain(msg % (', '.join(str(x)
                                               for x in pfqs), compat_id),
                              fatal=False)

        for _name, config in sorted(self.site_config.items()):
            # Skip over configs that don't have Chrome or have >1 board.
            if config.sync_chrome is False or len(config.boards) != 1:
                continue

            # Look for boards with missing prebuilts.
            builds_chrome = config.usepkg_build_packages and not config.chrome_rev

            production_config = (
                (config.build_type == config_lib.CONFIG_TYPE_PRECQ)
                or (config.active_waterfall
                    and config.active_waterfall != constants.WATERFALL_TRYBOT))

            if builds_chrome and production_config:
                self.AssertChromePrebuilts(pfq_configs, config)

                # Check that we have a builder for the version w/o custom useflags as
                # well.
                if (config.useflags and config.boards[0]
                        not in self.BOARDS_WITHOUT_CHROMIUM_PFQS):
                    self.AssertChromePrebuilts(pfq_configs,
                                               config,
                                               skip_useflags=True)