add -w option to ota_from_target_files

Add option to make OTA packages that wipe user data.
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index dbac03d..07ed155 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -33,6 +33,10 @@
       Generate an incremental OTA using the given target-files zip as
       the starting build.
 
+  -w  (--wipe_user_data)
+      Generate an OTA package that will wipe the user data partition
+      when installed.
+
 """
 
 import sys
@@ -58,6 +62,7 @@
 OPTIONS.require_verbatim = set()
 OPTIONS.prohibit_verbatim = set(("system/build.prop",))
 OPTIONS.patch_threshold = 0.95
+OPTIONS.wipe_user_data = False
 
 def MostPopularKey(d, default):
   """Given a dict, return the key corresponding to the largest
@@ -331,6 +336,9 @@
   script.append("write_radio_image PACKAGE:radio.img")
   script.append("show_progress 0.5 0")
 
+  if OPTIONS.wipe_user_data:
+    script.append("format DATA:")
+
   script.append("format SYSTEM:")
   script.append("copy_dir PACKAGE:system SYSTEM:")
 
@@ -511,6 +519,9 @@
 
   script.append("\n# ---- start making changes here\n")
 
+  if OPTIONS.wipe_user_data:
+    script.append("format DATA:")
+
   DeleteFiles(script, [SubstituteRoot(i[0]) for i in verbatim_targets])
 
   if updating_boot:
@@ -602,21 +613,22 @@
   def option_handler(o, a):
     if o in ("-b", "--board_config"):
       common.LoadBoardConfig(a)
-      return True
     elif o in ("-k", "--package_key"):
       OPTIONS.package_key = a
-      return True
     elif o in ("-i", "--incremental_from"):
       OPTIONS.incremental_source = a
-      return True
+    elif o in ("-w", "--wipe_user_data"):
+      OPTIONS.wipe_user_data = True
     else:
       return False
+    return True
 
   args = common.ParseOptions(argv, __doc__,
-                             extra_opts="b:k:i:d:",
+                             extra_opts="b:k:i:d:w",
                              extra_long_opts=["board_config=",
                                               "package_key=",
-                                              "incremental_from="],
+                                              "incremental_from=",
+                                              "wipe_user_data"],
                              extra_option_handler=option_handler)
 
   if len(args) != 2: