Reland "cros_generate_update_payload: Switch update_engine to major version 2"

This is a reland of 0e274ee7241f5d0214d135f8b5df95317dcdecd6

Original change's description:
> cros_generate_update_payload: Switch update_engine to major version 2
>
> Per this change, we switch the update payload generation on the server side to
> major version 2. This new version includes smaller payloads (5%-10%) and has the
> capability to install multiple partitions (in comparison to a fixed two, kernel
> and root.) This affects all boards. For more information about the client
> support and the needed stepping stone refer to the attached issue.
>
> The changes in this patch includes:
> - Generating a postinstall file to be passed to paygen.
> - Added the metadata signatures to the payload itself.
>
> BUG=chromium:794404
> TEST=cros flash
> TEST=manually signed the payload and installed it.
>
> Change-Id: Ic520be3a04898f881d4ec745644462d144de43eb
> Reviewed-on: https://chromium-review.googlesource.com/1369104
> Commit-Ready: Amin Hassani <ahassani@chromium.org>
> Tested-by: Amin Hassani <ahassani@chromium.org>
> Reviewed-by: Amin Hassani <ahassani@chromium.org>
> Reviewed-by: Don Garrett <dgarrett@chromium.org>

Bug: chromium:794404
CQ-DEPEND=CL:1375023
Change-Id: Iec4bd6ac705d848c8ff96485297c81de20e3e38d
Reviewed-on: https://chromium-review.googlesource.com/1377391
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Alec Thilenius <athilenius@google.com>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/cros_generate_update_payload_unittest.py b/scripts/cros_generate_update_payload_unittest.py
index 35dfc00..a3b935a 100644
--- a/scripts/cros_generate_update_payload_unittest.py
+++ b/scripts/cros_generate_update_payload_unittest.py
@@ -8,6 +8,7 @@
 from __future__ import print_function
 
 import os
+import tempfile
 
 from chromite.lib import cros_build_lib
 from chromite.lib import cros_test_lib
@@ -110,6 +111,8 @@
     )
     self.PatchObject(cros_build_lib, 'GetImageDiskPartitionInfo',
                      return_value=fake_partitions)
+    self.PatchObject(tempfile, 'NamedTemporaryFile',
+                     return_value=type('file', (object,), {'name': temp}))
     cros_generate_update_payload.main([
         '--image', '/dev/null',
         '--src_image', '/dev/null',
@@ -117,10 +120,10 @@
     ])
 
     self.assertCommandContains([
-        '--major_version=1',
-        '--new_image=' + temp,
-        '--new_kernel=' + temp,
-        '--old_image=' + temp,
-        '--old_kernel=' + temp,
+        '--major_version=2',
+        '--partition_names=root:kernel',
+        '--new_partitions=' + ':'.join([temp, temp]),
+        '--new_postinstall_config_file=' + temp,
+        '--old_partitions=' + ':'.join([temp, temp]),
         '--rootfs_partition_size=4',
     ])