Bug 585016 - Move buildlist.py to a mozbuild action; r=mshal
authorGregory Szorc <gps@mozilla.com>
Fri, 11 Oct 2013 07:22:49 -0700
changeset 164291 05693539cfe621065d69f236252f9741eb3095b2
parent 164290 751bcb37cdb6404b8d4582aad47f96af8fcd4839
child 164292 19978aab0190f9c8bf5055fabda11f160cf2d22a
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs585016
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 585016 - Move buildlist.py to a mozbuild action; r=mshal
browser/extensions/Makefile.in
config/JarMaker.py
config/buildlist.py
config/makefiles/target_libs.mk
config/rules.mk
config/tests/unit-buildlist.py
js/src/config/makefiles/target_libs.mk
js/src/config/rules.mk
python/Makefile.in
python/mozbuild/mozbuild/action/buildlist.py
python/mozbuild/mozbuild/test/action/test_buildlist.py
webapprt/Makefile.in
--- a/browser/extensions/Makefile.in
+++ b/browser/extensions/Makefile.in
@@ -24,25 +24,22 @@ exclude_files = \
 
 libs:: $(FINAL_TARGET)/chrome/pdfjs.manifest $(FINAL_TARGET)/chrome/shumway.manifest
 	$(PYTHON) $(topsrcdir)/config/nsinstall.py \
 	  $(srcdir)/pdfjs \
           $(foreach exclude,$(exclude_files), -X $(srcdir)/pdfjs/$(exclude)) \
 	  $(srcdir)/shumway \
           $(foreach exclude,$(exclude_files), -X $(srcdir)/shumway/$(exclude)) \
           $(FINAL_TARGET)/chrome
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
-	  $(FINAL_TARGET)/chrome.manifest "manifest chrome/pdfjs.manifest"
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
-	  $(FINAL_TARGET)/chrome.manifest "manifest chrome/shumway.manifest"
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest chrome/pdfjs.manifest")
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest chrome/shumway.manifest")
 
 ifdef MOZ_METRO
 $(DIST)/bin/metro/chrome/pdfjs.manifest: $(GLOBAL_DEPS)
 	printf "manifest pdfjs/chrome.manifest" > $@
 
 libs:: $(DIST)/bin/metro/chrome/pdfjs.manifest
 	$(PYTHON) $(topsrcdir)/config/nsinstall.py \
 	  $(srcdir)/pdfjs \
           $(foreach exclude,$(exclude_files), -X $(srcdir)/pdfjs/$(exclude)) \
           $(DIST)/bin/metro/chrome
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py \
-	  $(DIST)/bin/metro/chrome.manifest "manifest chrome/pdfjs.manifest"
+	$(call py_action,buildlist,$(DIST)/bin/metro/chrome.manifest "manifest chrome/pdfjs.manifest")
 endif
--- a/config/JarMaker.py
+++ b/config/JarMaker.py
@@ -9,24 +9,22 @@ See the documentation for jar.mn on MDC 
 '''
 import sys
 import os
 import os.path
 import errno
 import re
 import logging
 from time import localtime
-from optparse import OptionParser
 from MozZipFile import ZipFile
 from cStringIO import StringIO
-from datetime import datetime
 
 from utils import pushback_iter, lockFile
 from Preprocessor import Preprocessor
-from buildlist import addEntriesToListFile
+from mozbuild.action.buildlist import addEntriesToListFile
 if sys.platform == "win32":
   from ctypes import windll, WinError
   CreateHardLink = windll.kernel32.CreateHardLinkA
 
 __all__ = ['JarMaker']
 
 class ZipEntry:
   '''Helper class for jar output.
--- a/config/makefiles/target_libs.mk
+++ b/config/makefiles/target_libs.mk
@@ -20,18 +20,18 @@ endif # EXPORT_LIBRARY
 
 binaries libs:: $(SUBMAKEFILES) $(TARGETS)
 ifndef NO_DIST_INSTALL
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest")
+	$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)")
 endif
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
 endif # !NO_DIST_INSTALL
 
 ifndef NO_DIST_INSTALL
 
 ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -1309,18 +1309,18 @@ ifdef XPT_NAME #{
 
 ifndef NO_DIST_INSTALL
 _XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
 _XPT_NAME_DEST := $(FINAL_TARGET)/components
 INSTALL_TARGETS += _XPT_NAME
 
 ifndef NO_INTERFACES_MANIFEST
 libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)"
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
+	$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)")
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest")
 endif
 endif
 
 endif #} XPT_NAME
 
 ################################################################################
 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
 ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
