summaryrefslogtreecommitdiffstats
path: root/tools/releasetools/edify_generator.py
diff options
context:
space:
mode:
authorMichael Runge <mrunge@google.com>2014-04-15 17:40:21 -0700
committerMichael Runge <mrunge@google.com>2014-05-01 17:37:57 -0700
commit6e836116f764cf5cebf1654df2f17d8222554f6e (patch)
treeff142a0dedae7d4ba974571a282f15c0c771884f /tools/releasetools/edify_generator.py
parenta1215ab943faf4dd153cbbcce3675d16620d9e04 (diff)
downloadbuild-6e836116f764cf5cebf1654df2f17d8222554f6e.zip
build-6e836116f764cf5cebf1654df2f17d8222554f6e.tar.gz
build-6e836116f764cf5cebf1654df2f17d8222554f6e.tar.bz2
Add support for verifying OEM properties.
A separate OEM file must be specified to provide the expected values for these properties. The list of properties comes from the "oem_fingerprint_properties" list in misc_info.txt Bug: b/13367676 Change-Id: I1a3eaf108492132cf6f595a5d1c9f7e0c3cb3142
Diffstat (limited to 'tools/releasetools/edify_generator.py')
-rw-r--r--tools/releasetools/edify_generator.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index af545db..f6b30e0 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -68,6 +68,19 @@ class EdifyGenerator(object):
with temporary=True) to this one."""
self.script.extend(other.script)
+ def AssertOemProperty(self, name, value):
+ """Assert that a property on the OEM paritition matches a value."""
+ if not name:
+ raise ValueError("must specify an OEM property")
+ if not value:
+ raise ValueError("must specify the OEM value")
+ cmd = ('file_getprop("/oem/oem.prop", "%s") == "%s" || '
+ 'abort("This package expects the value \\"%s\\" for '
+ '\\"%s\\" on the OEM partition; '
+ 'this has value \\"" + file_getprop("/oem/oem.prop") + "\\".");'
+ ) % (name, value, name, value)
+ self.script.append(cmd)
+
def AssertSomeFingerprint(self, *fp):
"""Assert that the current system build fingerprint is one of *fp."""
if not fp:
@@ -81,15 +94,16 @@ class EdifyGenerator(object):
) % (" or ".join(fp),)
self.script.append(cmd)
- def AssertRecoveryFingerprint(self, *fp):
- """Assert that the current recovery build fingerprint is one of *fp."""
+ def AssertSomeThumbprint(self, *fp):
+ """Assert that the current system build thumbprint is one of *fp."""
if not fp:
- raise ValueError("must specify some fingerprints")
+ raise ValueError("must specify some thumbprints")
cmd = (
- ' ||\n '.join([('getprop("ro.build.fingerprint") == "%s"')
+ ' ||\n '.join([('file_getprop("/system/build.prop", '
+ '"ro.build.thumbprint") == "%s"')
% i for i in fp]) +
- ' ||\n abort("Package expects build fingerprint of %s; this '
- 'device has " + getprop("ro.build.fingerprint") + ".");'
+ ' ||\n abort("Package expects build thumbprint of %s; this '
+ 'device has " + getprop("ro.build.thumbprint") + ".");'
) % (" or ".join(fp),)
self.script.append(cmd)