コード例 #1
0
    def setUp(self):
        self.gs_mock = self.StartPatcher(gs_unittest.GSContextMock())
        self.gs_mock.SetDefaultCmdResult()
        self.sdk_mock = self.StartPatcher(SDKFetcherMock(gs_mock=self.gs_mock))
        self.sdk_mock.UnMockAttr('_GetChromeLKGM')

        os.environ.pop(cros_chrome_sdk.SDKFetcher.SDK_VERSION_ENV, None)
        self.sdk = cros_chrome_sdk.SDKFetcher(
            os.path.join(self.tempdir, 'cache'), self.BOARD)
コード例 #2
0
 def testSpecificComponent(self):
     """Tests that SDKFetcher.Prepare() handles |components| param properly."""
     sdk = cros_chrome_sdk.SDKFetcher(os.path.join(self.tempdir),
                                      SDKFetcherMock.BOARD)
     components = [constants.BASE_IMAGE_TAR, constants.CHROME_SYSROOT_TAR]
     with sdk.Prepare(components=components) as ctx:
         for c in components:
             self.assertTrue(os.path.exists(ctx.key_map[c].path))
         for c in [constants.IMAGE_SCRIPTS_TAR, constants.CHROME_ENV_TAR]:
             self.assertFalse(c in ctx.key_map)
コード例 #3
0
def _StripBinContext(options):
    if not options.dostrip:
        yield None
    elif options.strip_bin:
        yield options.strip_bin
    else:
        sdk = cros_chrome_sdk.SDKFetcher(options.cache_dir, options.board)
        components = (sdk.TARGET_TOOLCHAIN_KEY, constants.CHROME_ENV_TAR)
        with sdk.Prepare(components=components) as ctx:
            env_path = os.path.join(ctx.key_map[constants.CHROME_ENV_TAR].path,
                                    constants.CHROME_ENV_FILE)
            strip_bin = osutils.SourceEnvironment(env_path, ['STRIP'])['STRIP']
            strip_bin = os.path.join(
                ctx.key_map[sdk.TARGET_TOOLCHAIN_KEY].path, 'bin',
                os.path.basename(strip_bin))
            yield strip_bin
コード例 #4
0
ファイル: deploy_chrome.py プロジェクト: xiicloud/chromite
def _PrepareStagingDir(options, tempdir, staging_dir):
    """Place the necessary files in the staging directory.

  The staging directory is the directory used to rsync the build artifacts over
  to the device.  Only the necessary Chrome build artifacts are put into the
  staging directory.
  """
    if options.build_dir:
        sdk = cros_chrome_sdk.SDKFetcher(options.cache_dir, options.board)
        components = (sdk.TARGET_TOOLCHAIN_KEY, constants.CHROME_ENV_TAR)
        with sdk.Prepare(components=components) as ctx:
            env_path = os.path.join(ctx.key_map[constants.CHROME_ENV_TAR].path,
                                    constants.CHROME_ENV_FILE)
            strip_bin = osutils.SourceEnvironment(env_path, ['STRIP'])['STRIP']
            strip_bin = os.path.join(
                ctx.key_map[sdk.TARGET_TOOLCHAIN_KEY].path, 'bin',
                os.path.basename(strip_bin))
            chrome_util.StageChromeFromBuildDir(
                staging_dir,
                options.build_dir,
                strip_bin,
                strict=options.strict,
                sloppy=options.sloppy,
                gyp_defines=options.gyp_defines,
                staging_flags=options.staging_flags)
    else:
        pkg_path = options.local_pkg_path
        if options.gs_path:
            pkg_path = _FetchChromePackage(options.cache_dir, tempdir,
                                           options.gs_path)

        assert pkg_path
        logging.info('Extracting %s...', pkg_path)
        osutils.SafeMakedirs(staging_dir)
        cros_build_lib.DebugRunCommand(['tar', '-xpf', pkg_path],
                                       cwd=staging_dir)