full support for OTA of vendor partitions

Make vendor partition a first-class member of the OTA system (for
target_files that contain a VENDOR/ subdirectory).

Build vendor images in a way that is compatible with block-based OTA.
Support updating the vendor partition in both full and incremental,
block and file OTAs.  In most cases this is handled by refactoring the
existing code to handle the system partition to handle either, and
then calling it twice.

Currently we don't support incremental OTAs from a target-files
without a VENDOR subdirectory to one with one, or vice versa.  To add
or remove a vendor partition a full OTA will need to be done.

Bug: 15544685
Change-Id: I9cb9a1267060bd9683a9bea19b43a26b5a43800d
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index efba1fe..27981cd 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -1008,14 +1008,14 @@
   p.communicate()
   assert p.returncode == 0, "Couldn't compress patch"
 
-def MakeSystemPatch(source_file, target_file):
+def MakePartitionPatch(source_file, target_file, partition):
   with tempfile.NamedTemporaryFile() as output_file:
     XDelta3(source_file.name, target_file.name, output_file.name)
     XZ(output_file.name)
     with open(output_file.name + ".xz") as patch_file:
       patch_data = patch_file.read()
       os.unlink(patch_file.name)
-      return File("system.muimg.p", patch_data)
+      return File(partition + ".muimg.p", patch_data)
 
 def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
                       info_dict=None):