Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c25182c7 authored by Kelvin Zhang's avatar Kelvin Zhang Committed by Gerrit Code Review
Browse files

Merge "Fix pylint warnings on ota_from_target_files.py"

parents 2ca17745 22c687c5
Loading
Loading
Loading
Loading
+24 −20
Original line number Diff line number Diff line
@@ -229,11 +229,11 @@ import zipfile

import common
import ota_utils
from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
                       PropertyFiles)
import target_files_diff
from check_target_files_vintf import CheckVintfIfTrebleEnabled
from non_ab_ota import GenerateNonAbOtaPackage
from ota_utils import (UNZIP_PATTERN, FinalizeMetadata, GetPackageMetadata,
                       PropertyFiles)

if sys.hexversion < 0x02070000:
  print("Python 2.7 or newer is required.", file=sys.stderr)
@@ -961,7 +961,8 @@ def GeneratePartitionTimestampFlags(partition_state):
      for part in partition_state]
  return ["--partition_timestamps", ",".join(partition_timestamps)]

def GeneratePartitionTimestampFlagsDowngrade(pre_partition_state, post_partition_state):
def GeneratePartitionTimestampFlagsDowngrade(
    pre_partition_state, post_partition_state):
  assert pre_partition_state is not None
  partition_timestamps = {}
  for part in pre_partition_state:
@@ -1026,7 +1027,8 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
  else:
    staging_file = output_file
  output_zip = zipfile.ZipFile(staging_file, "w",
                               compression=zipfile.ZIP_DEFLATED, allowZip64=True)
                               compression=zipfile.ZIP_DEFLATED,
                               allowZip64=True)

  if source_file is not None:
    assert "ab_partitions" in OPTIONS.source_info_dict, \
@@ -1091,7 +1093,7 @@ def GenerateAbOtaPackage(target_file, output_file, source_file=None):
  additional_args += ["--max_timestamp", max_timestamp]

  if SupportsMainlineGkiUpdates(source_file):
    logger.warn("Detected build with mainline GKI, include full boot image.")
    logger.warning("Detected build with mainline GKI, include full boot image.")
    additional_args.extend(["--full_boot", "true"])

  payload.Generate(
@@ -1339,7 +1341,8 @@ def main(argv):
    if OPTIONS.source_info_dict:
      OPTIONS.source_info_dict['ab_partitions'] = \
        list(
          set(OPTIONS.source_info_dict['ab_partitions']) & set(OPTIONS.partial)
            set(OPTIONS.source_info_dict['ab_partitions']) &
            set(OPTIONS.partial)
        )

  # Load OEM dicts if provided.
@@ -1365,7 +1368,8 @@ def main(argv):
  ab_update = OPTIONS.info_dict.get("ab_update") == "true"
  allow_non_ab = OPTIONS.info_dict.get("allow_non_ab") == "true"
  if OPTIONS.force_non_ab:
    assert allow_non_ab, "--force_non_ab only allowed on devices that supports non-A/B"
    assert allow_non_ab,\
      "--force_non_ab only allowed on devices that supports non-A/B"
    assert ab_update, "--force_non_ab only allowed on A/B devices"

  generate_ab = not OPTIONS.force_non_ab and ab_update