Skip to content

Commit

Permalink
Bug 741125: Update WebIDL parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
khuey committed Apr 12, 2012
1 parent 2341124 commit f86cc53
Show file tree
Hide file tree
Showing 12 changed files with 412 additions and 143 deletions.
31 changes: 29 additions & 2 deletions client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
('security/dbm', 'mozilla/security/dbm'))
NSSCKBI_DIRS = (('security/nss/lib/ckfw/builtins', 'mozilla/security/nss/lib/ckfw/builtins'),)
LIBFFI_DIRS = (('js/ctypes/libffi', 'libffi'),)
WEBIDLPARSER_DIR = 'dom/bindings/parser'
WEBIDLPARSER_REPO = 'https://hg.mozilla.org/users/khuey_mozilla.com/webidl-parser'
WEBIDLPARSER_EXCLUSIONS = ['.hgignore', '.gitignore', '.hg', 'ply']

CVSROOT_MOZILLA = ':pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot'
CVSROOT_LIBFFI = ':pserver:anoncvs@sources.redhat.com:/cvs/libffi'
Expand All @@ -15,6 +18,7 @@
import sys
import datetime
import shutil
import glob
from optparse import OptionParser
from subprocess import check_call

Expand All @@ -30,7 +34,6 @@ def do_hg_pull(dir, repository, hg):
fulldir = os.path.join(topsrcdir, dir)
# clone if the dir doesn't exist, pull if it does
if not os.path.exists(fulldir):
fulldir = os.path.join(topsrcdir, dir)
check_call_noisy([hg, 'clone', repository, fulldir])
else:
cmd = [hg, 'pull', '-u', '-R', fulldir]
Expand All @@ -40,6 +43,25 @@ def do_hg_pull(dir, repository, hg):
check_call([hg, 'parent', '-R', fulldir,
'--template=Updated to revision {node}.\n'])

def do_hg_replace(dir, repository, tag, exclusions, hg):
"""
Replace the contents of dir with the contents of repository, except for
files matching exclusions.
"""
fulldir = os.path.join(topsrcdir, dir)
if os.path.exists(fulldir):
shutil.rmtree(fulldir)

assert not os.path.exists(fulldir)
check_call_noisy([hg, 'clone', '-u', tag, repository, fulldir])

for thing in exclusions:
for excluded in glob.iglob(os.path.join(fulldir, thing)):
if os.path.isdir(excluded):
shutil.rmtree(excluded)
else:
os.remove(excluded)

def do_cvs_export(modules, tag, cvsroot, cvs):
"""Check out a CVS directory without CVS metadata, using "export"
modules is a list of directories to check out and the corresponding
Expand All @@ -60,7 +82,7 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
cwd=os.path.join(topsrcdir, parent))
print "CVS export end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")

o = OptionParser(usage="client.py [options] update_nspr tagname | update_nss tagname | update_libffi tagname")
o = OptionParser(usage="client.py [options] update_nspr tagname | update_nss tagname | update_libffi tagname | update_webidlparser tagname")
o.add_option("--skip-mozilla", dest="skip_mozilla",
action="store_true", default=False,
help="Obsolete")
Expand All @@ -69,6 +91,8 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
help="The location of the cvs binary")
o.add_option("--cvsroot", dest="cvsroot",
help="The CVSROOT (default for mozilla checkouts: %s)" % CVSROOT_MOZILLA)
o.add_option("--hg", dest="hg", default=os.environ.get('HG', 'hg'),
help="The location of the hg binary")

try:
options, args = o.parse_args()
Expand Down Expand Up @@ -104,6 +128,9 @@ def do_cvs_export(modules, tag, cvsroot, cvs):
if not options.cvsroot:
options.cvsroot = CVSROOT_LIBFFI
do_cvs_export(LIBFFI_DIRS, tag, options.cvsroot, options.cvs)
elif action in ('update_webidlparser'):
tag, = args[1:]
do_hg_replace(WEBIDLPARSER_DIR, WEBIDLPARSER_REPO, tag, WEBIDLPARSER_EXCLUSIONS, options.hg)
else:
o.print_help()
sys.exit(2)
6 changes: 3 additions & 3 deletions dom/bindings/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bindinggen_dependencies := \
$(binding_header_files): %Binding.h: $(bindinggen_dependencies) \
$(webidl_base)/%.webidl \
$(NULL)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) header \
$(srcdir)/Bindings.conf $*Binding \
Expand All @@ -84,7 +84,7 @@ $(binding_header_files): %Binding.h: $(bindinggen_dependencies) \
$(binding_cpp_files): %Binding.cpp: $(bindinggen_dependencies) \
$(webidl_base)/%.webidl \
$(NULL)
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/BindingGen.py $(ACCESSOR_OPT) cpp \
$(srcdir)/Bindings.conf $*Binding \
Expand All @@ -109,7 +109,7 @@ $(CACHE_DIR)/.done:

ParserResults.pkl: $(globalgen_dependencies) \
$(addprefix $(webidl_base)/, $(webidl_files))
$(PYTHON) $(topsrcdir)/config/pythonpath.py \
PYTHONDONTWRITEBYTECODE=1 $(PYTHON) $(topsrcdir)/config/pythonpath.py \
$(PLY_INCLUDE) -I$(srcdir)/parser \
$(srcdir)/GlobalGen.py $(ACCESSOR_OPT) $(srcdir)/Bindings.conf $(webidl_base) \
--cachedir=$(CACHE_DIR) \
Expand Down
Loading

0 comments on commit f86cc53

Please sign in to comment.