update_engine: migrate the package to use GN.

TEST=USE="asan fuzzer" FEATURES=test emerge-$BOARD update_engine   # BOARD=amd64-generic
TEST=FEATURES=test emerge-$BOARD update_engine
TEST=USE="test binder dbus hwid_override chrome_kiosk_app chrome_network_proxy mtd dlc" ebuild-$BOARD ~/trunk/src/third_party/chromiumos-overlay/chromeos-base/update_engine/update_engine-9999.ebuild clean compile
BUG=chromium:953642
Cq-Depend:chromium:1608971

Change-Id: I3de939193797858006d64c1ddbf3fc8e6f48b1eb
Reviewed-on: https://chromium-review.googlesource.com/1608969
Commit-Ready: Keigo Oka <[email protected]>
Tested-by: Keigo Oka <[email protected]>
Legacy-Commit-Queue: Commit Bot <[email protected]>
Reviewed-by: Keigo Oka <[email protected]>
diff --git a/tar_bunzip2.gni b/tar_bunzip2.gni
new file mode 100644
index 0000000..0a17899
--- /dev/null
+++ b/tar_bunzip2.gni
@@ -0,0 +1,33 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+template("tar_bunzip2") {
+  forward_variables_from(invoker, [ "image_out_dir" ])
+  out_dir = "${root_gen_dir}/${image_out_dir}"
+
+  action_foreach(target_name) {
+    sources = invoker.sources
+    script = "//common-mk/file_generator_wrapper.py"
+    outputs = [
+      "${out_dir}/{{source_name_part}}.flag",
+    ]
+    args = [
+      "sh",
+      "-c",
+      "tar -xvf \"{{source}}\" -C \"${out_dir}\" && touch ${out_dir}/{{source_name_part}}.flag",
+    ]
+  }
+}