merge in gingerbread-release history after reset to gingerbread
diff --git a/core/build_id.mk b/core/build_id.mk
index 3ec3348..4b7b0e4 100644
--- a/core/build_id.mk
+++ b/core/build_id.mk
@@ -1,4 +1,3 @@
-
 #
 # Copyright (C) 2008 The Android Open Source Project
 #
@@ -14,9 +13,20 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+
+#
+# Defines branch-specific values.
+#
+
 # BUILD_ID is usually used to specify the branch name
 # (like "MAIN") or a branch name and a release candidate
-# (like "CRB01").  It must be a single word, and is
+# (like "TC1-RC5").  It must be a single word, and is
 # capitalized by convention.
+#
+BUILD_ID := GINGERBREAD
 
-export BUILD_ID=GRI73
+# DISPLAY_BUILD_NUMBER should only be set for development branches,
+# If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for
+# a more descriptive BUILD_ID_DISPLAY, otherwise BUILD_ID_DISPLAY
+# is the same as BUILD_ID
+DISPLAY_BUILD_NUMBER := true
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 74192f7..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."""
diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files
index f10af49..78fd141 100755
--- a/tools/releasetools/img_from_target_files
+++ b/tools/releasetools/img_from_target_files
@@ -181,6 +181,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