author Wan-Teh Chang <>
Sun, 22 Mar 2009 09:44:55 -0700
changeset 26462 9560711165646da2bff775379e30997efbf7e1fd
parent 21611 f3d9ccfea0a3425a23d5217cb3cd7a6673cc8f83
child 32998 eb97628a701b7c0673c9a7aa6ad83d8c0abe90cb
permissions -rw-r--r--
Upgrade NSPR to NSPR_HEAD_20090321. This CVS tag includes the following changes: - Bug 439144: fixed strict aliasing issues in prdtoa.c - Bug 449665: suppress the parentheses warnings in prdtoa.c - Bug 442706: build for Symbian OS with autoconf and GNU make - Bug 432430: some more changes for the Symbian OS port - Bug 476536: added PR_ASSERT_CURRENT_THREAD_OWNS_LOCK and PR_ASSERT_CURRENT_THREAD_IN_MONITOR. - Bug 478687: made PRUint64/uint64 compatible with uint64_t for 64-bit Mac OS X - Bug 480730: PR_LoadLibrary for 64-bit MAC OS X should not search DYLD_LIBRARY_PATH if the library is specified as a pathname - Bug 480740: PR_ParseTimeString crash with dates >= year 3001 when compiled with Visual C++ 2005. - Bug 480074: better dependency resolution for import libraries - Bug 469083: ported NSPR test programs to WINCE - Bug 433790: removed some obsolete WIN16 code


NSPR_DIRS = ('nsprpub',)
NSS_DIRS  = ('dbm',

import os
import sys
import datetime
import shutil
from optparse import OptionParser
from build.util import check_call

topsrcdir = os.path.dirname(__file__)
if topsrcdir == '':
    topsrcdir = '.'

def check_call_noisy(cmd, *args, **kwargs):
    print "Executing command:", cmd
    check_call(cmd, *args, **kwargs)

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])
        cmd = [hg, 'pull', '-u', '-R', fulldir]
        if repository is not None:
    check_call([hg, 'parent', '-R', fulldir,
                '--template=Updated to revision {node}.\n'])

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, e.g. ['nsprpub']
    for module in modules:
        fullpath = os.path.join(topsrcdir, module)
        if os.path.exists(fullpath):
            print "Removing '%s'" % fullpath

        (parent, leaf) = os.path.split(module)
        print "CVS export begin: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")
        check_call_noisy([cvs, '-d', cvsroot,
                          'export', '-r', tag, '-d', leaf,
                          'mozilla/%s' % module],
                         cwd=os.path.join(topsrcdir, parent))
        print "CVS export end: " + datetime.datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S UTC")

o = OptionParser(usage=" [options] update_nspr tagname | update_nss tagname")
o.add_option("--skip-mozilla", dest="skip_mozilla",
             action="store_true", default=False,

o.add_option("--cvs", dest="cvs", default=os.environ.get('CVS', 'cvs'),
             help="The location of the cvs binary")
o.add_option("--cvsroot", dest="cvsroot",
             default=os.environ.get('CVSROOT', ''),
             help="The CVSROOT (default:")

    options, args = o.parse_args()
    action = args[0]
except IndexError:

if action in ('checkout', 'co'):
    print >>sys.stderr, "Warning: checkout is obsolete."
elif action in ('update_nspr'):
    tag, = args[1:]
    do_cvs_export(NSPR_DIRS, tag, options.cvsroot, options.cvs)
elif action in ('update_nss'):
    tag, = args[1:]
    do_cvs_export(NSS_DIRS, tag, options.cvsroot, options.cvs)