Merge topic 'arm64'

* changes:
  HACK: add 64-bit directory blacklist
  add support for module supported or unsupported target architectures
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 9d69736..5d1b350 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -16,12 +16,17 @@
 
 import sys
 
+# See PROP_VALUE_MAX system_properties.h.
+# PROP_VALUE_MAX in system_properties.h includes the termination NUL,
+# so we decrease it by 1 here.
+PROP_VALUE_MAX = 91
+
 # Put the modifications that you need to make into the /system/build.prop into this
 # function. The prop object has get(name) and put(name,value) methods.
 def mangle_build_prop(prop):
   pass
 
-# Put the modifications that you need to make into the /system/build.prop into this
+# Put the modifications that you need to make into the /default.prop into this
 # function. The prop object has get(name) and put(name,value) methods.
 def mangle_default_prop(prop):
   # If ro.debuggable is 1, then enable adb on USB by default
@@ -39,9 +44,47 @@
   if not prop.get("persist.sys.usb.config"):
     prop.put("persist.sys.usb.config", "none");
 
+def validate(prop):
+  """Validate the properties.
+
+  Returns:
+    True if nothing is wrong.
+  """
+  check_pass = True
+  buildprops = prop.to_dict()
+  dev_build = buildprops.get("ro.build.version.incremental",
+                             "").startswith("eng")
+  for key, value in buildprops.iteritems():
+    # Check build properties' length.
+    if len(value) > PROP_VALUE_MAX:
+      # If dev build, show a warning message, otherwise fail the
+      # build with error message
+      if dev_build:
+        sys.stderr.write("warning: %s exceeds %d bytes: " %
+                         (key, PROP_VALUE_MAX))
+        sys.stderr.write("%s (%d)\n" % (value, len(value)))
+        sys.stderr.write("warning: This will cause the %s " % key)
+        sys.stderr.write("property return as empty at runtime\n")
+      else:
+        check_pass = False
+        sys.stderr.write("error: %s cannot exceed %d bytes: " %
+                         (key, PROP_VALUE_MAX))
+        sys.stderr.write("%s (%d)\n" % (value, len(value)))
+  return check_pass
+
 class PropFile:
+
   def __init__(self, lines):
-    self.lines = [s[:-1] for s in lines]
+    self.lines = [s.strip() for s in lines]
+
+  def to_dict(self):
+    props = {}
+    for line in self.lines:
+      if not line or line.startswith("#"):
+        continue
+      key, value = line.split("=", 1)
+      props[key] = value
+    return props
 
   def get(self, name):
     key = name + "="
@@ -69,6 +112,7 @@
   f.close()
 
   properties = PropFile(lines)
+
   if filename.endswith("/build.prop"):
     mangle_build_prop(properties)
   elif filename.endswith("/default.prop"):
@@ -77,6 +121,9 @@
     sys.stderr.write("bad command line: " + str(argv) + "\n")
     sys.exit(1)
 
+  if not validate(properties):
+    sys.exit(1)
+
   f = open(filename, 'w+')
   properties.write(f)
   f.close()