@@ -1346,17 +1346,17 @@ ifndef NO_DIST_INSTALL
 EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
 PP_TARGETS += EXTRA_PP_COMPONENTS
 endif
 endif
 
 EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
 ifneq (,$(EXTRA_MANIFESTS))
 libs:: $(call mkdir_deps,$(FINAL_TARGET))
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS)))
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS))))
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to
 # $(FINAL_TARGET)/$(JS_MODULES_PATH). JS_MODULES_PATH defaults to "modules"
 # if it is undefined.
 JS_MODULES_PATH ?= modules
 FINAL_JS_MODULES_PATH := $(FINAL_TARGET)/$(JS_MODULES_PATH)
--- a/js/src/config/makefiles/target_libs.mk
+++ b/js/src/config/makefiles/target_libs.mk
@@ -20,18 +20,18 @@ endif # EXPORT_LIBRARY
 
 binaries libs:: $(SUBMAKEFILES) $(TARGETS)
 ifndef NO_DIST_INSTALL
 ifdef SHARED_LIBRARY
 ifdef IS_COMPONENT
 	$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
 	$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
 ifndef NO_COMPONENTS_MANIFEST
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest"
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)"
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest")
+	$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)")
 endif
 endif # IS_COMPONENT
 endif # SHARED_LIBRARY
 endif # !NO_DIST_INSTALL
 
 ifndef NO_DIST_INSTALL
 
 ifneq (,$(strip $(PROGRAM)$(SIMPLE_PROGRAMS)))
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -1309,18 +1309,18 @@ ifdef XPT_NAME #{
 
 ifndef NO_DIST_INSTALL
 _XPT_NAME_FILES := $(DEPTH)/config/makefiles/xpidl/xpt/$(XPT_NAME)
 _XPT_NAME_DEST := $(FINAL_TARGET)/components
 INSTALL_TARGETS += _XPT_NAME
 
 ifndef NO_INTERFACES_MANIFEST
 libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)"
-	@$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest"
+	$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)")
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest")
 endif
 endif
 
 endif #} XPT_NAME
 
 ################################################################################
 # Copy each element of EXTRA_COMPONENTS to $(FINAL_TARGET)/components
 ifneq (,$(filter %.js,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS)))
@@ -1346,17 +1346,17 @@ ifndef NO_DIST_INSTALL
 EXTRA_PP_COMPONENTS_PATH := $(FINAL_TARGET)/components
 PP_TARGETS += EXTRA_PP_COMPONENTS
 endif
 endif
 
 EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
 ifneq (,$(EXTRA_MANIFESTS))
 libs:: $(call mkdir_deps,$(FINAL_TARGET))
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS)))
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS))))
 endif
 
 ################################################################################
 # Copy each element of EXTRA_JS_MODULES to
 # $(FINAL_TARGET)/$(JS_MODULES_PATH). JS_MODULES_PATH defaults to "modules"
 # if it is undefined.
 JS_MODULES_PATH ?= modules
 FINAL_JS_MODULES_PATH := $(FINAL_TARGET)/$(JS_MODULES_PATH)
--- a/python/Makefile.in
+++ b/python/Makefile.in
@@ -1,14 +1,15 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 test_dirs := \
   mozbuild/mozbuild/test \
+  mozbuild/mozbuild/test/action \
   mozbuild/mozbuild/test/backend \
   mozbuild/mozbuild/test/controller \
   mozbuild/mozbuild/test/compilation \
   mozbuild/mozbuild/test/frontend \
   mozbuild/mozpack/test \
   mozbuild/dumbmake/test \
   $(NULL)
 
