示例#1
0
  def DetermineAndroidVariant(self, board):
    """Returns the Android variant in use by the active container ebuild."""
    try:
      android_package = self.DetermineAndroidPackage(board)
    except cros_build_lib.RunCommandError as rce:
      raise NoAndroidVariantError(
          'Android Variant could not be determined for %s; original error: %s' %
          (board, rce))
    if not android_package:
      raise NoAndroidVariantError(
          'Android Variant could not be determined for %s (no package?)' %
          board)

    all_use_flags = portage_util.GetInstalledPackageUseFlags(
        android_package, board)
    for use_flags in all_use_flags.values():
      for use_flag in use_flags:
        if 'cheets_userdebug' in use_flag or 'cheets_sdk_userdebug' in use_flag:
          return 'userdebug'
        elif 'cheets_user' in use_flag or 'cheets_sdk_user' in use_flag:
          # TODO(b/120999609): bertha builds always download userdebug builds
          # at the moment because user builds are broken. Remove this clause
          # when resolved.
          if self.DetermineAndroidTarget(board) == 'bertha':
            return 'userdebug'
          return 'user'

    # We iterated through all the flags and could not find user or userdebug.
    # This should not be possible given that this code is only ran by
    # builders, which will never use local images.
    raise NoAndroidVariantError(
        'Android Variant cannot be deteremined for the package: %s' %
        android_package)
示例#2
0
 def DetermineAndroidABI(self, board):
   """Returns the Android ABI in use by the active container ebuild."""
   use_flags = portage_util.GetInstalledPackageUseFlags(
       'sys-devel/arc-build', board)
   if 'abi_x86_64' in use_flags.get('sys-devel/arc-build', []):
     return 'x86_64'
   elif 'abi_x86_32' in use_flags.get('sys-devel/arc-build', []):
     return 'x86'
   else:
     # ARM only supports 32-bit so it does not have abi_x86_{32,64} set. But it
     # is also the last possible ABI, so returning by default.
     return 'arm'
示例#3
0
 def DetermineAndroidABI(self, board):
     """Returns the Android ABI in use by the active container ebuild."""
     use_flags = portage_util.GetInstalledPackageUseFlags(
         'sys-devel/arc-build', board)
     arc_build_flags = use_flags.get('sys-devel/arc-build', [])
     if 'abi_x86_64' in arc_build_flags:
         return 'x86_64'
     elif 'abi_x86_32' in arc_build_flags:
         return 'x86'
     elif 'abi_arm_64' in arc_build_flags:
         return 'arm64'
     elif 'abi_arm_32' in arc_build_flags:
         return 'arm'
     # We should be throwing NoAndroidABIError exception here, but some boards
     # rely on the default behavior that if there are no abi use flags set, then
     # it's an arm board, so we return 'arm' instead.
     return 'arm'
示例#4
0
  def DetermineAndroidABI(self, board):
    """Returns the Android ABI in use by the active container ebuild."""
    try:
      android_package = self.DetermineAndroidPackage(board)
    except cros_build_lib.RunCommandError:
      raise NoAndroidABIError(
          'Android ABI could not be determined for %s' % board)
    if not android_package:
      raise NoAndroidABIError(
          'Android ABI could not be determined for %s (no package?)' % board)

    use_flags = portage_util.GetInstalledPackageUseFlags(
        'sys-devel/arc-build', board)
    if 'abi_x86_64' in use_flags.get('sys-devel/arc-build', []):
      return 'x86_64'
    elif 'abi_x86_32' in use_flags.get('sys-devel/arc-build', []):
      return 'x86'
    else:
      # ARM only supports 32-bit so it does not have abi_x86_{32,64} set. But it
      # is also the last possible ABI, so returning by default.
      return 'arm'
示例#5
0
  def DetermineAndroidABI(self):
    """Returns the Android ABI in use by the active container ebuild.

    Workspace version of cbuildbot_run.DetermineAndroidABI().

    Args:
      package: String name of Android package to get ABI version of.

    Returns:
      string defining ABI of the container.
    """
    use_flags = portage_util.GetInstalledPackageUseFlags(
        'sys-devel/arc-build', self._current_board,
        buildroot=self._build_root)
    if 'abi_x86_64' in use_flags.get('sys-devel/arc-build', []):
      return 'x86_64'
    elif 'abi_x86_32' in use_flags.get('sys-devel/arc-build', []):
      return 'x86'
    else:
      # ARM only supports 32-bit so it does not have abi_x86_{32,64} set. But it
      # is also the last possible ABI, so returning by default.
      return 'arm'
示例#6
0
  def DetermineAndroidVariant(self, package):
    """Returns the Android variant in use by the active container ebuild."""

    all_use_flags = portage_util.GetInstalledPackageUseFlags(
        package, self._current_board, buildroot=self._build_root)
    for use_flags in all_use_flags.values():
      for use_flag in use_flags:
        if 'cheets_userdebug' in use_flag or 'cheets_sdk_userdebug' in use_flag:
          return 'userdebug'
        elif 'cheets_user' in use_flag or 'cheets_sdk_user' in use_flag:
          # TODO(b/120999609): bertha builds always download userdebug builds
          # at the moment because user builds are broken. Remove this clause
          # when resolved.
          if self.DetermineAndroidTarget(package) == 'bertha':
            return 'userdebug'
          return 'user'

    # We iterated through all the flags and could not find user or userdebug.
    # This should not be possible given that this code is only ran by
    # builders, which will never use local images.
    raise cbuildbot_run.NoAndroidVariantError(
        'Android Variant cannot be determined for the packge: %s' %
        package)