update_payload: Add puffin binary path to paycheck.py

We forgot to add the path to the puffin binary to paycheck.py and payload.py and
this caused the canary builds fail for minor version 4. This patch fixes it.

BUG=chromium:791079
TEST=tryjob

Change-Id: I194ab9d9d0b93fc9d456b994f73424d7dedbf181
Reviewed-on: https://chromium-review.googlesource.com/803656
Commit-Ready: Amin Hassani <ahassani@chromium.org>
Tested-by: Amin Hassani <ahassani@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
diff --git a/scripts/paycheck.py b/scripts/paycheck.py
index 0195f53..c87c202 100755
--- a/scripts/paycheck.py
+++ b/scripts/paycheck.py
@@ -91,6 +91,8 @@
                               'operations (not in-place)'))
   trace_opts.add_option('--bspatch-path', metavar='FILE',
                         help=('use the specified bspatch binary'))
+  trace_opts.add_option('--puffpatch-path', metavar='FILE',
+                        help=('use the specified puffpatch binary'))
   parser.add_option_group(trace_opts)
 
   trace_opts = optparse.OptionGroup(parser, 'Block tracing')
@@ -147,6 +149,8 @@
       parser.error('--extract-bsdiff can only be used when applying payloads')
     if opts.bspatch_path:
       parser.error('--bspatch-path can only be used when applying payloads')
+    if opts.puffpatch_path:
+      parser.error('--puffpatch-path can only be used when applying payloads')
   else:
     parser.error('unexpected number of arguments')
 
@@ -215,6 +219,8 @@
         dargs = {'bsdiff_in_place': not options.extract_bsdiff}
         if options.bspatch_path:
           dargs['bspatch_path'] = options.bspatch_path
+        if options.puffpatch_path:
+          dargs['puffpatch_path'] = options.puffpatch_path
         if options.assert_type == _TYPE_DELTA:
           dargs['old_kernel_part'] = extra_args[2]
           dargs['old_rootfs_part'] = extra_args[3]
diff --git a/scripts/update_payload/payload.py b/scripts/update_payload/payload.py
index f76c0de..d8305a1 100644
--- a/scripts/update_payload/payload.py
+++ b/scripts/update_payload/payload.py
@@ -293,7 +293,7 @@
 
   def Apply(self, new_kernel_part, new_rootfs_part, old_kernel_part=None,
             old_rootfs_part=None, bsdiff_in_place=True, bspatch_path=None,
-            truncate_to_expected_size=True):
+            puffpatch_path=None, truncate_to_expected_size=True):
     """Applies the update payload.
 
     Args:
@@ -303,6 +303,7 @@
       old_rootfs_part: name of source rootfs partition file (optional)
       bsdiff_in_place: whether to perform BSDIFF operations in-place (optional)
       bspatch_path: path to the bspatch binary (optional)
+      puffpatch_path: path to the puffpatch binary (optional)
       truncate_to_expected_size: whether to truncate the resulting partitions
                                  to their expected sizes, as specified in the
                                  payload (optional)
@@ -315,6 +316,7 @@
     # Create a short-lived payload applier object and run it.
     helper = applier.PayloadApplier(
         self, bsdiff_in_place=bsdiff_in_place, bspatch_path=bspatch_path,
+        puffpatch_path=puffpatch_path,
         truncate_to_expected_size=truncate_to_expected_size)
     helper.Run(new_kernel_part, new_rootfs_part,
                old_kernel_part=old_kernel_part,