author Mike Shal <>
Tue, 08 Aug 2017 17:07:07 -0400
changeset 425523 3a181cd6052b21fb0aa1a5a855aa5cff81466862
parent 395976 99d61037afe888bf56b1c226d51edb9f1aeac2fe
child 436572 6074db12d685655fe5692d59471b3c32cc967dc9
permissions -rw-r--r--
Bug 1390916 - Always use --track instead of --no-remove for install manifests; r=gps The --track flag provides a more accurate accounting of what files were installed by the manifest, so they can be appropriately removed. For example, test files are now removed from _tests if an entry in a test file is deleted. The --no-remove flag is removed as an alternative, and the --track flag is now mandatory. MozReview-Commit-ID: Wiup4Gzwkb

# 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

import json

from argparse import ArgumentParser

    'common', # Harnesses without a specific package will look here.


# These packages are not present for every build configuration.

def parse_args():
    parser = ArgumentParser(description='Generate a test_packages.json file to tell automation which harnesses require which test packages.')
    parser.add_argument("--common", required=True,
                        action="store", dest="tests_common",
                        help="Name of the \"common\" archive, a package to be used by all harnesses.")
    parser.add_argument("--jsshell", required=True,
                        action="store", dest="jsshell",
                        help="Name of the jsshell zip.")
        parser.add_argument("--%s" % harness, required=True,
                            action="store", dest=harness,
                            help="Name of the %s zip." % harness)
    for harness in OPTIONAL_PACKAGES:
        parser.add_argument("--%s" % harness, required=False,
                            action="store", dest=harness,
                            help="Name of the %s zip." % harness)
    parser.add_argument("--dest-file", required=True,
                        action="store", dest="destfile",
                        help="Path to the output file to be written.")
    return parser.parse_args()

def generate_package_data(args):
    # Generate a dictionary mapping test harness names (exactly as they're known to
    # mozharness and, ideally) to the set of archive names that
    # harness depends on to run.
    # mozharness will use this file to determine what test zips to download,
    # which will be an optimization once parts of the main zip are split to harness
    # specific zips.
    tests_common = args.tests_common
    jsshell = args.jsshell

    harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
        pkg_name = getattr(args, harness, None)
        if pkg_name is None:
    return harness_requirements

if __name__ == '__main__':
    args = parse_args()
    packages_data = generate_package_data(args)
    with open(args.destfile, 'w') as of:
        json.dump(packages_data, of, indent=4)