summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Doug Zongker <dougz@android.com> 2009-07-13 18:36:37 -0700
committer Doug Zongker <dougz@android.com> 2009-07-14 12:40:26 -0700
commit030614740c1a22e51c6513058852f9ab368fdf5d (patch)
treed41f238f5d819b5f3ff84017e2bf04fd4ae8df00
parente41accf68eedfd17bc569aee8480cf8c48d82e61 (diff)
in auto mode, generate both edify and amend scripts for full OTAs
Generate packages that can be installed by either amend or edify, so we can remove amend support from donut.
-rw-r--r--tools/releasetools/both_generator.py60
-rwxr-xr-xtools/releasetools/ota_from_target_files7
2 files changed, 65 insertions, 2 deletions
diff --git a/tools/releasetools/both_generator.py b/tools/releasetools/both_generator.py
new file mode 100644
index 0000000000..df2a6593b9
--- /dev/null
+++ b/tools/releasetools/both_generator.py
@@ -0,0 +1,60 @@
+# Copyright (C) 2009 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import edify_generator
+import amend_generator
+
+class BothGenerator(object):
+ def __init__(self, version):
+ self.version = version
+ self.edify = edify_generator.EdifyGenerator(version)
+ self.amend = amend_generator.AmendGenerator()
+
+ def MakeTemporary(self):
+ x = BothGenerator(self.version)
+ x.edify = self.edify.MakeTemporary()
+ x.amend = self.amend.MakeTemporary()
+ return x
+
+ def AppendScript(self, other):
+ self.edify.AppendScript(other.edify)
+ self.amend.AppendScript(other.amend)
+
+ def _DoBoth(self, name, *args):
+ getattr(self.edify, name)(*args)
+ getattr(self.amend, name)(*args)
+
+ def AssertSomeFingerprint(self, *a): self._DoBoth("AssertSomeFingerprint", *a)
+ def AssertOlderBuild(self, *a): self._DoBoth("AssertOlderBuild", *a)
+ def AssertDevice(self, *a): self._DoBoth("AssertDevice", *a)
+ def AssertSomeBootloader(self, *a): self._DoBoth("AssertSomeBootloader", *a)
+ def ShowProgress(self, *a): self._DoBoth("ShowProgress", *a)
+ def PatchCheck(self, *a): self._DoBoth("PatchCheck", *a)
+ def CacheFreeSpaceCheck(self, *a): self._DoBoth("CacheFreeSpaceCheck", *a)
+ def Mount(self, *a): self._DoBoth("Mount", *a)
+ def UnpackPackageDir(self, *a): self._DoBoth("UnpackPackageDir", *a)
+ def Comment(self, *a): self._DoBoth("Comment", *a)
+ def Print(self, *a): self._DoBoth("Print", *a)
+ def FormatPartition(self, *a): self._DoBoth("FormatPartition", *a)
+ def DeleteFiles(self, *a): self._DoBoth("DeleteFiles", *a)
+ def ApplyPatch(self, *a): self._DoBoth("ApplyPatch", *a)
+ def WriteFirmwareImage(self, *a): self._DoBoth("WriteFirmwareImage", *a)
+ def WriteRawImage(self, *a): self._DoBoth("WriteRawImage", *a)
+ def SetPermissions(self, *a): self._DoBoth("SetPermissions", *a)
+ def SetPermissionsRecursive(self, *a): self._DoBoth("SetPermissionsRecursive", *a)
+ def MakeSymlinks(self, *a): self._DoBoth("MakeSymlinks", *a)
+ def AppendExtra(self, *a): self._DoBoth("AppendExtra", *a)
+
+ def AddToZip(self, input_zip, output_zip, input_path=None):
+ self._DoBoth("AddToZip", input_zip, output_zip, input_path)
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index ea4c752ab3..4b7ee03fea 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -69,6 +69,7 @@ import zipfile
import common
import amend_generator
import edify_generator
+import both_generator
OPTIONS = common.OPTIONS
OPTIONS.package_key = "build/target/product/security/testkey"
@@ -294,13 +295,15 @@ def AppendAssertions(script, input_zip):
def WriteFullOTAPackage(input_zip, output_zip):
- if OPTIONS.script_mode in ("amend", "auto"):
+ if OPTIONS.script_mode == "auto":
+ script = both_generator.BothGenerator(2)
+ elif OPTIONS.script_mode == "amend":
script = amend_generator.AmendGenerator()
else:
# TODO: how to determine this? We don't know what version it will
# be installed on top of. For now, we expect the API just won't
# change very often.
- script = edify_generator.EdifyGenerator(1)
+ script = edify_generator.EdifyGenerator(2)
if not OPTIONS.omit_prereq:
ts = GetBuildProp("ro.build.date.utc", input_zip)