зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset e1455a5d2e05 (bug 1410459) for breaking Talos. r=backout on a CLOSED TREE
This commit is contained in:
Родитель
164eee4b73
Коммит
bb00fb7597
|
@ -19,12 +19,14 @@ class ActionsConfigExample(BaseScript):
|
|||
['--beverage', ],
|
||||
{"action": "store",
|
||||
"dest": "beverage",
|
||||
"type": "string",
|
||||
"help": "Specify your beverage of choice",
|
||||
}
|
||||
], [
|
||||
['--ship-style', ],
|
||||
{"action": "store",
|
||||
"dest": "ship_style",
|
||||
"type": "choice",
|
||||
"choices": ["1", "2", "3"],
|
||||
"help": "Specify the type of ship",
|
||||
}
|
||||
|
@ -32,7 +34,7 @@ class ActionsConfigExample(BaseScript):
|
|||
['--long-sleep-time', ],
|
||||
{"action": "store",
|
||||
"dest": "long_sleep_time",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Specify how long to sleep",
|
||||
}
|
||||
]]
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
gone by.
|
||||
|
||||
The config should be built from script-level defaults, overlaid by
|
||||
config-file defaults, overlaid by command line arguments.
|
||||
config-file defaults, overlaid by command line options.
|
||||
|
||||
(For buildbot-analogues that would be factory-level defaults,
|
||||
builder-level defaults, and build request/scheduler settings.)
|
||||
|
@ -24,8 +24,8 @@ TODO:
|
|||
these settings are set.
|
||||
"""
|
||||
|
||||
from argparse import ArgumentParser, Action
|
||||
from copy import deepcopy
|
||||
from optparse import OptionParser, Option, OptionGroup
|
||||
import os
|
||||
import sys
|
||||
import urllib2
|
||||
|
@ -39,12 +39,29 @@ except ImportError:
|
|||
from mozharness.base.log import DEBUG, INFO, WARNING, ERROR, CRITICAL, FATAL
|
||||
|
||||
|
||||
# argparse {{{1
|
||||
class ExtendAction(Action):
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
items = getattr(namespace, self.dest) or []
|
||||
items.extend(values.split(','))
|
||||
setattr(namespace, self.dest, items)
|
||||
# optparse {{{1
|
||||
class ExtendedOptionParser(OptionParser):
|
||||
"""OptionParser, but with ExtendOption as the option_class.
|
||||
"""
|
||||
def __init__(self, **kwargs):
|
||||
kwargs['option_class'] = ExtendOption
|
||||
OptionParser.__init__(self, **kwargs)
|
||||
|
||||
|
||||
class ExtendOption(Option):
|
||||
"""from http://docs.python.org/library/optparse.html?highlight=optparse#adding-new-actions"""
|
||||
ACTIONS = Option.ACTIONS + ("extend",)
|
||||
STORE_ACTIONS = Option.STORE_ACTIONS + ("extend",)
|
||||
TYPED_ACTIONS = Option.TYPED_ACTIONS + ("extend",)
|
||||
ALWAYS_TYPED_ACTIONS = Option.ALWAYS_TYPED_ACTIONS + ("extend",)
|
||||
|
||||
def take_action(self, action, dest, opt, value, values, parser):
|
||||
if action == "extend":
|
||||
lvalue = value.split(",")
|
||||
values.ensure_value(dest, []).extend(lvalue)
|
||||
else:
|
||||
Option.take_action(
|
||||
self, action, dest, opt, value, values, parser)
|
||||
|
||||
|
||||
def make_immutable(item):
|
||||
|
@ -196,7 +213,7 @@ class BaseConfig(object):
|
|||
volatile_config=None, option_args=None,
|
||||
require_config_file=False,
|
||||
append_env_variables_from_configs=False,
|
||||
usage=None):
|
||||
usage="usage: %prog [options]"):
|
||||
self._config = {}
|
||||
self.all_cfg_files_and_dicts = []
|
||||
self.actions = []
|
||||
|
@ -231,10 +248,16 @@ class BaseConfig(object):
|
|||
)
|
||||
self.set_config(initial_config)
|
||||
# Since initial_config_file is only set when running unit tests,
|
||||
# default option_args to [] to avoid parsing sys.argv (which are
|
||||
# specified for nosetests).
|
||||
# if no option_args have been specified, then the parser will
|
||||
# parse sys.argv which in this case would be the command line
|
||||
# options specified to run the tests, e.g. nosetests -v. Clearly,
|
||||
# the options passed to nosetests (such as -v) should not be
|
||||
# interpreted by mozharness as mozharness options, so we specify
|
||||
# a dummy command line with no options, so that the parser does
|
||||
# not add anything from the test invocation command line
|
||||
# arguments to the mozharness options.
|
||||
if option_args is None:
|
||||
option_args = []
|
||||
option_args=['dummy_mozharness_script_with_no_command_line_options.py']
|
||||
if config_options is None:
|
||||
config_options = []
|
||||
self._create_config_parser(config_options, usage)
|
||||
|
@ -245,33 +268,36 @@ class BaseConfig(object):
|
|||
return ReadOnlyDict(self._config)
|
||||
|
||||
def _create_config_parser(self, config_options, usage):
|
||||
self.config_parser = ArgumentParser(usage=usage)
|
||||
self.config_parser.register('action', 'extend', ExtendAction)
|
||||
self.config_parser.add_argument(
|
||||
"--work-dir", default="build",
|
||||
self.config_parser = ExtendedOptionParser(usage=usage)
|
||||
self.config_parser.add_option(
|
||||
"--work-dir", action="store", dest="work_dir",
|
||||
type="string", default="build",
|
||||
help="Specify the work_dir (subdir of base_work_dir)"
|
||||
)
|
||||
self.config_parser.add_argument(
|
||||
"--base-work-dir", default=os.getcwd(),
|
||||
self.config_parser.add_option(
|
||||
"--base-work-dir", action="store", dest="base_work_dir",
|
||||
type="string", default=os.getcwd(),
|
||||
help="Specify the absolute path of the parent of the working directory"
|
||||
)
|
||||
self.config_parser.add_argument(
|
||||
self.config_parser.add_option(
|
||||
"-c", "--config-file", "--cfg", action="extend", dest="config_files",
|
||||
help="Specify a config file; can be repeated"
|
||||
type="string", help="Specify a config file; can be repeated"
|
||||
)
|
||||
self.config_parser.add_argument(
|
||||
self.config_parser.add_option(
|
||||
"-C", "--opt-config-file", "--opt-cfg", action="extend",
|
||||
dest="opt_config_files", default=[],
|
||||
dest="opt_config_files", type="string", default=[],
|
||||
help="Specify an optional config file, like --config-file but with no "
|
||||
"error if the file is missing; can be repeated"
|
||||
)
|
||||
self.config_parser.add_argument(
|
||||
self.config_parser.add_option(
|
||||
"--dump-config", action="store_true",
|
||||
dest="dump_config",
|
||||
help="List and dump the config generated from this run to "
|
||||
"a JSON file."
|
||||
)
|
||||
self.config_parser.add_argument(
|
||||
self.config_parser.add_option(
|
||||
"--dump-config-hierarchy", action="store_true",
|
||||
dest="dump_config_hierarchy",
|
||||
help="Like --dump-config but will list and dump which config "
|
||||
"files were used making up the config and specify their own "
|
||||
"keys/values that were not overwritten by another cfg -- "
|
||||
|
@ -279,69 +305,75 @@ class BaseConfig(object):
|
|||
)
|
||||
|
||||
# Logging
|
||||
log_option_group = self.config_parser.add_argument_group("Logging")
|
||||
log_option_group.add_argument(
|
||||
"--log-level", default=INFO,
|
||||
log_option_group = OptionGroup(self.config_parser, "Logging")
|
||||
log_option_group.add_option(
|
||||
"--log-level", action="store",
|
||||
type="choice", dest="log_level", default=INFO,
|
||||
choices=[DEBUG, INFO, WARNING, ERROR, CRITICAL, FATAL],
|
||||
help="Set log level (debug|info|warning|error|critical|fatal)"
|
||||
)
|
||||
log_option_group.add_argument(
|
||||
log_option_group.add_option(
|
||||
"-q", "--quiet", action="store_false", dest="log_to_console",
|
||||
default=True, help="Don't log to the console"
|
||||
)
|
||||
log_option_group.add_argument(
|
||||
"--append-to-log", action="store_true", default=False,
|
||||
log_option_group.add_option(
|
||||
"--append-to-log", action="store_true",
|
||||
dest="append_to_log", default=False,
|
||||
help="Append to the log"
|
||||
)
|
||||
log_option_group.add_argument(
|
||||
log_option_group.add_option(
|
||||
"--multi-log", action="store_const", const="multi",
|
||||
dest="log_type", help="Log using MultiFileLogger"
|
||||
)
|
||||
log_option_group.add_argument(
|
||||
log_option_group.add_option(
|
||||
"--simple-log", action="store_const", const="simple",
|
||||
dest="log_type", help="Log using SimpleFileLogger"
|
||||
)
|
||||
self.config_parser.add_option_group(log_option_group)
|
||||
|
||||
# Actions
|
||||
action_option_group = self.config_parser.add_argument_group(
|
||||
"Actions", "Use these options to list or enable/disable actions.")
|
||||
action_option_group.add_argument(
|
||||
action_option_group = OptionGroup(
|
||||
self.config_parser, "Actions",
|
||||
"Use these options to list or enable/disable actions."
|
||||
)
|
||||
action_option_group.add_option(
|
||||
"--list-actions", action="store_true",
|
||||
dest="list_actions",
|
||||
help="List all available actions, then exit"
|
||||
)
|
||||
action_option_group.add_argument(
|
||||
action_option_group.add_option(
|
||||
"--add-action", action="extend",
|
||||
dest="add_actions", metavar="ACTIONS",
|
||||
help="Add action %s to the list of actions" % self.all_actions
|
||||
)
|
||||
action_option_group.add_argument(
|
||||
action_option_group.add_option(
|
||||
"--no-action", action="extend",
|
||||
dest="no_actions", metavar="ACTIONS",
|
||||
help="Don't perform action"
|
||||
)
|
||||
for action in self.all_actions:
|
||||
action_option_group.add_argument(
|
||||
action_option_group.add_option(
|
||||
"--%s" % action, action="append_const",
|
||||
dest="actions", const=action,
|
||||
help="Add %s to the limited list of actions" % action
|
||||
)
|
||||
action_option_group.add_argument(
|
||||
action_option_group.add_option(
|
||||
"--no-%s" % action, action="append_const",
|
||||
dest="no_actions", const=action,
|
||||
help="Remove %s from the list of actions to perform" % action
|
||||
)
|
||||
|
||||
self.config_parser.add_option_group(action_option_group)
|
||||
# Child-specified options
|
||||
# TODO error checking for overlapping options
|
||||
if config_options:
|
||||
for option in config_options:
|
||||
self.config_parser.add_argument(*option[0], **option[1])
|
||||
self.config_parser.add_option(*option[0], **option[1])
|
||||
|
||||
# Initial-config-specified options
|
||||
config_options = self._config.get('config_options', None)
|
||||
if config_options:
|
||||
for option in config_options:
|
||||
self.config_parser.add_argument(*option[0], **option[1])
|
||||
self.config_parser.add_option(*option[0], **option[1])
|
||||
|
||||
def set_config(self, config, overwrite=False):
|
||||
"""This is probably doable some other way."""
|
||||
|
@ -382,15 +414,15 @@ class BaseConfig(object):
|
|||
print " " + ("*" if a in self.default_actions else " "), a
|
||||
raise SystemExit(0)
|
||||
|
||||
def get_cfgs_from_files(self, all_config_files, args):
|
||||
def get_cfgs_from_files(self, all_config_files, options):
|
||||
"""Returns the configuration derived from the list of configuration
|
||||
files. The result is represented as a list of `(filename,
|
||||
config_dict)` tuples; they will be combined with keys in later
|
||||
dictionaries taking precedence over earlier.
|
||||
|
||||
`all_config_files` is all files specified with `--config-file` and
|
||||
`--opt-config-file`; `args` is the argparse Namespace object giving
|
||||
access to any other command-line arguments.
|
||||
`--opt-config-file`; `options` is the argparse options object giving
|
||||
access to any other command-line options.
|
||||
|
||||
This function is also responsible for downloading any configuration
|
||||
files specified by URL. It uses ``parse_config_file`` in this module
|
||||
|
@ -413,7 +445,7 @@ class BaseConfig(object):
|
|||
else:
|
||||
all_cfg_files_and_dicts.append((cf, parse_config_file(cf)))
|
||||
except Exception:
|
||||
if cf in args.opt_config_files:
|
||||
if cf in options.opt_config_files:
|
||||
print(
|
||||
"WARNING: optional config file not found %s" % cf
|
||||
)
|
||||
|
@ -423,17 +455,19 @@ class BaseConfig(object):
|
|||
|
||||
def parse_args(self, args=None):
|
||||
"""Parse command line arguments in a generic way.
|
||||
Return the parser object after adding the basic arguments, so
|
||||
Return the parser object after adding the basic options, so
|
||||
child objects can manipulate it.
|
||||
"""
|
||||
self.command_line = ' '.join(sys.argv)
|
||||
if args is None:
|
||||
args = sys.argv[1:]
|
||||
args = self.config_parser.parse_args(args)
|
||||
(options, args) = self.config_parser.parse_args(args)
|
||||
|
||||
if not args.config_files:
|
||||
defaults = self.config_parser.defaults.copy()
|
||||
|
||||
if not options.config_files:
|
||||
if self.require_config_file:
|
||||
if args.list_actions:
|
||||
if options.list_actions:
|
||||
self.list_actions()
|
||||
print("Required config file not set! (use --config-file option)")
|
||||
raise SystemExit(-1)
|
||||
|
@ -444,7 +478,7 @@ class BaseConfig(object):
|
|||
# let's store this to self for things like --interpret-config-files
|
||||
self.all_cfg_files_and_dicts.extend(self.get_cfgs_from_files(
|
||||
# append opt_config to allow them to overwrite previous configs
|
||||
args.config_files + args.opt_config_files, args
|
||||
options.config_files + options.opt_config_files, options=options
|
||||
))
|
||||
config = {}
|
||||
if self.append_env_variables_from_configs:
|
||||
|
@ -465,32 +499,33 @@ class BaseConfig(object):
|
|||
# as the keys/values that make up that instance. Ultimately,
|
||||
# this becomes self.config during BaseScript's init
|
||||
self.set_config(config)
|
||||
|
||||
for key, value in vars(args).items():
|
||||
for key in defaults.keys():
|
||||
value = getattr(options, key)
|
||||
if value is None:
|
||||
continue
|
||||
# Don't override config_file defaults with config_parser defaults
|
||||
if value == self.config_parser.get_default(key) and key in self._config:
|
||||
if key in defaults and value == defaults[key] and key in self._config:
|
||||
continue
|
||||
self._config[key] = value
|
||||
|
||||
# The idea behind the volatile_config is we don't want to save this
|
||||
# info over multiple runs. This defaults to the action-specific
|
||||
# config args, but can be anything.
|
||||
# config options, but can be anything.
|
||||
for key in self.volatile_config.keys():
|
||||
if self._config.get(key) is not None:
|
||||
self.volatile_config[key] = self._config[key]
|
||||
del(self._config[key])
|
||||
|
||||
self.update_actions()
|
||||
if args.list_actions:
|
||||
if options.list_actions:
|
||||
self.list_actions()
|
||||
|
||||
# Keep? This is for saving the volatile config in the dump_config
|
||||
self._config['volatile_config'] = self.volatile_config
|
||||
|
||||
self.options = options
|
||||
self.args = args
|
||||
return self.args
|
||||
return (self.options, self.args)
|
||||
|
||||
def update_actions(self):
|
||||
""" Update actions after reading in config.
|
||||
|
@ -500,7 +535,7 @@ class BaseConfig(object):
|
|||
First, if default_actions is specified in the config, set our
|
||||
default actions even if the script specifies other default actions.
|
||||
|
||||
Without any other action-specific arguments, run with default actions.
|
||||
Without any other action-specific options, run with default actions.
|
||||
|
||||
If we specify --ACTION or --only-ACTION once or multiple times,
|
||||
we want to override the default_actions list with the one(s) we list.
|
||||
|
|
|
@ -20,7 +20,6 @@ import uuid
|
|||
import copy
|
||||
import glob
|
||||
import shlex
|
||||
from argparse import Action
|
||||
from itertools import chain
|
||||
|
||||
# import the power of mozharness ;)
|
||||
|
@ -328,7 +327,7 @@ class BuildingConfig(BaseConfig):
|
|||
|
||||
|
||||
# noinspection PyUnusedLocal
|
||||
class BuildOptionParser(Action):
|
||||
class BuildOptionParser(object):
|
||||
# TODO add nosetests for this class
|
||||
platform = None
|
||||
bits = None
|
||||
|
@ -389,11 +388,6 @@ class BuildOptionParser(Action):
|
|||
build_pool_cfg_file = 'builds/build_pool_specifics.py'
|
||||
branch_cfg_file = 'builds/branch_specifics.py'
|
||||
|
||||
def __call__(self, parser, namespace, values, option_string=None):
|
||||
func = getattr(self, 'set_{}'.format(self.dest))
|
||||
func(self, namespace, values)
|
||||
|
||||
|
||||
@classmethod
|
||||
def _query_pltfrm_and_bits(cls, target_option, options):
|
||||
""" determine platform and bits
|
||||
|
@ -445,11 +439,11 @@ class BuildOptionParser(Action):
|
|||
return cls.bits, cls.platform
|
||||
|
||||
@classmethod
|
||||
def find_variant_cfg_path(cls, opt, value, namespace):
|
||||
def find_variant_cfg_path(cls, opt, value, parser):
|
||||
valid_variant_cfg_path = None
|
||||
# first let's see if we were given a valid short-name
|
||||
if cls.build_variants.get(value):
|
||||
bits, pltfrm = cls._query_pltfrm_and_bits(opt, namespace)
|
||||
bits, pltfrm = cls._query_pltfrm_and_bits(opt, parser.values)
|
||||
prospective_cfg_path = cls.build_variants[value] % (pltfrm, bits)
|
||||
else:
|
||||
# this is either an incomplete path or an invalid key in
|
||||
|
@ -471,14 +465,14 @@ class BuildOptionParser(Action):
|
|||
return valid_variant_cfg_path, prospective_cfg_path
|
||||
|
||||
@classmethod
|
||||
def set_build_variant(cls, option, namespace, value):
|
||||
def set_build_variant(cls, option, opt, value, parser):
|
||||
""" sets an extra config file.
|
||||
|
||||
This is done by either taking an existing filepath or by taking a valid
|
||||
shortname coupled with known platform/bits.
|
||||
"""
|
||||
valid_variant_cfg_path, prospective_cfg_path = cls.find_variant_cfg_path(
|
||||
'--custom-build-variant-cfg', value, namespace)
|
||||
'--custom-build-variant-cfg', value, parser)
|
||||
|
||||
if not valid_variant_cfg_path:
|
||||
# either the value was an indeterminable path or an invalid short
|
||||
|
@ -491,32 +485,32 @@ class BuildOptionParser(Action):
|
|||
prospective_cfg_path,
|
||||
str(cls.build_variants.keys()),
|
||||
str(cls.config_file_search_path)))
|
||||
namespace.config_files.append(valid_variant_cfg_path)
|
||||
setattr(namespace, option.dest, value) # the pool
|
||||
parser.values.config_files.append(valid_variant_cfg_path)
|
||||
setattr(parser.values, option.dest, value) # the pool
|
||||
|
||||
@classmethod
|
||||
def set_build_pool(cls, option, namespace, value):
|
||||
def set_build_pool(cls, option, opt, value, parser):
|
||||
# first let's add the build pool file where there may be pool
|
||||
# specific keys/values. Then let's store the pool name
|
||||
namespace.config_files.append(cls.build_pool_cfg_file)
|
||||
setattr(namespace, option.dest, value) # the pool
|
||||
parser.values.config_files.append(cls.build_pool_cfg_file)
|
||||
setattr(parser.values, option.dest, value) # the pool
|
||||
|
||||
@classmethod
|
||||
def set_branch(cls, option, namespace, value):
|
||||
def set_build_branch(cls, option, opt, value, parser):
|
||||
# first let's add the branch_specific file where there may be branch
|
||||
# specific keys/values. Then let's store the branch name we are using
|
||||
namespace.config_files.append(cls.branch_cfg_file)
|
||||
setattr(namespace, option.dest, value) # the branch name
|
||||
parser.values.config_files.append(cls.branch_cfg_file)
|
||||
setattr(parser.values, option.dest, value) # the branch name
|
||||
|
||||
@classmethod
|
||||
def set_platform(cls, option, namespace, value):
|
||||
def set_platform(cls, option, opt, value, parser):
|
||||
cls.platform = value
|
||||
setattr(namespace, option.dest, value)
|
||||
setattr(parser.values, option.dest, value)
|
||||
|
||||
@classmethod
|
||||
def set_bits(cls, option, namespace, value):
|
||||
def set_bits(cls, option, opt, value, parser):
|
||||
cls.bits = value
|
||||
setattr(namespace, option.dest, value)
|
||||
setattr(parser.values, option.dest, value)
|
||||
|
||||
|
||||
# this global depends on BuildOptionParser and therefore can not go at the
|
||||
|
@ -530,31 +524,41 @@ BUILD_BASE_CONFIG_OPTIONS = [
|
|||
"infrastructure, use this option. It ignores actions"
|
||||
"that are not needed and adds config checks."}],
|
||||
[['--platform'], {
|
||||
"action": BuildOptionParser,
|
||||
"action": "callback",
|
||||
"callback": BuildOptionParser.set_platform,
|
||||
"type": "string",
|
||||
"dest": "platform",
|
||||
"help": "Sets the platform we are running this against"
|
||||
" valid values: 'windows', 'mac', 'linux'"}],
|
||||
[['--bits'], {
|
||||
"action": BuildOptionParser,
|
||||
"action": "callback",
|
||||
"callback": BuildOptionParser.set_bits,
|
||||
"type": "string",
|
||||
"dest": "bits",
|
||||
"help": "Sets which bits we are building this against"
|
||||
" valid values: '32', '64'"}],
|
||||
[['--custom-build-variant-cfg'], {
|
||||
"action": BuildOptionParser,
|
||||
"action": "callback",
|
||||
"callback": BuildOptionParser.set_build_variant,
|
||||
"type": "string",
|
||||
"dest": "build_variant",
|
||||
"help": "Sets the build type and will determine appropriate"
|
||||
" additional config to use. Either pass a config path"
|
||||
" or use a valid shortname from: "
|
||||
"%s" % (BuildOptionParser.build_variants.keys(),)}],
|
||||
[['--build-pool'], {
|
||||
"action": BuildOptionParser,
|
||||
"action": "callback",
|
||||
"callback": BuildOptionParser.set_build_pool,
|
||||
"type": "string",
|
||||
"dest": "build_pool",
|
||||
"help": "This will update the config with specific pool"
|
||||
" environment keys/values. The dicts for this are"
|
||||
" in %s\nValid values: staging or"
|
||||
" production" % ('builds/build_pool_specifics.py',)}],
|
||||
[['--branch'], {
|
||||
"action": BuildOptionParser,
|
||||
"action": "callback",
|
||||
"callback": BuildOptionParser.set_build_branch,
|
||||
"type": "string",
|
||||
"dest": "branch",
|
||||
"help": "This sets the branch we will be building this for."
|
||||
" If this branch is in branch_specifics.py, update our"
|
||||
|
@ -564,7 +568,7 @@ BUILD_BASE_CONFIG_OPTIONS = [
|
|||
)}],
|
||||
[['--scm-level'], {
|
||||
"action": "store",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"dest": "scm_level",
|
||||
"default": 1,
|
||||
"help": "This sets the SCM level for the branch being built."
|
||||
|
|
|
@ -31,12 +31,14 @@ class MultiLocaleBuild(LocalesMixin, MercurialScript):
|
|||
["--locale"],
|
||||
{"action": "extend",
|
||||
"dest": "locales",
|
||||
"type": "string",
|
||||
"help": "Specify the locale(s) to repack"
|
||||
}
|
||||
], [
|
||||
["--objdir"],
|
||||
{"action": "store",
|
||||
"dest": "objdir",
|
||||
"type": "string",
|
||||
"default": "objdir",
|
||||
"help": "Specify the objdir"
|
||||
}
|
||||
|
@ -44,30 +46,35 @@ class MultiLocaleBuild(LocalesMixin, MercurialScript):
|
|||
["--l10n-base"],
|
||||
{"action": "store",
|
||||
"dest": "hg_l10n_base",
|
||||
"type": "string",
|
||||
"help": "Specify the L10n repo base directory"
|
||||
}
|
||||
], [
|
||||
["--l10n-tag"],
|
||||
{"action": "store",
|
||||
"dest": "hg_l10n_tag",
|
||||
"type": "string",
|
||||
"help": "Specify the L10n tag"
|
||||
}
|
||||
], [
|
||||
["--tag-override"],
|
||||
{"action": "store",
|
||||
"dest": "tag_override",
|
||||
"type": "string",
|
||||
"help": "Override the tags set for all repos"
|
||||
}
|
||||
], [
|
||||
["--user-repo-override"],
|
||||
{"action": "store",
|
||||
"dest": "user_repo_override",
|
||||
"type": "string",
|
||||
"help": "Override the user repo path for all repos"
|
||||
}
|
||||
], [
|
||||
["--l10n-dir"],
|
||||
{"action": "store",
|
||||
"dest": "l10n_dir",
|
||||
"type": "string",
|
||||
"default": "l10n",
|
||||
"help": "Specify the l10n dir name"
|
||||
}
|
||||
|
|
|
@ -440,6 +440,7 @@ device_config_options = [[
|
|||
], [
|
||||
["--device-protocol"],
|
||||
{"action": "store",
|
||||
"type": "choice",
|
||||
"dest": "device_protocol",
|
||||
"choices": DEVICE_PROTOCOL_DICT.keys(),
|
||||
"help": "Specify the device communication protocol."
|
||||
|
@ -449,6 +450,7 @@ device_config_options = [[
|
|||
# A bit useless atm, but we can add new device types as we add support
|
||||
# for them.
|
||||
{"action": "store",
|
||||
"type": "choice",
|
||||
"choices": ["non-tegra", "tegra250"],
|
||||
"default": "non-tegra",
|
||||
"dest": "device_type",
|
||||
|
|
|
@ -119,6 +119,7 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin,
|
|||
[["--system-bits"],
|
||||
{"action": "store",
|
||||
"dest": "system_bits",
|
||||
"type": "choice",
|
||||
"default": "32",
|
||||
"choices": ['32', '64'],
|
||||
"help": "Testing 32 or 64 (for talos json plugins)"
|
||||
|
@ -137,7 +138,7 @@ class Talos(TestingMixin, MercurialScript, BlobUploadMixin, TooltoolMixin,
|
|||
}],
|
||||
[["--geckoProfileInterval"], {
|
||||
"dest": "gecko_profile_interval",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"default": 0,
|
||||
"help": "The interval between samples taken by the profiler (milliseconds)"
|
||||
}],
|
||||
|
|
|
@ -95,6 +95,7 @@ testing_config_options = [
|
|||
[["--download-symbols"],
|
||||
{"action": "store",
|
||||
"dest": "download_symbols",
|
||||
"type": "choice",
|
||||
"choices": ['ondemand', 'true'],
|
||||
"help": "Download and extract crash reporter symbols.",
|
||||
}],
|
||||
|
|
|
@ -79,70 +79,81 @@ class DesktopSingleLocale(LocalesMixin, ReleaseMixin, MockMixin, BuildbotMixin,
|
|||
['--balrog-config', ],
|
||||
{"action": "extend",
|
||||
"dest": "config_files",
|
||||
"type": "string",
|
||||
"help": "Specify the balrog configuration file"}
|
||||
], [
|
||||
['--branch-config', ],
|
||||
{"action": "extend",
|
||||
"dest": "config_files",
|
||||
"type": "string",
|
||||
"help": "Specify the branch configuration file"}
|
||||
], [
|
||||
['--environment-config', ],
|
||||
{"action": "extend",
|
||||
"dest": "config_files",
|
||||
"type": "string",
|
||||
"help": "Specify the environment (staging, production, ...) configuration file"}
|
||||
], [
|
||||
['--platform-config', ],
|
||||
{"action": "extend",
|
||||
"dest": "config_files",
|
||||
"type": "string",
|
||||
"help": "Specify the platform configuration file"}
|
||||
], [
|
||||
['--locale', ],
|
||||
{"action": "extend",
|
||||
"dest": "locales",
|
||||
"type": "string",
|
||||
"help": "Specify the locale(s) to sign and update. Optionally pass"
|
||||
" revision separated by colon, en-GB:default."}
|
||||
], [
|
||||
['--locales-file', ],
|
||||
{"action": "store",
|
||||
"dest": "locales_file",
|
||||
"type": "string",
|
||||
"help": "Specify a file to determine which locales to sign and update"}
|
||||
], [
|
||||
['--tag-override', ],
|
||||
{"action": "store",
|
||||
"dest": "tag_override",
|
||||
"type": "string",
|
||||
"help": "Override the tags set for all repos"}
|
||||
], [
|
||||
['--revision', ],
|
||||
{"action": "store",
|
||||
"dest": "revision",
|
||||
"type": "string",
|
||||
"help": "Override the gecko revision to use (otherwise use buildbot supplied"
|
||||
" value, or en-US revision) "}
|
||||
], [
|
||||
['--user-repo-override', ],
|
||||
{"action": "store",
|
||||
"dest": "user_repo_override",
|
||||
"type": "string",
|
||||
"help": "Override the user repo path for all repos"}
|
||||
], [
|
||||
['--release-config-file', ],
|
||||
{"action": "store",
|
||||
"dest": "release_config_file",
|
||||
"type": "string",
|
||||
"help": "Specify the release config file to use"}
|
||||
], [
|
||||
['--this-chunk', ],
|
||||
{"action": "store",
|
||||
"dest": "this_locale_chunk",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Specify which chunk of locales to run"}
|
||||
], [
|
||||
['--total-chunks', ],
|
||||
{"action": "store",
|
||||
"dest": "total_locale_chunks",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Specify the total number of chunks of locales"}
|
||||
], [
|
||||
['--en-us-installer-url', ],
|
||||
{"action": "store",
|
||||
"dest": "en_us_installer_url",
|
||||
"type": "string",
|
||||
"help": "Specify the url of the en-us binary"}
|
||||
], [
|
||||
["--disable-mock"], {
|
||||
|
|
|
@ -53,6 +53,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--mochitest-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_mochitest_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which mochi suite to run. "
|
||||
"Suites are defined in the config file.\n"
|
||||
"Examples: 'all', 'plain1', 'plain5', 'chrome', or 'a11y'"}
|
||||
|
@ -60,6 +61,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--reftest-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_reftest_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which reftest suite to run. "
|
||||
"Suites are defined in the config file.\n"
|
||||
"Examples: 'all', 'crashplan', or 'jsreftest'"}
|
||||
|
@ -67,6 +69,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--xpcshell-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_xpcshell_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which xpcshell suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'xpcshell'"}
|
||||
|
@ -74,6 +77,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--cppunittest-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_cppunittest_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which cpp unittest suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'cppunittest'"}
|
||||
|
@ -81,6 +85,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--gtest-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_gtest_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which gtest suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'gtest'"}
|
||||
|
@ -88,6 +93,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--jittest-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_jittest_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which jit-test suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'jittest'"}
|
||||
|
@ -95,6 +101,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--mozbase-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_mozbase_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which mozbase suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'mozbase'"}
|
||||
|
@ -102,6 +109,7 @@ class DesktopUnittest(TestingMixin, MercurialScript, BlobUploadMixin, MozbaseMix
|
|||
[['--mozmill-suite', ], {
|
||||
"action": "extend",
|
||||
"dest": "specified_mozmill_suites",
|
||||
"type": "string",
|
||||
"help": "Specify which mozmill suite to run. "
|
||||
"Suites are defined in the config file\n."
|
||||
"Examples: 'mozmill'"}
|
||||
|
|
|
@ -17,7 +17,6 @@ import copy
|
|||
import pprint
|
||||
import sys
|
||||
import os
|
||||
from argparse import Namespace
|
||||
|
||||
# load modules from parent dir
|
||||
sys.path.insert(1, os.path.dirname(sys.path[0]))
|
||||
|
@ -169,7 +168,7 @@ class FxDesktopBuild(BuildScript, TryToolsMixin, object):
|
|||
variant_cfg_path, _ = BuildOptionParser.find_variant_cfg_path(
|
||||
'--custom-build-variant-cfg',
|
||||
variant,
|
||||
Namespace(**rw_config._config)
|
||||
rw_config.config_parser
|
||||
)
|
||||
if not variant_cfg_path:
|
||||
self.fatal('Could not find appropriate config file for variant %s' % variant)
|
||||
|
|
|
@ -60,6 +60,7 @@ class MarionetteTest(TestingMixin, MercurialScript, BlobUploadMixin, TransferMix
|
|||
], [
|
||||
["--emulator"],
|
||||
{"action": "store",
|
||||
"type": "choice",
|
||||
"choices": ['arm', 'x86'],
|
||||
"dest": "emulator",
|
||||
"default": None,
|
||||
|
|
|
@ -42,27 +42,32 @@ class GeckoMigration(MercurialScript, BalrogMixin, VirtualenvMixin,
|
|||
[['--hg-user', ], {
|
||||
"action": "store",
|
||||
"dest": "hg_user",
|
||||
"type": "string",
|
||||
"default": "ffxbld <release@mozilla.com>",
|
||||
"help": "Specify what user to use to commit to hg.",
|
||||
}],
|
||||
[['--balrog-api-root', ], {
|
||||
"action": "store",
|
||||
"dest": "balrog_api_root",
|
||||
"type": "string",
|
||||
"help": "Specify Balrog API root URL.",
|
||||
}],
|
||||
[['--balrog-username', ], {
|
||||
"action": "store",
|
||||
"dest": "balrog_username",
|
||||
"type": "string",
|
||||
"help": "Specify what user to connect to Balrog with.",
|
||||
}],
|
||||
[['--balrog-credentials-file', ], {
|
||||
"action": "store",
|
||||
"dest": "balrog_credentials_file",
|
||||
"type": "string",
|
||||
"help": "The file containing the Balrog credentials.",
|
||||
}],
|
||||
[['--remove-locale', ], {
|
||||
"action": "extend",
|
||||
"dest": "remove_locales",
|
||||
"type": "string",
|
||||
"help": "Comma separated list of locales to remove from the 'to' repo.",
|
||||
}],
|
||||
]
|
||||
|
|
|
@ -52,36 +52,42 @@ class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
|
|||
['--locale', ],
|
||||
{"action": "extend",
|
||||
"dest": "locales",
|
||||
"type": "string",
|
||||
"help": "Specify the locale(s) to sign and update"
|
||||
}
|
||||
], [
|
||||
['--locales-file', ],
|
||||
{"action": "store",
|
||||
"dest": "locales_file",
|
||||
"type": "string",
|
||||
"help": "Specify a file to determine which locales to sign and update"
|
||||
}
|
||||
], [
|
||||
['--tag-override', ],
|
||||
{"action": "store",
|
||||
"dest": "tag_override",
|
||||
"type": "string",
|
||||
"help": "Override the tags set for all repos"
|
||||
}
|
||||
], [
|
||||
['--user-repo-override', ],
|
||||
{"action": "store",
|
||||
"dest": "user_repo_override",
|
||||
"type": "string",
|
||||
"help": "Override the user repo path for all repos"
|
||||
}
|
||||
], [
|
||||
['--release-config-file', ],
|
||||
{"action": "store",
|
||||
"dest": "release_config_file",
|
||||
"type": "string",
|
||||
"help": "Specify the release config file to use"
|
||||
}
|
||||
], [
|
||||
['--key-alias', ],
|
||||
{"action": "store",
|
||||
"dest": "key_alias",
|
||||
"type": "choice",
|
||||
"default": "nightly",
|
||||
"choices": ["nightly", "release"],
|
||||
"help": "Specify the signing key alias"
|
||||
|
@ -90,14 +96,14 @@ class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
|
|||
['--this-chunk', ],
|
||||
{"action": "store",
|
||||
"dest": "this_locale_chunk",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Specify which chunk of locales to run"
|
||||
}
|
||||
], [
|
||||
['--total-chunks', ],
|
||||
{"action": "store",
|
||||
"dest": "total_locale_chunks",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Specify the total number of chunks of locales"
|
||||
}
|
||||
], [
|
||||
|
@ -110,6 +116,7 @@ class MobileSingleLocale(MockMixin, LocalesMixin, ReleaseMixin,
|
|||
['--revision', ],
|
||||
{"action": "store",
|
||||
"dest": "revision",
|
||||
"type": "string",
|
||||
"help": "Override the gecko revision to use (otherwise use buildbot supplied"
|
||||
" value, or en-US revision) "}
|
||||
]]
|
||||
|
|
|
@ -33,30 +33,35 @@ class MobilePartnerRepack(LocalesMixin, ReleaseMixin, MobileSigningMixin,
|
|||
['--locale', ],
|
||||
{"action": "extend",
|
||||
"dest": "locales",
|
||||
"type": "string",
|
||||
"help": "Specify the locale(s) to repack"
|
||||
}
|
||||
], [
|
||||
['--partner', ],
|
||||
{"action": "extend",
|
||||
"dest": "partners",
|
||||
"type": "string",
|
||||
"help": "Specify the partner(s) to repack"
|
||||
}
|
||||
], [
|
||||
['--locales-file', ],
|
||||
{"action": "store",
|
||||
"dest": "locales_file",
|
||||
"type": "string",
|
||||
"help": "Specify a json file to determine which locales to repack"
|
||||
}
|
||||
], [
|
||||
['--tag-override', ],
|
||||
{"action": "store",
|
||||
"dest": "tag_override",
|
||||
"type": "string",
|
||||
"help": "Override the tags set for all repos"
|
||||
}
|
||||
], [
|
||||
['--platform', ],
|
||||
{"action": "extend",
|
||||
"dest": "platforms",
|
||||
"type": "choice",
|
||||
"choices": SUPPORTED_PLATFORMS,
|
||||
"help": "Specify the platform(s) to repack"
|
||||
}
|
||||
|
@ -64,25 +69,28 @@ class MobilePartnerRepack(LocalesMixin, ReleaseMixin, MobileSigningMixin,
|
|||
['--user-repo-override', ],
|
||||
{"action": "store",
|
||||
"dest": "user_repo_override",
|
||||
"type": "string",
|
||||
"help": "Override the user repo path for all repos"
|
||||
}
|
||||
], [
|
||||
['--release-config-file', ],
|
||||
{"action": "store",
|
||||
"dest": "release_config_file",
|
||||
"type": "string",
|
||||
"help": "Specify the release config file to use"
|
||||
}
|
||||
], [
|
||||
['--version', ],
|
||||
{"action": "store",
|
||||
"dest": "version",
|
||||
"type": "string",
|
||||
"help": "Specify the current version"
|
||||
}
|
||||
], [
|
||||
['--buildnum', ],
|
||||
{"action": "store",
|
||||
"dest": "buildnum",
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"default": 1,
|
||||
"metavar": "INT",
|
||||
"help": "Specify the current release build num (e.g. build1, build2)"
|
||||
|
|
|
@ -36,13 +36,13 @@ class AntivirusScan(BaseScript, VirtualenvMixin):
|
|||
[["-d", "--download-parallelization"], {
|
||||
"dest": "download_parallelization",
|
||||
"default": 6,
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Number of concurrent file downloads",
|
||||
}],
|
||||
[["-s", "--scan-parallelization"], {
|
||||
"dest": "scan_parallelization",
|
||||
"default": 4,
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Number of concurrent file scans",
|
||||
}],
|
||||
[["--tools-repo"], {
|
||||
|
|
|
@ -41,6 +41,7 @@ CONFIG_OPTIONS = [
|
|||
[['--locale', ], {
|
||||
"action": "extend",
|
||||
"dest": "locales",
|
||||
"type": "string",
|
||||
"help": "Specify the locale(s) to upload."}],
|
||||
[["--platform"], {
|
||||
"dest": "platform",
|
||||
|
@ -87,7 +88,7 @@ CONFIG_OPTIONS = [
|
|||
[["-s", "--scan-parallelization"], {
|
||||
"dest": "scan_parallelization",
|
||||
"default": 4,
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Number of concurrent file scans",
|
||||
}],
|
||||
]
|
||||
|
|
|
@ -27,42 +27,50 @@ class PostReleaseVersionBump(MercurialScript, BuildbotMixin,
|
|||
[['--hg-user', ], {
|
||||
"action": "store",
|
||||
"dest": "hg_user",
|
||||
"type": "string",
|
||||
"default": "ffxbld <release@mozilla.com>",
|
||||
"help": "Specify what user to use to commit to hg.",
|
||||
}],
|
||||
[['--next-version', ], {
|
||||
"action": "store",
|
||||
"dest": "next_version",
|
||||
"type": "string",
|
||||
"help": "Next version used in version bump",
|
||||
}],
|
||||
[['--ssh-user', ], {
|
||||
"action": "store",
|
||||
"dest": "ssh_user",
|
||||
"type": "string",
|
||||
"help": "SSH username with hg.mozilla.org permissions",
|
||||
}],
|
||||
[['--ssh-key', ], {
|
||||
"action": "store",
|
||||
"dest": "ssh_key",
|
||||
"type": "string",
|
||||
"help": "Path to SSH key.",
|
||||
}],
|
||||
[['--product', ], {
|
||||
"action": "store",
|
||||
"dest": "product",
|
||||
"type": "string",
|
||||
"help": "Product name",
|
||||
}],
|
||||
[['--version', ], {
|
||||
"action": "store",
|
||||
"dest": "version",
|
||||
"type": "string",
|
||||
"help": "Version",
|
||||
}],
|
||||
[['--build-number', ], {
|
||||
"action": "store",
|
||||
"dest": "build_number",
|
||||
"type": "string",
|
||||
"help": "Build number",
|
||||
}],
|
||||
[['--revision', ], {
|
||||
"action": "store",
|
||||
"dest": "revision",
|
||||
"type": "string",
|
||||
"help": "HG revision to tag",
|
||||
}],
|
||||
]
|
||||
|
|
|
@ -58,7 +58,7 @@ class ReleasePusher(BaseScript, VirtualenvMixin):
|
|||
[["-j", "--parallelization"], {
|
||||
"dest": "parallelization",
|
||||
"default": 20,
|
||||
"type": int,
|
||||
"type": "int",
|
||||
"help": "Number of copy requests to run concurrently",
|
||||
}],
|
||||
] + virtualenv_config_options
|
||||
|
|
|
@ -35,17 +35,20 @@ class UpdatesBumper(MercurialScript, BuildbotMixin,
|
|||
[['--hg-user', ], {
|
||||
"action": "store",
|
||||
"dest": "hg_user",
|
||||
"type": "string",
|
||||
"default": "ffxbld <release@mozilla.com>",
|
||||
"help": "Specify what user to use to commit to hg.",
|
||||
}],
|
||||
[['--ssh-user', ], {
|
||||
"action": "store",
|
||||
"dest": "ssh_user",
|
||||
"type": "string",
|
||||
"help": "SSH username with hg.mozilla.org permissions",
|
||||
}],
|
||||
[['--ssh-key', ], {
|
||||
"action": "store",
|
||||
"dest": "ssh_key",
|
||||
"type": "string",
|
||||
"help": "Path to SSH key.",
|
||||
}],
|
||||
]
|
||||
|
|
|
@ -250,7 +250,6 @@ class TestReadOnlyDict(unittest.TestCase):
|
|||
|
||||
class TestActions(unittest.TestCase):
|
||||
all_actions = ['a', 'b', 'c', 'd', 'e']
|
||||
config_options = [[['args'], {'nargs': '*'}]]
|
||||
default_actions = ['b', 'c', 'd']
|
||||
|
||||
def test_verify_actions(self):
|
||||
|
@ -276,7 +275,6 @@ class TestActions(unittest.TestCase):
|
|||
def test_no_action1(self):
|
||||
c = config.BaseConfig(default_actions=self.default_actions,
|
||||
all_actions=self.all_actions,
|
||||
config_options=self.config_options,
|
||||
initial_config_file='test/test.json')
|
||||
c.parse_args(args=['foo', '--no-action', 'a'])
|
||||
self.assertEqual(self.default_actions, c.get_actions(),
|
||||
|
@ -285,7 +283,6 @@ class TestActions(unittest.TestCase):
|
|||
def test_no_action2(self):
|
||||
c = config.BaseConfig(default_actions=self.default_actions,
|
||||
all_actions=self.all_actions,
|
||||
config_options=self.config_options,
|
||||
initial_config_file='test/test.json')
|
||||
c.parse_args(args=['foo', '--no-c'])
|
||||
self.assertEqual(['b', 'd'], c.get_actions(),
|
||||
|
@ -294,7 +291,6 @@ class TestActions(unittest.TestCase):
|
|||
def test_add_action(self):
|
||||
c = config.BaseConfig(default_actions=self.default_actions,
|
||||
all_actions=self.all_actions,
|
||||
config_options=self.config_options,
|
||||
initial_config_file='test/test.json')
|
||||
c.parse_args(args=['foo', '--add-action', 'e'])
|
||||
self.assertEqual(['b', 'c', 'd', 'e'], c.get_actions(),
|
||||
|
@ -303,7 +299,6 @@ class TestActions(unittest.TestCase):
|
|||
def test_only_action(self):
|
||||
c = config.BaseConfig(default_actions=self.default_actions,
|
||||
all_actions=self.all_actions,
|
||||
config_options=self.config_options,
|
||||
initial_config_file='test/test.json')
|
||||
c.parse_args(args=['foo', '--a', '--e'])
|
||||
self.assertEqual(['a', 'e'], c.get_actions(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче