From c386890d0ea278962840bfecd23c0587bac7e5d6 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 1 Dec 2015 17:46:46 -0800 Subject: [PATCH] releasetools: Abort the update on apply_patch failures. We used to silently ignore the return value from apply_patch() even if it had failed. It gives us more trouble to investigate the failure when the affected file/partition gets touched in subsequent OTAs. This CL adds the checking of the return value and aborts the update accordingly. Bug: 25893277 Change-Id: Ie5e1c563576e503343e6a5b28ed4d7039f6f919c --- tools/releasetools/edify_generator.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py index b3785ac52f..d923cc813d 100644 --- a/tools/releasetools/edify_generator.py +++ b/tools/releasetools/edify_generator.py @@ -284,8 +284,8 @@ 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, package_extract_file("%s")' % patchpairs[i:i+2]) - cmd.append(');') + cmd.append(',\0%s,\0package_extract_file("%s")' % patchpairs[i:i+2]) + cmd.append(') ||\n abort("Failed to apply patch to %s");' % (srcfile,)) cmd = "".join(cmd) self.script.append(self.WordWrap(cmd))