OSDN Git Service

Merge "Report error codes in the OTA update script" into nyc-dev
authorTianjie Xu <xunchang@google.com>
Wed, 25 May 2016 21:11:12 +0000 (21:11 +0000)
committerandroid-build-merger <android-build-merger@google.com>
Wed, 25 May 2016 21:11:12 +0000 (21:11 +0000)
am: 654e4fb023

* commit '654e4fb02368b05cbfba3246b4c634512fa84464':
  Report error codes in the OTA update script

Change-Id: I333bd45886d5915858b762e086d8a263f81b26e2

1  2 
tools/releasetools/common.py
tools/releasetools/edify_generator.py

Simple merge
@@@ -113,22 -116,11 +116,22 @@@ class EdifyGenerator(object)
        raise ValueError("must specify some thumbprints")
      cmd = (' ||\n    '.join([('getprop("ro.build.thumbprint") == "%s"') % i
                               for i in fp]) +
-            ' ||\n    abort("Package expects build thumbprint of %s; this '
+            ' ||\n    abort("E%d: Package expects build thumbprint of %s; this '
             'device has " + getprop("ro.build.thumbprint") + ".");') % (
-                " or ".join(fp))
+                common.ErrorCode.THUMBPRINT_MISMATCH, " or ".join(fp))
      self.script.append(cmd)
  
 +  def AssertFingerprintOrThumbprint(self, fp, tp):
 +    """Assert that the current recovery build fingerprint is fp, or thumbprint
 +       is tp."""
 +    cmd = ('getprop("ro.build.fingerprint") == "{fp}" ||\n'
 +           '    getprop("ro.build.thumbprint") == "{tp}" ||\n'
 +           '    abort("Package expects build fingerprint of {fp} or '
 +           'thumbprint of {tp}; this device has a fingerprint of " '
 +           '+ getprop("ro.build.fingerprint") and a thumbprint of " '
 +           '+ getprop("ro.build.thumbprint") + ".");').format(fp=fp, tp=tp)
 +    self.script.append(cmd)
 +
    def AssertOlderBuild(self, timestamp, timestamp_text):
      """Assert that the build on the device is older (or the same as)
      the given timestamp."""