def ParseParallelEmergeArgs(self, argv):
        """Read the parallel emerge arguments from the command-line.

    We need to be compatible with emerge arg format.  We scrape arguments that
    are specific to parallel_emerge, and pass through the rest directly to
    emerge.

    Args:
      argv: arguments list

    Returns:
      Arguments that don't belong to parallel_emerge
    """
        emerge_args = []
        for arg in argv:
            # Specifically match arguments that are specific to parallel_emerge, and
            # pass through the rest.
            if arg.startswith('--board='):
                self.board = arg.replace('--board=', '')
            elif arg.startswith('--sysroot='):
                self.sysroot = arg.replace('--sysroot=', '')
            elif arg.startswith('--workon='):
                workon_str = arg.replace('--workon=', '')
                emerge_args.append('--reinstall-atoms=%s' % workon_str)
                emerge_args.append('--usepkg-exclude=%s' % workon_str)
            elif arg.startswith('--force-remote-binary='):
                force_remote_binary = arg.replace('--force-remote-binary=', '')
                emerge_args.append('--useoldpkg-atoms=%s' %
                                   force_remote_binary)
            elif arg.startswith('--retries='):
                self.max_retries = int(arg.replace('--retries=', ''))
            elif arg == '--show-output':
                self.show_output = True
            elif arg == '--rebuild':
                emerge_args.append('--rebuild-if-unbuilt')
            elif arg == '--unpackonly':
                emerge_args.append('--fetchonly')
                self.unpack_only = True
            elif arg.startswith('--eventlogfile='):
                log_file_name = arg.replace('--eventlogfile=', '')
                event_logger = cros_event.getEventFileLogger(log_file_name)
                event_logger.setKind('ParallelEmerge')
                cros_event.setEventLogger(event_logger)
            elif arg == '--include-bdepend':
                self.include_bdepend = True
            else:
                # Not one of our options, so pass through to emerge.
                emerge_args.append(arg)

        # These packages take a really long time to build, so, for expediency, we
        # are blacklisting them from automatic rebuilds because one of their
        # dependencies needs to be recompiled.
        for pkg in ('chromeos-base/chromeos-chrome', ):
            emerge_args.append('--rebuild-exclude=%s' % pkg)

        return emerge_args
 def SetEventLoggerTest(self):
     new_log = cros_event.EventDummyLogger()
     cros_event.setEventLogger(new_log)
     self.assertEqual(new_log, cros_event.root)
 def tearDown(self):
     if hasattr(self, '_last_root') and self._last_root:
         cros_event.setEventLogger(self._last_root)
Beispiel #4
0
 def SetEventLoggerTest(self):
     new_log = ce.EventDummyLogger()
     ce.setEventLogger(new_log)
     self.assertEqual(new_log, ce.root)
Beispiel #5
0
 def tearDown(self):
     if hasattr(self, "_last_root") and self._last_root:
         ce.setEventLogger(self._last_root)