AU: Update Downloader to support our image formats.

The downloader used to be dumb in the sense that it would pipe output
to either a DirectFileWriter or a DirectFileWriter via a
GzipDecompressingFileWriter, depending on if we were downloading an
update that was compressed or not. Sadly, things have gotten more
complex: we need to download to two partitions (kernel + rootfs), and
we may stream data via a DeltaPerformer (a type of FileWriter) to the
disk. Thus, the Downloader streams to either
1. gzip decompress->split_writer->direct to disk OR
2. delta performer

Other misc changes: Change FilesystemCopierAction to support
optionally copying the kernel partition rather than root partition.

InstallPlan struct: add an entry for destiation kernel partition.

Test Utils: a new ScopedTempFile class

Utils: support for getting the booted kernel partition device.

BUG=None
TEST=attached unittests

Review URL: http://codereview.chromium.org/1694025
diff --git a/filesystem_copier_action.cc b/filesystem_copier_action.cc
index 18bab44..bd44867 100755
--- a/filesystem_copier_action.cc
+++ b/filesystem_copier_action.cc
@@ -47,17 +47,23 @@
     return;
   }
 
-  const string source =
-      copy_source_.empty() ? utils::BootDevice() : copy_source_;
-  LOG(INFO) << "Copying from " << source << " to "
-            << install_plan_.install_path;
+  string source = copy_source_;
+  if (source.empty()) {
+    source = copying_kernel_install_path_ ?
+        utils::BootKernelDevice(utils::BootDevice()) :
+        utils::BootDevice();
+  }
+
+  const string destination = copying_kernel_install_path_ ?
+      install_plan_.kernel_install_path :
+      install_plan_.install_path;
   
   int src_fd = open(source.c_str(), O_RDONLY);
   if (src_fd < 0) {
     PLOG(ERROR) << "Unable to open " << source << " for reading:";
     return;
   }
-  int dst_fd = open(install_plan_.install_path.c_str(),
+  int dst_fd = open(destination.c_str(),
                     O_WRONLY | O_TRUNC | O_CREAT,
                     0644);
   if (dst_fd < 0) {