Enabled incrementals to patch + rename moved files

Change-Id: I551fc5291847e3ace15361c203d86f566c26da97
This commit is contained in:
Michael Runge
2013-12-13 18:06:28 -08:00
parent 7493c39eff
commit 4038aa8fff
3 changed files with 102 additions and 13 deletions

View File

@@ -184,6 +184,20 @@ class EdifyGenerator(object):
cmd = "delete(" + ",\0".join(['"%s"' % (i,) for i in file_list]) + ");"
self.script.append(self._WordWrap(cmd))
def RenameFile(self, srcfile, tgtfile):
"""Moves a file from one location to another."""
if self.info.get("update_rename_support", False):
self.script.append('rename("%s", "%s");' % (srcfile, tgtfile))
else:
raise ValueError("Rename not supported by update binary")
def SkipNextActionIfTargetExists(self, tgtfile, tgtsha1):
"""Prepend an action with an apply_patch_check in order to
skip the action if the file exists. Used when a patch
is later renamed."""
cmd = ('sha1_check(read_file("%s"), %s) || ' % (tgtfile, tgtsha1))
self.script.append(self._WordWrap(cmd))
def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs):
"""Apply binary patches (in *patchpairs) to the given srcfile to
produce tgtfile (which may be "-" to indicate overwriting the