AU: Optionally limit the size of delta update operations.

Add a --chunk_size flag to delta_generator. If it's not -1, files will
be split into chunks of this size when generating delta payloads. This
effectively limits the size of each delta operation.

BUG=chromium:229797
TEST=unit tests; generated delta payloads and checked them through
paycheck.py.

Change-Id: I21502118088bfbac75aa8009eb144f6aaf23a83a
Reviewed-on: https://gerrit.chromium.org/gerrit/48357
Commit-Queue: Darin Petkov <petkov@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Darin Petkov <petkov@chromium.org>
diff --git a/generate_delta_main.cc b/generate_delta_main.cc
index aa2b9cb..bde08d4 100644
--- a/generate_delta_main.cc
+++ b/generate_delta_main.cc
@@ -60,6 +60,7 @@
               "e.g. /path/to/sig:/path/to/next:/path/to/last_sig . Each "
               "signature will be assigned a client version, starting from "
               "kSignatureOriginalVersion.");
+DEFINE_int32(chunk_size, -1, "Payload chunk size (-1 -- no limit/default)");
 
 // This file contains a simple program that takes an old path, a new path,
 // and an output file as arguments and the path to an output file and
@@ -272,6 +273,7 @@
                                                    FLAGS_new_kernel,
                                                    FLAGS_out_file,
                                                    FLAGS_private_key,
+                                                   FLAGS_chunk_size,
                                                    &metadata_size)) {
     return 1;
   }