am b1047a99: Merge changes I00c75f37,I1fc3cb49

* commit 'b1047a99ce8b8d62ef911c5dfba7183c32e80a70':
  x86: the -mbionic flag is needed for IA builds.
  x86: qemu emulator is the default build target
diff --git a/core/Makefile b/core/Makefile
index ad58b92..3535ef7 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,15 +15,18 @@
 # <dest file> is relative to $(PRODUCT_OUT), so it should look like,
 # e.g., "system/etc/file.xml".
 # The filter part means "only eval the copy-one-file rule if this
-# src:dest pair is the first one to match %:dest"
+# src:dest pair is the first one to match the same dest"
+unique_product_copy_files_destinations := $(sort \
+    $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
 $(foreach cf,$(PRODUCT_COPY_FILES), \
-  $(eval _src := $(call word-colon,1,$(cf))) \
-  $(eval _dest := $(call word-colon,2,$(cf))) \
-  $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
-  $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \
-    $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \
-  $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
- )
+    $(eval _src := $(call word-colon,1,$(cf))) \
+    $(eval _dest := $(call word-colon,2,$(cf))) \
+    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+        $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
+        $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
+        $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
+        $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
+            $(unique_product_copy_files_destinations)))))
 
 # -----------------------------------------------------------------
 # docs/index.html
@@ -277,12 +280,15 @@
 
 event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
 
-# Include tags from all packages included in this product.
+# Include tags from all packages included in this product, plus all
+# tags that are part of the system (ie, not in a vendor/ or device/
+# directory).
 event_log_tags_src := \
     $(sort $(foreach m,\
       $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
       $(call module-names-for-tag-list,user), \
-      $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
+      $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
+      $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
 
 $(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
 $(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
@@ -1067,6 +1073,7 @@
 ifneq ($(TARGET_PRODUCT),sdk)
 ifneq ($(TARGET_DEVICE),generic)
 ifneq ($(TARGET_NO_KERNEL),true)
+ifneq ($(recovery_fstab),)
 
 # -----------------------------------------------------------------
 # OTA update package
@@ -1119,6 +1126,7 @@
 .PHONY: updatepackage
 updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
 
+endif    # recovery_fstab is defined
 endif    # TARGET_NO_KERNEL != true
 endif    # TARGET_DEVICE != generic
 endif    # TARGET_PRODUCT != sdk
diff --git a/core/main.mk b/core/main.mk
index 3877bb2..cb8f5d7 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -770,9 +770,10 @@
 ALL_SDK_TARGETS := $(INTERNAL_SDK_TARGET)
 sdk: $(ALL_SDK_TARGETS)
 $(call dist-for-goals,sdk, \
-	$(ALL_SDK_TARGETS) \
-	$(SYMBOLS_ZIP) \
- )
+    $(ALL_SDK_TARGETS) \
+    $(SYMBOLS_ZIP) \
+    $(INSTALLED_BUILD_PROP_TARGET) \
+)
 
 .PHONY: findbugs
 findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a236a12..52e7aed 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -18,6 +18,7 @@
 import getpass
 import imp
 import os
+import platform
 import re
 import sha
 import shutil
@@ -57,6 +58,22 @@
   return subprocess.Popen(args, **kwargs)
 
 
+def CloseInheritedPipes():
+  """ Gmake in MAC OS has file descriptor (PIPE) leak. We close those fds
+  before doing other work."""
+  if platform.system() != "Darwin":
+    return
+  for d in range(3, 1025):
+    try:
+      stat = os.fstat(d)
+      if stat is not None:
+        pipebit = stat[0] & 0x1000
+        if pipebit != 0:
+          os.close(d)
+    except OSError:
+      pass
+
+
 def LoadInfoDict(zip):
   """Read and parse the META/misc_info.txt key/value pairs from the
   input target files and return a dict."""
@@ -121,10 +138,6 @@
   makeint("boot_size")
 
   d["fstab"] = LoadRecoveryFSTab(zip)
-  if not d["fstab"]:
-    if "fs_type" not in d: d["fs_type"] = "yaffs2"
-    if "partition_type" not in d: d["partition_type"] = "MTD"
-
   return d
 
 def LoadRecoveryFSTab(zip):
@@ -134,9 +147,7 @@
   try:
     data = zip.read("RECOVERY/RAMDISK/etc/recovery.fstab")
   except KeyError:
-    # older target-files that doesn't have a recovery.fstab; fall back
-    # to the fs_type and partition_type keys.
-    return
+    raise ValueError("Could not find RECOVERY/RAMDISK/etc/recovery.fstab")
 
   d = {}
   for line in data.split("\n"):
@@ -350,9 +361,6 @@
     p = info_dict["fstab"][mount_point]
     fs_type = p.fs_type
     limit = info_dict.get(p.device + "_size", None)
-  else:
-    fs_type = info_dict.get("fs_type", None)
-    limit = info_dict.get(target + "_size", None)
   if not fs_type or not limit: return
 
   if fs_type == "yaffs2":
@@ -777,9 +785,4 @@
   if fstab:
     return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
   else:
-    devices = {"/boot": "boot",
-               "/recovery": "recovery",
-               "/radio": "radio",
-               "/data": "userdata",
-               "/cache": "cache"}
-    return info["partition_type"], info.get("partition_path", "") + devices[mount_point]
+    return None
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 756d673..a7c8e32 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -140,13 +140,6 @@
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type],
                           p.device, p.mount_point))
       self.mounts.add(p.mount_point)
