Revert 281999 "Revert 281831 "Fix nacl_integration to run 32bit ..."

> Revert 281831 "Fix nacl_integration to run 32bit tests with 32bi..."
> 
> > Fix nacl_integration to run 32bit tests with 32bit userland and 64bit kernel.
> > 
> > detect_host_arch.py already knows how to figure this out, so reuse it.
> > (It could probably be used in the darwin and maybe even in the windows
> > branch too.)
> > 
> > BUG=368384
> > TEST=nacl_integration on http://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%282%29%2832%29/ goes green
> > [email protected]
> > 
> > Review URL: https://codereview.chromium.org/373253002
> 
> Suspect this is causing the failure http://build.chromium.org/p/chromium.win/builders/NaCl%20Tests%20%28x86-64%29/builds/13394
> 
> [email protected]
> 
> Review URL: https://codereview.chromium.org/374383002

Reverting the revert since it doesn't seem to cause the problem

[email protected]

Review URL: https://codereview.chromium.org/378283002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282008 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/build/detect_host_arch.py b/build/detect_host_arch.py
index 638dd68..19579eb 100755
--- a/build/detect_host_arch.py
+++ b/build/detect_host_arch.py
@@ -10,13 +10,8 @@
 import sys
 
 
-def main():
-  print DoMain([])
-  return 0
-
-def DoMain(_):
-  """Hook to be called from gyp without starting a separate python
-  interpreter."""
+def HostArch():
+  """Returns the host architecture with a predictable string."""
   host_arch = platform.machine()
 
   # Convert machine type to format recognized by gyp.
@@ -36,5 +31,10 @@
 
   return host_arch
 
+def DoMain(_):
+  """Hook to be called from gyp without starting a separate python
+  interpreter."""
+  return HostArch()
+
 if __name__ == '__main__':
-  sys.exit(main())
+  print DoMain([])
diff --git a/chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py b/chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
index ca198f4a..ab888f3 100755
--- a/chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
+++ b/chrome/test/nacl_test_injection/buildbot_chrome_nacl_stage.py
@@ -15,6 +15,11 @@
 
 import find_chrome
 
+THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+CHROMIUM_DIR = os.path.abspath(os.path.join(THIS_DIR, '..', '..', '..'))
+sys.path.append(os.path.join(CHROMIUM_DIR, 'build'))
+import detect_host_arch
+
 
 # Copied from buildbot/buildbot_lib.py
 def TryToCleanContents(path, file_name_filter=lambda fn: True):
@@ -149,17 +154,11 @@
         bits = 32
     scons = [python, 'scons.py']
   else:
-    p = subprocess.Popen(
-        'uname -m | '
-        'sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/"',
-        shell=True, stdout=subprocess.PIPE)
-    (p_stdout, _) = p.communicate()
-    assert p.returncode == 0
     if options.bits == 64:
       bits = 64
     elif options.bits == 32:
       bits = 32
-    elif p_stdout.find('64') >= 0:
+    elif '64' in detect_host_arch.HostArch():
       bits = 64
     else:
       bits = 32