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."""