media/libvpx/update.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/update.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,534 @@
     1.4 +#!/usr/bin/env python
     1.5 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 +import argparse
     1.9 +import os
    1.10 +import re
    1.11 +import shutil
    1.12 +import sys
    1.13 +import subprocess
    1.14 +from pprint import pprint
    1.15 +from StringIO import StringIO
    1.16 +
    1.17 +PLATFORMS= [
    1.18 +  'x86-win32-vs8',
    1.19 +  'x86_64-win64-vs8',
    1.20 +  'x86-linux-gcc',
    1.21 +  'x86_64-linux-gcc',
    1.22 +  'generic-gnu',
    1.23 +  'x86-darwin9-gcc',
    1.24 +  'x86_64-darwin9-gcc',
    1.25 +  'armv7-android-gcc',
    1.26 +  'x86-win32-gcc',
    1.27 +  'x86_64-win64-gcc',
    1.28 +]
    1.29 +
    1.30 +
    1.31 +mk_files = [
    1.32 +    'vp8/vp8_common.mk',
    1.33 +    'vp8/vp8cx_arm.mk',
    1.34 +    'vp8/vp8cx.mk',
    1.35 +    'vp8/vp8dx.mk',
    1.36 +    'vp9/vp9_common.mk',
    1.37 +    'vp9/vp9cx.mk',
    1.38 +    'vp9/vp9dx.mk',
    1.39 +    'vpx_mem/vpx_mem.mk',
    1.40 +    'vpx_ports/vpx_ports.mk',
    1.41 +    'vpx_scale/vpx_scale.mk',
    1.42 +    'vpx/vpx_codec.mk',
    1.43 +]
    1.44 +
    1.45 +extensions = ['.asm', '.c', '.h']
    1.46 +
    1.47 +MODULES = {
    1.48 +    'UNIFIED_SOURCES': [
    1.49 +        'API_DOC_SRCS-$(CONFIG_VP8_DECODER)',
    1.50 +        'API_DOC_SRCS-yes',
    1.51 +        'API_EXPORTS',
    1.52 +        'API_SRCS-$(CONFIG_VP8_DECODER)',
    1.53 +        'API_SRCS-yes',
    1.54 +        'MEM_SRCS-yes',
    1.55 +        'PORTS_SRCS-yes',
    1.56 +        'SCALE_SRCS-$(CONFIG_SPATIAL_RESAMPLING)',
    1.57 +        'SCALE_SRCS-no',
    1.58 +        'SCALE_SRCS-yes',
    1.59 +        'VP8_COMMON_SRCS-yes',
    1.60 +        'VP8_DX_EXPORTS',
    1.61 +        'VP8_DX_SRCS-$(CONFIG_MULTITHREAD)',
    1.62 +        'VP8_DX_SRCS-no',
    1.63 +        'VP8_DX_SRCS_REMOVE-no',
    1.64 +        'VP8_DX_SRCS_REMOVE-yes',
    1.65 +        'VP8_DX_SRCS-yes',
    1.66 +        'VP9_COMMON_SRCS-yes',
    1.67 +        'VP9_DX_EXPORTS',
    1.68 +        'VP9_DX_SRCS-no',
    1.69 +        'VP9_DX_SRCS_REMOVE-no',
    1.70 +        'VP9_DX_SRCS_REMOVE-yes',
    1.71 +        'VP9_DX_SRCS-yes',
    1.72 +        'API_DOC_SRCS-$(CONFIG_VP8_ENCODER)',
    1.73 +        'API_SRCS-$(BUILD_LIBVPX)',
    1.74 +        'API_SRCS-$(CONFIG_VP8_ENCODER)',
    1.75 +        'API_SRCS-$(CONFIG_VP9_ENCODER)',
    1.76 +        'VP8_CX_EXPORTS',
    1.77 +        'VP8_CX_SRCS-$(CONFIG_MULTI_RES_ENCODING)',
    1.78 +        'VP8_CX_SRCS-$(CONFIG_MULTITHREAD)',
    1.79 +        'VP8_CX_SRCS-$(CONFIG_TEMPORAL_DENOISING)',
    1.80 +        'VP8_CX_SRCS-no',
    1.81 +        'VP8_CX_SRCS_REMOVE-no',
    1.82 +        'VP8_CX_SRCS_REMOVE-yes',
    1.83 +        'VP8_CX_SRCS-yes',
    1.84 +        'VP9_CX_EXPORTS',
    1.85 +        'VP9_CX_SRCS-no',
    1.86 +        'VP9_CX_SRCS_REMOVE-no',
    1.87 +        'VP9_CX_SRCS_REMOVE-yes',
    1.88 +        'VP9_CX_SRCS-yes',
    1.89 +    ],
    1.90 +    'X86_ASM': [
    1.91 +        'PORTS_SRCS-$(BUILD_LIBVPX)',
    1.92 +        'VP8_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
    1.93 +        'VP8_COMMON_SRCS-$(HAVE_MMX)',
    1.94 +        'VP8_COMMON_SRCS-$(HAVE_SSE2)',
    1.95 +        'VP8_COMMON_SRCS-$(HAVE_SSE3)',
    1.96 +        'VP8_COMMON_SRCS-$(HAVE_SSE4_1)',
    1.97 +        'VP8_COMMON_SRCS-$(HAVE_SSSE3)',
    1.98 +        'VP9_COMMON_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
    1.99 +        'VP9_COMMON_SRCS-$(HAVE_MMX)',
   1.100 +        'VP9_COMMON_SRCS-$(HAVE_SSE2)',
   1.101 +        'VP9_COMMON_SRCS-$(HAVE_SSSE3)',
   1.102 +        'VP8_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
   1.103 +        'VP8_CX_SRCS-$(HAVE_MMX)',
   1.104 +        'VP8_CX_SRCS-$(HAVE_SSE2)',
   1.105 +        'VP8_CX_SRCS-$(HAVE_SSE4_1)',
   1.106 +        'VP8_CX_SRCS-$(HAVE_SSSE3)',
   1.107 +        'VP8_CX_SRCS_REMOVE-$(HAVE_SSE2)',
   1.108 +        'VP9_CX_SRCS-$(ARCH_X86)$(ARCH_X86_64)',
   1.109 +        'VP9_CX_SRCS-$(HAVE_MMX)',
   1.110 +        'VP9_CX_SRCS-$(HAVE_SSE2)',
   1.111 +        'VP9_CX_SRCS-$(HAVE_SSE3)',
   1.112 +        'VP9_CX_SRCS-$(HAVE_SSE4_1)',
   1.113 +        'VP9_CX_SRCS-$(HAVE_SSSE3)',
   1.114 +    ],
   1.115 +    'X86-64_ASM': [
   1.116 +        'VP8_CX_SRCS-$(ARCH_X86_64)',
   1.117 +        'VP9_CX_SRCS-$(ARCH_X86_64)',
   1.118 +    ],
   1.119 +    'ARM_ASM': [
   1.120 +        'PORTS_SRCS-$(ARCH_ARM)',
   1.121 +        'SCALE_SRCS-$(HAVE_NEON)',
   1.122 +        'VP8_COMMON_SRCS-$(ARCH_ARM)',
   1.123 +        'VP8_COMMON_SRCS-$(HAVE_MEDIA)',
   1.124 +        'VP8_COMMON_SRCS-$(HAVE_NEON)',
   1.125 +        'VP9_COMMON_SRCS-$(HAVE_NEON)',
   1.126 +        'VP8_CX_SRCS-$(ARCH_ARM)',
   1.127 +        'VP8_CX_SRCS-$(HAVE_EDSP)',
   1.128 +        'VP8_CX_SRCS-$(HAVE_MEDIA)',
   1.129 +        'VP8_CX_SRCS-$(HAVE_NEON)',
   1.130 +    ],
   1.131 +    'ERROR_CONCEALMENT': [
   1.132 +        'VP8_DX_SRCS-$(CONFIG_ERROR_CONCEALMENT)',
   1.133 +    ],
   1.134 +    'AVX2': [
   1.135 +        'VP9_COMMON_SRCS-$(HAVE_AVX2)',
   1.136 +    ],
   1.137 +    'VP8_POSTPROC': [
   1.138 +        'VP8_COMMON_SRCS-$(CONFIG_POSTPROC)',
   1.139 +    ],
   1.140 +    'VP9_POSTPROC': [
   1.141 +        'VP9_COMMON_SRCS-$(CONFIG_VP9_POSTPROC)',
   1.142 +    ]
   1.143 +}
   1.144 +
   1.145 +DISABLED_MODULES = [
   1.146 +    'MEM_SRCS-$(CONFIG_MEM_MANAGER)',
   1.147 +    'MEM_SRCS-$(CONFIG_MEM_TRACKER)',
   1.148 +    'VP8_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER)',
   1.149 +    'VP9_COMMON_SRCS-$(CONFIG_POSTPROC_VISUALIZER)',
   1.150 +    'VP8_CX_SRCS-$(CONFIG_INTERNAL_STATS)',
   1.151 +    'VP9_CX_SRCS-$(CONFIG_INTERNAL_STATS)',
   1.152 +
   1.153 +    # mips files are also ignored via ignored_folders
   1.154 +    'SCALE_SRCS-$(HAVE_DSPR2)',
   1.155 +    'VP8_COMMON_SRCS-$(HAVE_DSPR2)',
   1.156 +    'VP9_COMMON_SRCS-$(HAVE_DSPR2)',
   1.157 +    'VP8_CX_SRCS_REMOVE-$(HAVE_EDSP)',
   1.158 +]
   1.159 +
   1.160 +libvpx_files = [
   1.161 +    'build/make/obj_int_extract.c',
   1.162 +    'build/make/ads2gas.pl',
   1.163 +    'build/make/thumb.pm',
   1.164 +    'LICENSE',
   1.165 +    'PATENTS',
   1.166 +]
   1.167 +
   1.168 +ignore_files = [
   1.169 +    'vp8/common/context.c',
   1.170 +    'vp8/common/textblit.c',
   1.171 +    'vp8/encoder/ssim.c',
   1.172 +    'vp8/encoder/x86/ssim_opt.asm',
   1.173 +    'vp9/common/vp9_textblit.c',
   1.174 +    'vp9/common/vp9_textblit.h',
   1.175 +    'vp9/encoder/vp9_ssim.c',
   1.176 +    'vp9/encoder/x86/vp9_ssim_opt.asm',
   1.177 +    'vpx_mem/vpx_mem_tracker.c',
   1.178 +    'vpx_scale/generic/bicubic_scaler.c',
   1.179 +    'vpx_scale/win32/scaleopt.c',
   1.180 +    'vpx_scale/win32/scalesystemdependent.c',
   1.181 +]
   1.182 +
   1.183 +ignore_folders = [
   1.184 +    'examples/',
   1.185 +    'googletest/',
   1.186 +    'libmkv/',
   1.187 +    'libyuv/',
   1.188 +    'mips/',
   1.189 +    'nestegg/',
   1.190 +    'objdir/',
   1.191 +    'ppc/',
   1.192 +    'test/',
   1.193 +    'vpx_mem/memory_manager/',
   1.194 +]
   1.195 +files = {
   1.196 +    'EXPORTS': [
   1.197 +        'vpx_mem/include/vpx_mem_intrnl.h',
   1.198 +        'vpx_mem/vpx_mem.h',
   1.199 +        'vpx_ports/arm.h',
   1.200 +        'vpx_ports/mem.h',
   1.201 +        'vpx_ports/vpx_timer.h',
   1.202 +        'vpx_ports/x86.h',
   1.203 +        'vpx_scale/vpx_scale.h',
   1.204 +        'vpx_scale/yv12config.h',
   1.205 +        'vpx/vp8cx.h',
   1.206 +        'vpx/vp8dx.h',
   1.207 +        'vpx/vp8.h',
   1.208 +        'vpx/vpx_codec.h',
   1.209 +        'vpx/vpx_decoder.h',
   1.210 +        'vpx/vpx_encoder.h',
   1.211 +        'vpx/vpx_image.h',
   1.212 +        'vpx/vpx_integer.h',
   1.213 +    ],
   1.214 +    'X86-64_ASM': [
   1.215 +        'third_party/x86inc/x86inc.asm',
   1.216 +        'vp8/common/x86/loopfilter_block_sse2.asm',
   1.217 +        'vp9/encoder/x86/vp9_quantize_ssse3.asm',
   1.218 +    ],
   1.219 +    'SOURCES': [
   1.220 +        'vp8/common/rtcd.c',
   1.221 +        'vp8/common/sad_c.c',
   1.222 +        'vp8/vp8_dx_iface.c',
   1.223 +        'vp9/common/vp9_entropymv.c',
   1.224 +        'vp9/common/vp9_rtcd.c',
   1.225 +        'vp9/encoder/vp9_bitstream.c',
   1.226 +        'vpx/src/svc_encodeframe.c',
   1.227 +        'vpx_mem/vpx_mem.c',
   1.228 +    ]
   1.229 +}
   1.230 +
   1.231 +manual = [
   1.232 +    # special case in moz.build
   1.233 +    'vp8/encoder/boolhuff.c',
   1.234 +
   1.235 +    # 64bit only
   1.236 +    'vp8/common/x86/loopfilter_block_sse2.asm',
   1.237 +    'vp9/encoder/x86/vp9_quantize_ssse3.asm',
   1.238 +
   1.239 +    # offsets are special cased in Makefile.in
   1.240 +    'vp8/encoder/vp8_asm_enc_offsets.c',
   1.241 +    'vpx_scale/vpx_scale_asm_offsets.c',
   1.242 +
   1.243 +    # ignore while vp9 postproc is not enabled
   1.244 +    'vp9/common/x86/vp9_postproc_mmx.asm',
   1.245 +    'vp9/common/x86/vp9_postproc_sse2.asm',
   1.246 +
   1.247 +    # ssim_opt is not enabled
   1.248 +    'vp8/encoder/x86/ssim_opt.asm',
   1.249 +    'vp9/encoder/x86/vp9_ssim_opt.asm',
   1.250 +
   1.251 +    # asm includes
   1.252 +    'vpx_ports/x86_abi_support.asm',
   1.253 +]
   1.254 +
   1.255 +platform_files = [
   1.256 +    'vp8_rtcd.h',
   1.257 +    'vp9_rtcd.h',
   1.258 +    'vpx_config.asm',
   1.259 +    'vpx_config.h',
   1.260 +    'vpx_scale_rtcd.h',
   1.261 +]
   1.262 +
   1.263 +def prepare_upstream(prefix, commit=None):
   1.264 +    if os.path.exists(prefix):
   1.265 +        print "Please remove '%s' folder before running %s" % (prefix, sys.argv[0])
   1.266 +        sys.exit(1)
   1.267 +
   1.268 +    upstream_url = 'https://gerrit.chromium.org/gerrit/webm/libvpx'
   1.269 +    subprocess.call(['git', 'clone', upstream_url, prefix])
   1.270 +    if commit:
   1.271 +        os.chdir(prefix)
   1.272 +        subprocess.call(['git', 'checkout', commit])
   1.273 +    else:
   1.274 +        os.chdir(prefix)
   1.275 +        p = subprocess.Popen(['git', 'rev-parse', 'HEAD'], stdout=subprocess.PIPE)
   1.276 +        stdout, stderr = p.communicate()
   1.277 +        commit = stdout.strip()
   1.278 +
   1.279 +    for target in PLATFORMS:
   1.280 +        target_objdir = os.path.join(prefix, 'objdir', target)
   1.281 +        os.makedirs(target_objdir)
   1.282 +        os.chdir(target_objdir)
   1.283 +        configure = ['../../configure', '--target=%s' % target,
   1.284 +            '--disable-examples', '--disable-install-docs',
   1.285 +            '--enable-multi-res-encoding',
   1.286 +        ]
   1.287 +
   1.288 +        if 'darwin9' in target:
   1.289 +            configure += ['--enable-pic']
   1.290 +        if 'linux' in target:
   1.291 +            configure += ['--enable-pic']
   1.292 +        # x86inc.asm is not compatible with pic 32bit builds
   1.293 +        if target == 'x86-linux-gcc':
   1.294 +            configure += ['--disable-use-x86inc']
   1.295 +
   1.296 +        if target == 'armv7-android-gcc':
   1.297 +            configure += ['--sdk-path=%s' % ndk_path]
   1.298 +
   1.299 +        subprocess.call(configure)
   1.300 +        make_targets = [f for f in platform_files if not os.path.exists(f)]
   1.301 +        if make_targets:
   1.302 +            subprocess.call(['make'] + make_targets)
   1.303 +        for f in make_targets:
   1.304 +            if not os.path.exists(f):
   1.305 +                print "%s missing from %s, check toolchain" % (f, target)
   1.306 +                sys.exit(1)
   1.307 +
   1.308 +    os.chdir(base)
   1.309 +    return commit
   1.310 +
   1.311 +def cleanup_upstream():
   1.312 +    shutil.rmtree(os.path.join(base, 'upstream'))
   1.313 +
   1.314 +def get_module(key):
   1.315 +    for module in MODULES:
   1.316 +        if key in MODULES[module]:
   1.317 +            return module
   1.318 +
   1.319 +def get_libvpx_files(prefix):
   1.320 +    for root, folders, files in os.walk(prefix):
   1.321 +        for f in files:
   1.322 +            f = os.path.join(root, f)[len(prefix):]
   1.323 +            if os.path.splitext(f)[-1] in extensions \
   1.324 +              and os.sep in f \
   1.325 +              and f not in ignore_files \
   1.326 +              and not any(folder in f for folder in ignore_folders):
   1.327 +                libvpx_files.append(f)
   1.328 +    return libvpx_files
   1.329 +
   1.330 +def get_sources(prefix):
   1.331 +    source = {}
   1.332 +    unknown = {}
   1.333 +    disabled = {}
   1.334 +
   1.335 +    for mk in mk_files:
   1.336 +        with open(os.path.join(prefix, mk)) as f:
   1.337 +            base = os.path.dirname(mk)
   1.338 +            for l in f:
   1.339 +                if '+=' in l:
   1.340 +                    l = l.split('+=')
   1.341 +                    key = l[0].strip()
   1.342 +                    value = l[1].strip().replace('$(ASM)', '.asm')
   1.343 +                    value = os.path.join(base, value)
   1.344 +                    if not key.startswith('#') and os.path.splitext(value)[-1] in extensions:
   1.345 +                        if key not in source:
   1.346 +                            source[key] = []
   1.347 +                        source[key].append(value)
   1.348 +
   1.349 +    for key in source:
   1.350 +        for f in source[key]:
   1.351 +            if key.endswith('EXPORTS') and f.endswith('.h'):
   1.352 +                files['EXPORTS'].append(f)
   1.353 +            if os.path.splitext(f)[-1] in ('.c', '.asm') and not f in manual:
   1.354 +                module = get_module(key)
   1.355 +                if module:
   1.356 +                    if not module in files:
   1.357 +                        files[module] = []
   1.358 +                    t = files[module]
   1.359 +                elif key in DISABLED_MODULES:
   1.360 +                    if not key in disabled:
   1.361 +                        disabled[key] = []
   1.362 +                    t = disabled[key]
   1.363 +                else:
   1.364 +                    if not key in unknown:
   1.365 +                        unknown[key] = []
   1.366 +                    t = unknown[key]
   1.367 +                t.append(f)
   1.368 +
   1.369 +    files['UNIFIED_SOURCES'] = [f for f in files['UNIFIED_SOURCES'] if f not in files['SOURCES']]
   1.370 +
   1.371 +    for key in files:
   1.372 +        files[key] = list(sorted(set(files[key])))
   1.373 +
   1.374 +    return source, files, disabled, unknown
   1.375 +
   1.376 +def update_sources_mozbuild(files, sources_mozbuild):
   1.377 +    f = StringIO()
   1.378 +    pprint(files, stream=f)
   1.379 +    sources_mozbuild_new = "files = {\n %s\n}\n" % f.getvalue().strip()[1:-1]
   1.380 +    if sources_mozbuild != sources_mozbuild_new:
   1.381 +        print 'updating sources.mozbuild'
   1.382 +        with open('sources.mozbuild', 'w') as f:
   1.383 +            f.write(sources_mozbuild_new)
   1.384 +
   1.385 +def get_current_files():
   1.386 +    current_files = []
   1.387 +    for root, folders, files in os.walk('.'):
   1.388 +        for f in files:
   1.389 +            f = os.path.join(root, f)[len('.%s'%os.sep):]
   1.390 +            if 'upstream%s'%os.sep in f or not os.sep in f:
   1.391 +                continue
   1.392 +            if os.path.splitext(f)[-1] in extensions:
   1.393 +                current_files.append(f)
   1.394 +    return current_files
   1.395 +
   1.396 +def is_new(a, b):
   1.397 +    return not os.path.exists(a) \
   1.398 +        or not os.path.exists(b) \
   1.399 +        or open(a).read() != open(b).read()
   1.400 +
   1.401 +def get_sources_mozbuild():
   1.402 +    with open('sources.mozbuild') as f:
   1.403 +        sources_mozbuild = f.read()
   1.404 +    exec(sources_mozbuild)
   1.405 +    return sources_mozbuild, files
   1.406 +
   1.407 +def update_and_remove_files(prefix, libvpx_files, files):
   1.408 +    current_files = get_current_files()
   1.409 +
   1.410 +    def copy(src, dst):
   1.411 +        print '    ', dst
   1.412 +        shutil.copy(src, dst)
   1.413 +
   1.414 +    # Update files
   1.415 +    first = True
   1.416 +    for f in libvpx_files:
   1.417 +        fdir = os.path.dirname(f)
   1.418 +        if fdir and not os.path.exists(fdir):
   1.419 +            os.makedirs(fdir)
   1.420 +        s = os.path.join(prefix, f)
   1.421 +        if is_new(f, s):
   1.422 +            if first:
   1.423 +                print "Copy files:"
   1.424 +                first = False
   1.425 +            copy(s, f)
   1.426 +
   1.427 +    # Copy configuration files for each platform
   1.428 +    for target in PLATFORMS:
   1.429 +        first = True
   1.430 +        for f in platform_files:
   1.431 +            t = os.path.splitext(f)
   1.432 +            t = '%s_%s%s' % (t[0], target, t[1])
   1.433 +            f = os.path.join(prefix, 'objdir', target, f)
   1.434 +            if is_new(f, t):
   1.435 +                if first:
   1.436 +                    print "Copy files for %s:" % target
   1.437 +                    first = False
   1.438 +                copy(f, t)
   1.439 +
   1.440 +    # Copy vpx_version.h from one of the build targets
   1.441 +    s = os.path.join(prefix, 'objdir/x86-linux-gcc/vpx_version.h')
   1.442 +    f = 'vpx_version.h'
   1.443 +    if is_new(s, f):
   1.444 +        copy(s, f)
   1.445 +
   1.446 +    # Remove unknown files from tree
   1.447 +    removed_files = [f for f in current_files if f not in libvpx_files]
   1.448 +    if removed_files:
   1.449 +        print "Remove files:"
   1.450 +        for f in removed_files:
   1.451 +            os.unlink(f)
   1.452 +            print '    ', f
   1.453 +
   1.454 +def apply_patches():
   1.455 +    # Patch to permit vpx users to specify their own <stdint.h> types.
   1.456 +    os.system("patch -p3 < stdint.patch")
   1.457 +    os.system("patch -p3 < unified.patch")
   1.458 +    os.system("patch -p3 < mingw.patch")
   1.459 +
   1.460 +def update_readme(commit):
   1.461 +    with open('README_MOZILLA') as f:
   1.462 +        readme = f.read()
   1.463 +
   1.464 +    if 'The git commit ID used was' in readme:
   1.465 +        new_readme = re.sub('The git commit ID used was [a-f0-9]+',
   1.466 +            'The git commit ID used was %s' % commit, readme)
   1.467 +    else:
   1.468 +        new_readme = "%s\n\nThe git commit ID used was %s\n" % (readme, commit)
   1.469 +
   1.470 +    if readme != new_readme:
   1.471 +        with open('README_MOZILLA', 'w') as f:
   1.472 +            f.write(new_readme)
   1.473 +
   1.474 +def print_info(source, files, disabled, unknown, moz_build_files):
   1.475 +    for key in moz_build_files:
   1.476 +        if key not in files:
   1.477 +            print key, 'MISSING'
   1.478 +        else:
   1.479 +            gone = set(moz_build_files[key]) - set(files[key])
   1.480 +            new = set(files[key]) - set(moz_build_files[key])
   1.481 +            if gone:
   1.482 +                print key, 'GONE:'
   1.483 +                print '    '+ '\n    '.join(gone)
   1.484 +            if new:
   1.485 +                print key, 'NEW:'
   1.486 +                print '    '+ '\n    '.join(new)
   1.487 +
   1.488 +    if unknown:
   1.489 +        print "Please update this script, the following modules are unknown"
   1.490 +        pprint(unknown)
   1.491 +
   1.492 +    if DEBUG:
   1.493 +        print "===== SOURCE"
   1.494 +        pprint(source)
   1.495 +        print "===== FILES"
   1.496 +        pprint(files)
   1.497 +        print "===== DISABLED"
   1.498 +        pprint(disabled)
   1.499 +        print "===== UNKNOWN"
   1.500 +        pprint(unknown)
   1.501 +
   1.502 +
   1.503 +if __name__ == '__main__':
   1.504 +    parser = argparse.ArgumentParser(description='''This script only works on Mac OS X since the OS X Toolchain is not available on other platforms.
   1.505 +In addition you need XCode and the Android NDK installed.
   1.506 +If commit hash is not provided, current git master is used.''')
   1.507 +    parser.add_argument('--debug', dest='debug', action="store_true")
   1.508 +    parser.add_argument('--ndk', dest='ndk', type=str)
   1.509 +    parser.add_argument('--commit', dest='commit', type=str, default=None)
   1.510 +
   1.511 +    args = parser.parse_args()
   1.512 +
   1.513 +    if sys.platform != 'darwin' or not args.ndk:
   1.514 +        parser.print_help()
   1.515 +        sys.exit(1)
   1.516 +
   1.517 +    ndk_path = args.ndk
   1.518 +    commit = args.commit
   1.519 +    DEBUG = args.debug
   1.520 +
   1.521 +    base = os.path.abspath(os.curdir)
   1.522 +    prefix = os.path.join(base, 'upstream/')
   1.523 +
   1.524 +    commit = prepare_upstream(prefix, commit)
   1.525 +
   1.526 +    libvpx_files = get_libvpx_files(prefix)
   1.527 +    source, files, disabled, unknown = get_sources(prefix)
   1.528 +
   1.529 +    sources_mozbuild, moz_build_files = get_sources_mozbuild()
   1.530 +
   1.531 +    print_info(source, files, disabled, unknown, moz_build_files)
   1.532 +    update_sources_mozbuild(files, sources_mozbuild)
   1.533 +    update_and_remove_files(prefix, libvpx_files, files)
   1.534 +    apply_patches()
   1.535 +    update_readme(commit)
   1.536 +
   1.537 +    cleanup_upstream()

mercurial