diff options
author | Doug Zongker <dougz@google.com> | 2012-08-16 16:19:00 -0700 |
---|---|---|
committer | Doug Zongker <dougz@google.com> | 2012-08-16 16:19:00 -0700 |
commit | 1eb74dd9a01ec14a2e41309986ef7efba790be8f (patch) | |
tree | f71bba2d6e1eee8424b433cdf2264c29ea7f98a6 /tools/releasetools/ota_from_target_files | |
parent | bc415dd5eb2a135cbc24c21760338e6294c7a0d3 (diff) | |
download | build-1eb74dd9a01ec14a2e41309986ef7efba790be8f.zip build-1eb74dd9a01ec14a2e41309986ef7efba790be8f.tar.gz build-1eb74dd9a01ec14a2e41309986ef7efba790be8f.tar.bz2 |
load SYSTEM/build.prop into the info_dict
Change-Id: Ic747106ba11773ffc9c2eebc163cfd22b1d7a4d5
Diffstat (limited to 'tools/releasetools/ota_from_target_files')
-rwxr-xr-x | tools/releasetools/ota_from_target_files | 46 |
1 files changed, 24 insertions, 22 deletions
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index b8fe68c..3cd271a 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -303,8 +303,8 @@ def SignOutput(temp_zip_name, output_zip_name): whole_file=True) -def AppendAssertions(script, input_zip): - device = GetBuildProp("ro.product.device", input_zip) +def AppendAssertions(script, info_dict): + device = GetBuildProp("ro.product.device", info_dict) script.AssertDevice(device) @@ -358,9 +358,12 @@ def WriteFullOTAPackage(input_zip, output_zip): # change very often. script = edify_generator.EdifyGenerator(3, OPTIONS.info_dict) - metadata = {"post-build": GetBuildProp("ro.build.fingerprint", input_zip), - "pre-device": GetBuildProp("ro.product.device", input_zip), - "post-timestamp": GetBuildProp("ro.build.date.utc", input_zip), + metadata = {"post-build": GetBuildProp("ro.build.fingerprint", + OPTIONS.info_dict), + "pre-device": GetBuildProp("ro.product.device", + OPTIONS.info_dict), + "post-timestamp": GetBuildProp("ro.build.date.utc", + OPTIONS.info_dict), } device_specific = common.DeviceSpecificParams( @@ -373,10 +376,10 @@ def WriteFullOTAPackage(input_zip, output_zip): info_dict=OPTIONS.info_dict) if not OPTIONS.omit_prereq: - ts = GetBuildProp("ro.build.date.utc", input_zip) + ts = GetBuildProp("ro.build.date.utc", OPTIONS.info_dict) script.AssertOlderBuild(ts) - AppendAssertions(script, input_zip) + AppendAssertions(script, OPTIONS.info_dict) device_specific.FullOTA_Assertions() device_specific.FullOTA_InstallBegin() @@ -446,16 +449,12 @@ def LoadSystemFiles(z): return out -def GetBuildProp(property, z): - """Return the fingerprint of the build of a given target-files - ZipFile object.""" - bp = z.read("SYSTEM/build.prop") - if not property: - return bp - m = re.search(re.escape(property) + r"=(.*)\n", bp) - if not m: +def GetBuildProp(prop, info_dict): + """Return the fingerprint of the build of a given target-files info_dict.""" + try: + return info_dict.get("build.prop", {})[prop] + except KeyError: raise common.ExternalError("couldn't find %s in build.prop" % (property,)) - return m.group(1).strip() def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): @@ -465,10 +464,13 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): if source_version == 0: print ("WARNING: generating edify script for a source that " "can't install it.") - script = edify_generator.EdifyGenerator(source_version, OPTIONS.target_info_dict) + script = edify_generator.EdifyGenerator(source_version, + OPTIONS.target_info_dict) - metadata = {"pre-device": GetBuildProp("ro.product.device", source_zip), - "post-timestamp": GetBuildProp("ro.build.date.utc", target_zip), + metadata = {"pre-device": GetBuildProp("ro.product.device", + OPTIONS.source_info_dict), + "post-timestamp": GetBuildProp("ro.build.date.utc", + OPTIONS.target_info_dict), } device_specific = common.DeviceSpecificParams( @@ -522,8 +524,8 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): patch_list.append((tf.name, tf, sf, tf.size, common.sha1(d).hexdigest())) largest_source_size = max(largest_source_size, sf.size) - source_fp = GetBuildProp("ro.build.fingerprint", source_zip) - target_fp = GetBuildProp("ro.build.fingerprint", target_zip) + source_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.source_info_dict) + target_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.target_info_dict) metadata["pre-build"] = source_fp metadata["post-build"] = target_fp @@ -550,7 +552,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): # 0.1 for unpacking verbatim files, symlinking, and doing the # device-specific commands. - AppendAssertions(script, target_zip) + AppendAssertions(script, OPTIONS.target_info_dict) device_specific.IncrementalOTA_Assertions() script.Print("Verifying current system...") |