-    else:
-      what = mount_point.lstrip("/")
-      what = self.info.get("partition_path", "") + what
-      self.script.append('mount("%s", "%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          what, mount_point))
-      self.mounts.add(mount_point)
 
   def UnpackPackageDir(self, src, dst):
     """Unpack a given directory from the OTA package into the given
@@ -173,12 +166,6 @@
       p = fstab[partition]
       self.script.append('format("%s", "%s", "%s");' %
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device))
-    else:
-      # older target-files without per-partition types
-      partition = self.info.get("partition_path", "") + partition
-      self.script.append('format("%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          partition))
 
   def DeleteFiles(self, file_list):
     """Delete all files in file_list."""
@@ -231,23 +218,6 @@
             'package_extract_file("%(fn)s", "%(device)s");' % args)
       else:
         raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,))
-    else:
-      # backward compatibility with older target-files that lack recovery.fstab
-      if self.info["partition_type"] == "MTD":
-        self.script.append(
-            ('assert(package_extract_file("%(fn)s", "/tmp/%(partition)s.img"),\n'
-             '       write_raw_image("/tmp/%(partition)s.img", "%(partition)s"),\n'
-             '       delete("/tmp/%(partition)s.img"));')
-            % {'partition': partition, 'fn': fn})
-      elif self.info["partition_type"] == "EMMC":
-        self.script.append(
-            ('package_extract_file("%(fn)s", "%(dir)s%(partition)s");')
-            % {'partition': partition, 'fn': fn,
-               'dir': self.info.get("partition_path", ""),
-               })
-      else:
-        raise ValueError("don't know how to write \"%s\" partitions" %
-                         (self.info["partition_type"],))
 
   def SetPermissions(self, fn, uid, gid, mode):
     """Set file ownership and permissions."""
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index 0139916..4a23ab4 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -188,6 +188,7 @@
 
 if __name__ == '__main__':
   try:
+    common.CloseInheritedPipes()
     main(sys.argv[1:])
   except common.ExternalError, e:
     print
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index aa691b4..cd10d7c 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -781,6 +781,7 @@
 
 if __name__ == '__main__':
   try:
+    common.CloseInheritedPipes()
     main(sys.argv[1:])
   except common.ExternalError, e:
     print