rename from config/buildlist.py
rename to python/mozbuild/mozbuild/action/buildlist.py
--- a/config/buildlist.py
+++ b/python/mozbuild/mozbuild/action/buildlist.py
@@ -1,42 +1,48 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-'''A generic script to add entries to a file 
-if the entry does not already exist.
-
-Usage: buildlist.py <filename> <entry> [<entry> ...]
-'''
-from __future__ import print_function
-
-import sys
-import os
-from utils import lockFile
-
-def addEntriesToListFile(listFile, entries):
-  """Given a file |listFile| containing one entry per line,
-  add each entry in |entries| to the file, unless it is already
-  present."""
-  lock = lockFile(listFile + ".lck")
-  try:
-    if os.path.exists(listFile):
-      f = open(listFile)
-      existing = set(x.strip() for x in f.readlines())
-      f.close()
-    else:
-      existing = set()
-    f = open(listFile, 'a')
-    for e in entries:
-      if e not in existing:
-        f.write("{0}\n".format(e))
-        existing.add(e)
-    f.close()
-  finally:
-    lock = None
-
-if __name__ == '__main__':
-  if len(sys.argv) < 3:
-    print("Usage: buildlist.py <list file> <entry> [<entry> ...]",
-          file=sys.stderr)
-    sys.exit(1)
-  addEntriesToListFile(sys.argv[1], sys.argv[2:])
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+'''A generic script to add entries to a file
+if the entry does not already exist.
+
+Usage: buildlist.py <filename> <entry> [<entry> ...]
+'''
+from __future__ import print_function
+
+import sys
+import os
+from utils import lockFile
+
+def addEntriesToListFile(listFile, entries):
+  """Given a file |listFile| containing one entry per line,
+  add each entry in |entries| to the file, unless it is already
+  present."""
+  lock = lockFile(listFile + ".lck")
+  try:
+    if os.path.exists(listFile):
+      f = open(listFile)
+      existing = set(x.strip() for x in f.readlines())
+      f.close()
+    else:
+      existing = set()
+    f = open(listFile, 'a')
+    for e in entries:
+      if e not in existing:
+        f.write("{0}\n".format(e))
+        existing.add(e)
+    f.close()
+  finally:
+    lock = None
+
+
+def main(args):
+    if len(args) < 2:
+        print("Usage: buildlist.py <list file> <entry> [<entry> ...]",
+            file=sys.stderr)
+        return 1
+
+    return addEntriesToListFile(args[0], args[1:])
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv[1:]))
rename from config/tests/unit-buildlist.py
rename to python/mozbuild/mozbuild/test/action/test_buildlist.py
--- a/config/tests/unit-buildlist.py
+++ b/python/mozbuild/mozbuild/test/action/test_buildlist.py
@@ -1,16 +1,21 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
 import unittest
 
 import os, sys, os.path, time
 from tempfile import mkdtemp
 from shutil import rmtree
 import mozunit
 
-from buildlist import addEntriesToListFile
+from mozbuild.action.buildlist import addEntriesToListFile
+
 
 class TestBuildList(unittest.TestCase):
   """
   Unit tests for buildlist.py
   """
   def setUp(self):
     self.tmpdir = mkdtemp()
 
--- a/webapprt/Makefile.in
+++ b/webapprt/Makefile.in
@@ -17,17 +17,17 @@ ifdef MOZ_DEBUG
 DEFINES += -DMOZ_DEBUG=1
 endif
 
 ifdef MOZILLA_OFFICIAL
 DEFINES += -DMOZILLA_OFFICIAL
 endif
 
 libs:: $(call mkdir_deps,$(FINAL_TARGET))
-	$(PYTHON) $(MOZILLA_DIR)/config/buildlist.py $(FINAL_TARGET)/chrome.manifest "resource webapprt ./"
+	$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "resource webapprt ./")
 
 GRE_MILESTONE := $(shell tail -n 1 $(topsrcdir)/config/milestone.txt 2>/dev/null || tail -1 $(topsrcdir)/config/milestone.txt)
 GRE_BUILDID := $(shell cat $(DEPTH)/config/buildid)
 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) \
            -DGRE_BUILDID=$(GRE_BUILDID) \
            -DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME) \
            $(NULL)