Loading tools/releasetools/amend_generator.py +4 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,10 @@ class AmendGenerator(object): self.script.append("".join(out)) self.included_files.add(("applypatch_static", "applypatch")) # Not quite right since we don't need to check /cache/saved.file on # failure, but shouldn't hurt. FileCheck = PatchCheck def CacheFreeSpaceCheck(self, amount): """Check that there's at least 'amount' space that can be made available on /cache.""" Loading tools/releasetools/both_generator.py +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class BothGenerator(object): 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 FileCheck(self, filename, *sha1): self._DoBoth("FileCheck", *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) Loading tools/releasetools/edify_generator.py +9 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,14 @@ class EdifyGenerator(object): self.script.append("set_progress(%f);" % (frac,)) def PatchCheck(self, filename, *sha1): """Check that the given file (or MTD reference) has one of the given *sha1 hashes, checking the version saved in cache if the file does not match.""" self.script.append('assert(apply_patch_check("%s"' % (filename,) + "".join([', "%s"' % (i,) for i in sha1]) + '));') def FileCheck(self, filename, *sha1): """Check that the given file (or MTD reference) has one of the given *sha1 hashes.""" self.script.append('assert(sha1_check(read_file("%s")' % (filename,) + Loading Loading @@ -164,7 +172,7 @@ class EdifyGenerator(object): cmd = ['apply_patch("%s",\0"%s",\0%s,\0%d' % (srcfile, tgtfile, tgtsha1, tgtsize)] for i in range(0, len(patchpairs), 2): cmd.append(',\0"%s:%s"' % patchpairs[i:i+2]) cmd.append(',\0%s, package_extract_file("%s")' % patchpairs[i:i+2]) cmd.append(');') cmd = "".join(cmd) self.script.append(self._WordWrap(cmd)) Loading tools/releasetools/ota_from_target_files +2 −8 Original line number Diff line number Diff line Loading @@ -690,11 +690,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): if patch_list or updating_recovery or updating_boot: script.CacheFreeSpaceCheck(largest_source_size) script.Print("Unpacking patches...") script.UnpackPackageDir("patch", "/tmp/patchtmp") for fn, tf, sf, size, patch_sha in patch_list: script.PatchCheck("/tmp/patchtmp/" + tf.name + ".p", patch_sha) device_specific.IncrementalOTA_VerifyEnd() Loading @@ -718,8 +713,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.Print("Patching system files...") for fn, tf, sf, size, _ in patch_list: script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "/tmp/patchtmp/"+fn+".p") script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "patch/"+fn+".p") so_far += tf.size script.SetProgress(so_far / total_patch_size) Loading @@ -733,7 +727,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): target_boot.size, target_boot.sha1), "-", target_boot.size, target_boot.sha1, source_boot.sha1, "/tmp/patchtmp/boot.img.p") source_boot.sha1, "patch/boot.img.p") so_far += target_boot.size script.SetProgress(so_far / total_patch_size) print "boot image changed; including." Loading Loading
tools/releasetools/amend_generator.py +4 −0 Original line number Diff line number Diff line Loading @@ -100,6 +100,10 @@ class AmendGenerator(object): self.script.append("".join(out)) self.included_files.add(("applypatch_static", "applypatch")) # Not quite right since we don't need to check /cache/saved.file on # failure, but shouldn't hurt. FileCheck = PatchCheck def CacheFreeSpaceCheck(self, amount): """Check that there's at least 'amount' space that can be made available on /cache.""" Loading
tools/releasetools/both_generator.py +1 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ class BothGenerator(object): 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 FileCheck(self, filename, *sha1): self._DoBoth("FileCheck", *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) Loading
tools/releasetools/edify_generator.py +9 −1 Original line number Diff line number Diff line Loading @@ -111,6 +111,14 @@ class EdifyGenerator(object): self.script.append("set_progress(%f);" % (frac,)) def PatchCheck(self, filename, *sha1): """Check that the given file (or MTD reference) has one of the given *sha1 hashes, checking the version saved in cache if the file does not match.""" self.script.append('assert(apply_patch_check("%s"' % (filename,) + "".join([', "%s"' % (i,) for i in sha1]) + '));') def FileCheck(self, filename, *sha1): """Check that the given file (or MTD reference) has one of the given *sha1 hashes.""" self.script.append('assert(sha1_check(read_file("%s")' % (filename,) + Loading Loading @@ -164,7 +172,7 @@ class EdifyGenerator(object): cmd = ['apply_patch("%s",\0"%s",\0%s,\0%d' % (srcfile, tgtfile, tgtsha1, tgtsize)] for i in range(0, len(patchpairs), 2): cmd.append(',\0"%s:%s"' % patchpairs[i:i+2]) cmd.append(',\0%s, package_extract_file("%s")' % patchpairs[i:i+2]) cmd.append(');') cmd = "".join(cmd) self.script.append(self._WordWrap(cmd)) Loading
tools/releasetools/ota_from_target_files +2 −8 Original line number Diff line number Diff line Loading @@ -690,11 +690,6 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): if patch_list or updating_recovery or updating_boot: script.CacheFreeSpaceCheck(largest_source_size) script.Print("Unpacking patches...") script.UnpackPackageDir("patch", "/tmp/patchtmp") for fn, tf, sf, size, patch_sha in patch_list: script.PatchCheck("/tmp/patchtmp/" + tf.name + ".p", patch_sha) device_specific.IncrementalOTA_VerifyEnd() Loading @@ -718,8 +713,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): script.Print("Patching system files...") for fn, tf, sf, size, _ in patch_list: script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "/tmp/patchtmp/"+fn+".p") script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1, sf.sha1, "patch/"+fn+".p") so_far += tf.size script.SetProgress(so_far / total_patch_size) Loading @@ -733,7 +727,7 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): target_boot.size, target_boot.sha1), "-", target_boot.size, target_boot.sha1, source_boot.sha1, "/tmp/patchtmp/boot.img.p") source_boot.sha1, "patch/boot.img.p") so_far += target_boot.size script.SetProgress(so_far / total_patch_size) print "boot image changed; including." Loading