add -n option to turn off prereq check when build OTA packages
Developers might legitimately want to install older builds on their
phones, so add option to build OTA packages that will install over
newer builds.
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 07ed155..c1e377a 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -37,6 +37,11 @@
Generate an OTA package that will wipe the user data partition
when installed.
+ -n (--no_prereq)
+ Omit the timestamp prereq check normally included at the top of
+ the build scripts (used for developer OTA packages which
+ legitimately need to go back and forth).
+
"""
import sys
@@ -63,6 +68,7 @@
OPTIONS.prohibit_verbatim = set(("system/build.prop",))
OPTIONS.patch_threshold = 0.95
OPTIONS.wipe_user_data = False
+OPTIONS.omit_prereq = False
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
@@ -323,9 +329,10 @@
def WriteFullOTAPackage(input_zip, output_zip):
script = []
- ts = GetBuildProp("ro.build.date.utc", input_zip)
- script.append("run_program PACKAGE:check_prereq %s" % (ts,))
- IncludeBinary("check_prereq", input_zip, output_zip)
+ if not OPTIONS.omit_prereq:
+ ts = GetBuildProp("ro.build.date.utc", input_zip)
+ script.append("run_program PACKAGE:check_prereq %s" % (ts,))
+ IncludeBinary("check_prereq", input_zip, output_zip)
AppendAssertions(script, input_zip)
@@ -619,16 +626,19 @@
OPTIONS.incremental_source = a
elif o in ("-w", "--wipe_user_data"):
OPTIONS.wipe_user_data = True
+ elif o in ("-n", "--no_prereq"):
+ OPTIONS.omit_prereq = True
else:
return False
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:k:i:d:w",
+ extra_opts="b:k:i:d:wn",
extra_long_opts=["board_config=",
"package_key=",
"incremental_from=",
- "wipe_user_data"],
+ "wipe_user_data",
+ "no_prereq"],
extra_option_handler=option_handler)
if len(args) != 2: