def DetermineAndroidPackage(self):
        """Returns the active Android container package in use by the board.

    Workspace version of cbuildbot_run.DetermineAndroidPackage().

    Returns:
      String identifier for a package, or None
    """
        packages = portage_util.GetPackageDependencies(
            self._current_board,
            'virtual/target-os',
            buildroot=self._build_root)

        android_packages = {
            p
            for p in packages
            if p.startswith('chromeos-base/android-container-')
            or p.startswith('chromeos-base/android-vm-')
        }

        assert len(android_packages) <= 1

        if android_packages:
            return next(iter(android_packages))
        else:
            return None
Example #2
0
 def DetermineAndroidPackage(self, board):
   """Returns the active Android container package in use by the board."""
   packages = portage_util.GetPackageDependencies(board, 'virtual/target-os')
   # We assume there is only one Android package in the depgraph.
   for package in packages:
     if package.startswith('chromeos-base/android-container'):
       return package
   return None
Example #3
0
 def _FindKernelVersion(self):
     """Returns a string containing the kernel version for this build."""
     try:
         packages = portage_util.GetPackageDependencies(
             self._current_board, 'virtual/linux-sources')
     except cros_build_lib.RunCommandError:
         logging.warning('Unable to get package list for metadata.')
         return None
     for package in packages:
         if package.startswith('sys-kernel/chromeos-kernel-'):
             kernel_version = package_info.SplitCPV(package).version
             logging.info('Found active kernel version: %s', kernel_version)
             return kernel_version
     return None
Example #4
0
def determine_android_package(board):
    """Returns the active Android container package in use by the board.

  Args:
    board: The board name this is specific to.
  """
    try:
        packages = portage_util.GetPackageDependencies(board,
                                                       'virtual/target-os')
        # We assume there is only one Android package in the depgraph.
        for package in packages:
            if package.startswith('chromeos-base/android-container-') or \
               package.startswith('chromeos-base/android-vm-'):
                return package
        return None
    except cros_build_lib.RunCommandError as e:
        # Return None because a command (likely portage) failed when trying to
        # determine the package.
        logging.warning('Caught exception in determine_android_package: %s', e)
        return None
def determine_kernel_version(build_target):
    """Returns a string containing the kernel version for this build target.

  Args:
    build_target (build_target_lib.BuildTarget): The build target.

  Returns:
    (str) The kernel versions, or None.
  """
    try:
        packages = portage_util.GetPackageDependencies(
            build_target.name, 'virtual/linux-sources')
    except cros_build_lib.RunCommandError as e:
        logging.warning('Unable to get package list for metadata: %s', e)
        return None
    for package in packages:
        if package.startswith('sys-kernel/chromeos-kernel-'):
            kernel_version = package_info.SplitCPV(package).version
            logging.info('Found active kernel version: %s', kernel_version)
            return kernel_version
    return None