Backed out changeset ec4a75961dc8
authorPhilippe M. Chiasson <gozer@mozilla.com>
Thu, 07 Jul 2011 13:03:58 -0400
changeset 7888 10df3ade195d15f6ce8000d8d7c5e9a036197542
parent 7805 ec4a75961dc81c863353e81bf40716f8aa3e2de4
child 7889 31cb62010d42c2338eebe3d894382d122333853f
push id158
push userbugzilla@standard8.plus.com
push dateTue, 27 Sep 2011 19:18:14 +0000
treeherdercomm-esr52@bafeec1cd4a4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
backs outec4a75961dc81c863353e81bf40716f8aa3e2de4
Backed out changeset ec4a75961dc8
build/print_mk_add_options.sh
build/run_client.py
client.mk
new file mode 100755
--- /dev/null
+++ b/build/print_mk_add_options.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+ac_add_options() {
+  return
+}
+
+mk_add_options() {
+  echo "mk_add_options:" "$@"
+}
+
+MOZCONFIG=${MOZCONFIG:-./.mozconfig}
+topsrcdir=${topsrcdir:-$PWD}
+
+source $MOZCONFIG
new file mode 100644
--- /dev/null
+++ b/build/run_client.py
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+
+import sys
+import os.path
+import re
+from subprocess import Popen, PIPE
+import shlex
+
+topsrcdir = sys.argv[1]
+
+run = False
+
+if len(sys.argv) >= 3:
+    run = True
+
+client_py_args = []
+
+options_re = re.compile('^mk_add_options:\s+CLIENT_PY_ARGS\s*=\s*(.*)$')
+always_run_re = re.compile('^mk_add_options:\s+ALWAYS_RUN_CLIENT_PY\s*=\s*(.*)$')
+
+process = Popen(['build/print_mk_add_options.sh'], stdout=PIPE, stderr=sys.stderr)
+output, unused_err = process.communicate()
+
+for line in output.splitlines():
+    found_opt = options_re.match(line)
+    if found_opt:
+        client_py_args = found_opt.group(1)
+
+    found_always = always_run_re.match(line)
+    if found_always:
+        val = found_always.group(1)
+        if val != "0":
+            run = True
+
+if run:
+    if not client_py_args:
+        print >> sys.stderr, "Can't run client.py without some CLIENT_PY_ARGS in mozconfig"
+        sys.exit(1)
+    cmd = [sys.executable, 'client.py' ] + shlex.split(client_py_args)
+    print >> sys.stderr, "Running: %s" % cmd
+    # Run the command and redirect output to stderr so make will display it
+    p = Popen(cmd,
+        stdout=sys.stderr,
+        stderr=sys.stderr,
+    )
+    p.wait()
+    print >> sys.stderr, "%s returned %s" % (cmd, p.returncode)
+    sys.exit(p.returncode)
--- a/client.mk
+++ b/client.mk
@@ -131,16 +131,27 @@ endif
 # Load mozconfig Options
 
 # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig.
 
 MOZCONFIG_LOADER := mozilla/build/autoconf/mozconfig2client-mk
 MOZCONFIG_FINDER := mozilla/build/autoconf/mozconfig-find
 MOZCONFIG_MODULES := mozilla/build/unix/uniq.pl
 
+# We need to give client.py an early chance to run, since we don't necessarely
+# have a mozilla/ checkout yet
+run_for_side_effects := \
+  @if test ! -f .client.run; then \
+    $(shell $(PYTHON) $(TOPSRCDIR)/build/run_client.py $(TOPSRCDIR) > .client.out ); \
+    touch .client.run \
+  else \
+    rm -f .client.run; \
+    true; \
+  fi
+
 run_for_side_effects := \
   $(shell $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) $(TOPSRCDIR)/.mozconfig.mk > $(TOPSRCDIR)/.mozconfig.out)
 
 include $(TOPSRCDIR)/.mozconfig.mk
 
 ifndef MOZ_OBJDIR
   MOZ_OBJDIR = obj-$(CONFIG_GUESS)
 endif
@@ -399,17 +410,21 @@ cleansrcdir:
 	else \
 	  echo "Removing object files from srcdir..."; \
 	  rm -fr `find . -type d \( -name .deps -print -o -name CVS \
 	          -o -exec test ! -d {}/CVS \; \) -prune \
 	          -o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
 	   build/autoconf/clean-config.sh; \
 	fi;
 
+checkout co:
+	@$(PYTHON) $(TOPSRCDIR)/build/run_client.py $(TOPSRCDIR) force
+
+
 echo-variable-%:
 	@echo $($*)
 
 # This makefile doesn't support parallel execution. It does pass
 # MOZ_MAKE_FLAGS to sub-make processes, so they will correctly execute
 # in parallel.
 .NOTPARALLEL:
 
-.PHONY: checkout real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all
+.PHONY: checkout co real_checkout depend build profiledbuild maybe_clobber_profiledbuild export libs alldep install clean realclean distclean cleansrcdir pull_all build_all clobber clobber_all pull_and_build_all everything configure preflight_all preflight postflight postflight_all