Re-land "[dev-util] Add symbolicate_dump endpoint to dev server"

This reverts commit 50fe427cb8cebf7dca441e92463c407cb90fddf3.

Add an endpoint to the dev server that will symbolicate a minidump.

BUG=chromium-os:29850
TEST=unit
TEST=run dev server, use curl to make it download some artifacts; check to
TEST=see that debug symbols are staged in static/archive
TEST=once symbols are staged, run the dev server in your
TEST=chroot and use curl with a minidump file like this:
TEST=  curl -F minidump=@/home/cmasone/chromeos/phooey/powerd.20120424.141235.1005.dmp http://localhost:8080/symbolicate_dump

Change-Id: Ib9c11afd780aea5a665358b43f03a210ecc83482
Reviewed-on: https://gerrit.chromium.org/gerrit/21541
Tested-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Scott Zawalski <scottz@chromium.org>
Tested-by: Scott Zawalski <scottz@chromium.org>
Commit-Ready: Scott Zawalski <scottz@chromium.org>
diff --git a/downloadable_artifact.py b/downloadable_artifact.py
index f4a3f82..bf16885 100644
--- a/downloadable_artifact.py
+++ b/downloadable_artifact.py
@@ -13,6 +13,7 @@
 
 
 # Names of artifacts we care about.
+DEBUG_SYMBOLS = 'debug.tgz'
 STATEFUL_UPDATE = 'stateful.tgz'
 TEST_IMAGE = 'chromiumos_test_image.bin'
 ROOT_UPDATE = 'update.gz'
@@ -137,3 +138,17 @@
     # code.
     cmd = 'cp %s/* %s' % (autotest_pkgs_dir, autotest_dir)
     subprocess.check_call(cmd, shell=True)
+
+
+class DebugTarball(Tarball):
+  """Wrapper around the debug symbols tarball to download from gsutil."""
+
+  def _ExtractTarball(self):
+    """Extracts debug/breakpad from the tarball into the install_path."""
+    cmd = 'tar xzf %s --directory=%s debug/breakpad' % (
+        self._tmp_stage_path, self._install_path)
+    msg = 'An error occurred when attempting to untar %s' % self._tmp_stage_path
+    try:
+      subprocess.check_call(cmd, shell=True)
+    except subprocess.CalledProcessError, e:
+      raise ArtifactDownloadError('%s %s' % (msg, e))