gooftool: switch from bzip2 to xz

This reduces log size by ~25% in expense of doubled compression time.
Since network bandwidth is usually a more precious resource than CPU
time is in the factory, xz is more suitable than bzip2 in this case.

BUG=chrome-os-partner:17474
TEST=Finalize and see .tar.xz report on shopfloor server.

Change-Id: Icdad8b6aceb45e403a47bba674210f910bf1e900
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/42104
Reviewed-by: Jon Salz <jsalz@chromium.org>
diff --git a/py/gooftool/gooftool.py b/py/gooftool/gooftool.py
index d087825..5738a50 100755
--- a/py/gooftool/gooftool.py
+++ b/py/gooftool/gooftool.py
@@ -608,11 +608,12 @@
   if device_sn is None:
     logging.warning('RO_VPD missing device serial number')
     device_sn = 'MISSING_SN_' + TimedUuid()
-  target_name = '%s_%s.tbz2' % (time.strftime('%Y%m%dT%H%M%SZ', time.gmtime()),
-                                NormalizeAsFileName(device_sn))
+  target_name = '%s_%s.tar.xz' % (time.strftime('%Y%m%dT%H%M%SZ',
+                                  time.gmtime()),
+                                  NormalizeAsFileName(device_sn))
   target_path = os.path.join(gettempdir(), target_name)
   # Intentionally ignoring dotfiles in EVENT_LOG_DIR.
-  tar_cmd = 'cd %s ; tar cjf %s *' % (EVENT_LOG_DIR, target_path)
+  tar_cmd = 'cd %s ; tar cJf %s *' % (EVENT_LOG_DIR, target_path)
   tar_cmd += ' --add-file %s' % FACTORY_LOG_PATH
   if options.add_file:
     for f in options.add_file:
@@ -631,7 +632,7 @@
            "Removing leading `/' from member names" in x)
           for x in cmd_result.stderr.split('\n'))):
     # That's OK.  Make sure it's valid though.
-    Spawn(['tar', 'tfj', target_path], check_call=True, log=True,
+    Spawn(['tar', 'tfJ', target_path], check_call=True, log=True,
           ignore_stdout=True)
   elif not cmd_result.success:
     raise Error('unable to tar event logs, cmd %r failed, stderr: %r' %