def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel( REGISTRY.names( lambda klass: not getattr(klass, 'disable_in_gui', None))) self.ui.app_combo.setModel(self.app_model) if mozinfo.bits == 64: if mozinfo.os == 'mac': self.bits_model = QStringListModel(['64']) bits_index = 0 else: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.build_type_model = QStringListModel() self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox")) completer = QCompleter() completer.setModel(QStringListModel(branches.get_branches( include_aliases=True), self)) completer.setCaseSensitivity(Qt.CaseInsensitive) self.ui.repository.setCompleter(completer)
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel([a for a in REGISTRY.names() if not a.startswith('b2g-')]) self.ui.app_combo.setModel(self.app_model) self.bisect_model = QStringListModel() self.ui.bisect_combo.setModel(self.bisect_model) if mozinfo.bits == 64: if mozinfo.os == 'mac': self.bits_model = QStringListModel(['64']) bits_index = 0 else: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox"))
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel( REGISTRY.names( lambda klass: not getattr(klass, 'disable_in_gui', None))) self.ui.app_combo.setModel(self.app_model) if mozinfo.bits == 64: if mozinfo.os == 'mac': self.bits_model = QStringListModel(['64']) bits_index = 0 else: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.build_type_model = QStringListModel() self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox"))
def __call__(self, parser, namespace, values, option_string=None): for name in FC_REGISTRY.names(): print("%s:" % name) klass = FC_REGISTRY.get(name) for btype in klass.BUILD_TYPES: print(" %s" % btype.replace('-', ',')) parser.exit()
def __call__(self, parser, namespace, values, option_string=None): for name in FC_REGISTRY.names(): print("%s:" % name) klass = FC_REGISTRY.get(name) for btype in klass.BUILD_TYPES: print(" %s" % btype) parser.exit()
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel( REGISTRY.names( lambda klass: not getattr(klass, 'disable_in_gui', None))) self.ui.app_combo.setModel(self.app_model) if mozinfo.bits == 64: if mozinfo.os == 'mac': self.bits_model = QStringListModel(['64']) bits_index = 0 else: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.build_type_model = QStringListModel() self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox")) self.ui.repository.textChanged.connect(self._on_repo_changed) completer = QCompleter(sorted(get_branches()), self) completer.setCaseSensitivity(Qt.CaseInsensitive) self.ui.repository.setCompleter(completer) QApplication.instance().focusChanged.connect(self._on_focus_changed)
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel( REGISTRY.names( lambda klass: not getattr(klass, 'disable_in_gui', None))) self.ui.app_combo.setModel(self.app_model) if mozinfo.bits == 64: if mozinfo.os == 'mac': self.bits_model = QStringListModel(['64']) bits_index = 0 else: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.build_type_model = QStringListModel() self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox")) completer = QCompleter(sorted(get_branches()), self) completer.setCaseSensitivity(Qt.CaseInsensitive) self.ui.repository.setCompleter(completer) QApplication.instance().focusChanged.connect(self._on_focus_changed)
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel(REGISTRY.names()) self.ui.app_combo.setModel(self.app_model) self.bisect_model = QStringListModel() self.ui.bisect_combo.setModel(self.bisect_model) self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self._set_fetch_config(0)
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel(REGISTRY.names()) self.ui.app_combo.setModel(self.app_model) self.bisect_model = QStringListModel() self.ui.bisect_combo.setModel(self.bisect_model) if mozinfo.bits == 64: self.bits_model = QStringListModel(['32', '64']) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(['32']) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex( self.ui.app_combo.findText("firefox"))
def __init__(self): WizardPage.__init__(self) self.fetch_config = None self.app_model = QStringListModel([a for a in REGISTRY.names() if a != "b2g-device"]) self.ui.app_combo.setModel(self.app_model) self.bisect_model = QStringListModel() self.ui.bisect_combo.setModel(self.bisect_model) if mozinfo.bits == 64: if mozinfo.os == "mac": self.bits_model = QStringListModel(["64"]) bits_index = 0 else: self.bits_model = QStringListModel(["32", "64"]) bits_index = 1 elif mozinfo.bits == 32: self.bits_model = QStringListModel(["32"]) bits_index = 0 self.ui.bits_combo.setModel(self.bits_model) self.ui.bits_combo.setCurrentIndex(bits_index) self.ui.app_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.bits_combo.currentIndexChanged.connect(self._set_fetch_config) self.ui.app_combo.setCurrentIndex(self.ui.app_combo.findText("firefox"))
def parse_args(argv=None): """ Parse command line options. """ usage = ("\n" " %(prog)s [OPTIONS]" " [[--bad BAD_DATE]|[--bad-release BAD_RELEASE]]" " [[--good GOOD_DATE]|[--good-release GOOD_RELEASE]]" "\n" " %(prog)s [OPTIONS]" " --inbound --bad-rev BAD_REV --good-rev GOOD_REV") parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="YYYY-MM-DD", dest="bad_date", help=("first known bad nightly build, default is" " today.")) parser.add_argument("-g", "--good", metavar="YYYY-MM-DD", dest="good_date", help="last known good nightly build.") parser.add_argument("--list-releases", action="store_true", help="list all known releases and exit") parser.add_argument("--bad-release", type=int, help=("first known bad nightly build. This option" " is incompatible with --bad.")) parser.add_argument("--good-release", type=int, help=("last known good nightly build. This option is" " incompatible with --good.")) parser.add_argument("--inbound", action="store_true", help=("use inbound instead of nightlies (use" " --good-rev and --bad-rev options.")) parser.add_argument("--bad-rev", dest="first_bad_revision", help=("first known bad revision (use with" " --inbound).")) parser.add_argument("--good-rev", dest="last_good_revision", help=("last known good revision (use with" " --inbound).")) parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", metavar="PATH", help="profile to use with nightlies.") parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default="firefox", help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-beta|...]", help="repository name used for nightly hunting.") parser.add_argument("--inbound-branch", metavar="[b2g-inbound|fx-team|...]", help="inbound branch name on ftp.mozilla.org.") parser.add_argument("--bits", choices=("32", "64"), default=mozinfo.bits, help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %(default)s bits.")) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", help=("the directory in which downloaded files are" " to persist.")) parser.add_argument("--http-cache-dir", help=("the directory for caching http requests." " If not set there will be an in-memory cache" " used.")) parser.add_argument('--http-timeout', type=float, default=10.0, help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) commandline.add_logging_group(parser) options = parser.parse_args(argv) options.bits = parse_bits(options.bits) return options
def create_parser(defaults): """ Create the mozregression command line parser (ArgumentParser instance). """ usage = ("\n" " %(prog)s [OPTIONS]" " [--bad DATE|BUILDID|RELEASE|CHANGESET]" " [--good DATE|BUILDID|RELEASE|CHANGESET]" "\n" " %(prog)s [OPTIONS] --launch DATE|BUILDID|RELEASE|CHANGESET" "\n" " %(prog)s --list-build-types" "\n" " %(prog)s --list-releases" "\n" " %(prog)s --write-conf") parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("first known bad build, default is today." " It can be a date (YYYY-MM-DD), a build id," " a release number or a changeset. If it is" " a changeset, the default branch will be the" " integration branch of the application" " (e.g. mozilla-inbound for firefox), else" " the default release branch for the application" " will be used as the default (e.g" " mozilla-central for firefox).")) parser.add_argument("-g", "--good", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("last known good build. Same possible values" " as the --bad option.")) parser.add_argument("--list-releases", action=ListReleasesAction, help="list all known releases and exit") parser.add_argument("-B", "--build-type", default=defaults["build-type"], help=("Build flavor - should be a comma separated list" " of build options. Note that on nightly, only" " opt is available most of the time. See" " --list-build-types to see available values" ". Defaults to %(default)s.")) parser.add_argument("--list-build-types", action=ListBuildTypesAction, help="List available build types combinations.") parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", default=defaults["profile"], metavar="PATH", help="profile to use with nightlies.") parser.add_argument('--profile-persistence', choices=('clone', 'clone-first', 'reuse'), default=defaults["profile-persistence"], help=("Persistence of the used profile. Before" " each tested build, a profile is used. If" " the value of this option is 'clone', each" " test uses a fresh clone. If the value is" " 'clone-first', the profile is cloned once" " then reused for all builds during the " " bisection. If the value is 'reuse', the given" " profile is directly used. Note that the" " profile might be modified by mozregression." " Defaults to %(default)s.")) parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument('--pref', nargs='*', dest='prefs', help=(" A preference to set. Must be a key-value pair" " separated by a ':'. Note that if your" " preference is of type float, you should" " pass it as a string, e.g.:" " --pref \"layers.low-precision-opacity:'0.0'\"" )) parser.add_argument('--preferences', nargs="*", dest='prefs_files', help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default=defaults["app"], help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-inbound|autoland...]", default=defaults["repo"], help="repository name used for the bisection.") parser.add_argument("--bits", choices=("32", "64"), default=defaults["bits"], help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %s bits." % defaults["bits"] or mozinfo.bits)) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", default=defaults["persist"], help=("the directory in which downloaded files are" " to persist. Defaults to %(default)r.")) parser.add_argument('--persist-size-limit', type=float, default=defaults['persist-size-limit'], help=("Size limit for the persist directory in" " gigabytes (GiB). When the limit is reached," " old builds are removed. 0 means no limit. Note" " that at least 5 build files are kept," " regardless of this value." " Defaults to %(default)s.")) parser.add_argument('--http-timeout', type=float, default=float(defaults['http-timeout']), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) parser.add_argument('--no-background-dl', action='store_false', dest="background_dl", default=(defaults['no-background-dl'].lower() not in ('1', 'yes', 'true')), help=("Do not download next builds in the background" " while evaluating the current build.")) parser.add_argument('--background-dl-policy', choices=('cancel', 'keep'), default=defaults['background-dl-policy'], help=('Policy to use for background downloads.' ' Possible values are "cancel" to cancel all' ' pending background downloads or "keep" to keep' ' downloading them when persist mode is enabled.' ' The default is %(default)s.')) parser.add_argument('--approx-policy', choices=('auto', 'none'), default=defaults['approx-policy'], help=("Policy to reuse approximate persistent builds" " instead of downloading the accurate ones." " When auto, mozregression will try its best to" " reuse the files, meaning that for 7 days of" " bisection range it will try to reuse a build" " which date approximates the build to download" " by one day (before or after). Use none to" " disable this behavior." " Defaults to %(default)s.")) parser.add_argument('--launch', metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("Launch only one specific build. Same possible" " values as the --bad option.")) parser.add_argument('-P', '--process-output', choices=('none', 'stdout'), default=defaults['process-output'], help=("Manage process output logging. Set to stdout by" " default when the build type is not 'opt'.")) parser.add_argument('-M', '--mode', choices=('classic', 'no-first-check'), default=defaults['mode'], help=("bisection mode. 'classic' will check for the" " first good and bad builds to really be good" " and bad, and 'no-first-check' won't. Defaults" " to %(default)s.")) parser.add_argument('--archive-base-url', default=defaults['archive-base-url'], help=("Base url used to find the archived builds." " Defaults to %(default)s")) parser.add_argument('--write-config', action=WriteConfigAction, help="Helps to write the configuration file.") parser.add_argument('--debug', '-d', action='store_true', help='Show the debug output.') return parser
def create_parser(defaults): """ Create the mozregression command line parser (ArgumentParser instance). """ usage = ("\n" " %(prog)s [OPTIONS]" " [--bad DATE|BUILDID|RELEASE|CHANGESET]" " [--good DATE|BUILDID|RELEASE|CHANGESET]" "\n" " %(prog)s [OPTIONS] --launch DATE|BUILDID|RELEASE|CHANGESET" "\n" " %(prog)s --list-build-types" "\n" " %(prog)s --list-releases" "\n" " %(prog)s --write-conf") parser = ArgumentParser(usage=usage) parser.add_argument( "--version", action="version", version=__version__, help=("print the mozregression version number and" " exits."), ) parser.add_argument( "-b", "--bad", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("first known bad build, default is today." " It can be a date (YYYY-MM-DD), a build id," " a release number or a changeset."), ) parser.add_argument( "-g", "--good", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("last known good build. Same possible values" " as the --bad option."), ) parser.add_argument( "--list-releases", action=ListReleasesAction, help="list all known releases and exit", ) parser.add_argument( "-B", "--build-type", default=defaults["build-type"], help=("Build type to use, e.g. opt, debug. " "See --list-build-types for available values. " "Defaults to shippable for desktop Fx, opt for " "everything else."), ) parser.add_argument( "--list-build-types", action=ListBuildTypesAction, help="List available build types combinations.", ) parser.add_argument( "--find-fix", action="store_true", help="Search for a bug fix instead of a regression.", ) parser.add_argument( "-e", "--addon", dest="addons", action="append", default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.", ) parser.add_argument( "-p", "--profile", default=defaults["profile"], metavar="PATH", help="profile to use with nightlies.", ) parser.add_argument( "--adb-profile-dir", dest="adb_profile_dir", default=defaults["adb-profile-dir"], help=("Path to use on android devices for storing" " the profile. Generally you should not need" " to specify this, and an appropriate path" " will be used. Specifying this to a value," " e.g. '/sdcard/tests' will forcibly try to create" " the profile inside that folder."), ) parser.add_argument( "--profile-persistence", choices=("clone", "clone-first", "reuse"), default=defaults["profile-persistence"], help=("Persistence of the used profile. Before" " each tested build, a profile is used. If" " the value of this option is 'clone', each" " test uses a fresh clone. If the value is" " 'clone-first', the profile is cloned once" " then reused for all builds during the " " bisection. If the value is 'reuse', the given" " profile is directly used. Note that the" " profile might be modified by mozregression." " Defaults to %(default)s."), ) parser.add_argument( "-a", "--arg", dest="cmdargs", action="append", default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments." " Use --arg='-option' to pass in options" " starting with `-`."), ) parser.add_argument( "--pref", nargs="*", dest="prefs", help=(" A preference to set. Must be a key-value pair" " separated by a ':'. Note that if your" " preference is of type float, you should" " pass it as a string, e.g.:" " --pref \"layers.low-precision-opacity:'0.0'\""), ) parser.add_argument( "--preferences", nargs="*", dest="prefs_files", help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section."), ) parser.add_argument( "-n", "--app", choices=FC_REGISTRY.names(), default=defaults["app"], help="application name. Default: %(default)s.", ) parser.add_argument( "--lang", metavar="[ar|es-ES|he|ja|zh-CN|...]", help=("build language. Only valid when app is firefox-l10n."), ) parser.add_argument( "--repo", metavar="[autoland|mozilla-beta...]", default=defaults["repo"], help="repository name used for the bisection.", ) parser.add_argument( "--bits", choices=("32", "64"), default=defaults["bits"], help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %s bits." % defaults["bits"] or mozinfo.bits), ) parser.add_argument( "--arch", choices=("arm", "x86_64"), default=None, help=("Force x86_64 build (only applies to GVE app). Default: arm"), ) parser.add_argument( "-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate the build as" " good, and any other value as bad." " Variables like {binary} can be used, which" " will be replaced with their value as retrieved" " by the actual build."), ) parser.add_argument( "--persist", default=defaults["persist"], help=("the directory in which downloaded files are" " to persist. Defaults to %(default)r."), ) parser.add_argument( "--persist-size-limit", type=float, default=defaults["persist-size-limit"], help=("Size limit for the persist directory in" " gigabytes (GiB). When the limit is reached," " old builds are removed. 0 means no limit. Note" " that at least 5 build files are kept," " regardless of this value." " Defaults to %(default)s."), ) parser.add_argument( "--http-timeout", type=float, default=float(defaults["http-timeout"]), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network."), ) parser.add_argument( "--no-background-dl", action="store_false", dest="background_dl", default=(defaults["no-background-dl"].lower() not in ("1", "yes", "true")), help=("Do not download next builds in the background" " while evaluating the current build."), ) parser.add_argument( "--background-dl-policy", choices=("cancel", "keep"), default=defaults["background-dl-policy"], help=("Policy to use for background downloads." ' Possible values are "cancel" to cancel all' ' pending background downloads or "keep" to keep' " downloading them when persist mode is enabled." " The default is %(default)s."), ) parser.add_argument( "--approx-policy", choices=("auto", "none"), default=defaults["approx-policy"], help=("Policy to reuse approximate persistent builds" " instead of downloading the accurate ones." " When auto, mozregression will try its best to" " reuse the files, meaning that for 7 days of" " bisection range it will try to reuse a build" " which date approximates the build to download" " by one day (before or after). Use none to" " disable this behavior." " Defaults to %(default)s."), ) parser.add_argument( "--launch", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("Launch only one specific build. Same possible" " values as the --bad option."), ) parser.add_argument( "-P", "--process-output", choices=("none", "stdout"), default=defaults["process-output"], help=("Manage process output logging. Set to stdout by" " default when the build type is not 'opt'."), ) parser.add_argument( "-M", "--mode", choices=("classic", "no-first-check"), default=defaults["mode"], help=("bisection mode. 'classic' will check for the" " first good and bad builds to really be good" " and bad, and 'no-first-check' won't. Defaults" " to %(default)s."), ) parser.add_argument( "--archive-base-url", default=defaults["archive-base-url"], help=("Base url used to find the archived builds." " Defaults to %(default)s"), ) parser.add_argument( "--write-config", action=WriteConfigAction, help="Helps to write the configuration file.", ) parser.add_argument("--debug", "-d", action="store_true", help="Show the debug output.") return parser
def create_parser(defaults): """ Create the mozregression command line parser (ArgumentParser instance). """ usage = ("\n" " %(prog)s [OPTIONS]" " [--bad DATE|BUILDID|RELEASE|CHANGESET]" " [--good DATE|BUILDID|RELEASE|CHANGESET]" "\n" " %(prog)s [OPTIONS] --launch DATE|BUILDID|RELEASE|CHANGESET" "\n" " %(prog)s --list-build-types" "\n" " %(prog)s --list-releases" "\n" " %(prog)s --write-conf") parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("first known bad build, default is today." " It can be a date (YYYY-MM-DD), a build id," " a release number or a changeset. If it is" " a changeset, the default branch will be the" " integration branch of the application" " (e.g. mozilla-inbound for firefox), else" " the default release branch for the application" " will be used as the default (e.g" " mozilla-central for firefox).")) parser.add_argument("-g", "--good", metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("last known good build. Same possible values" " as the --bad option.")) parser.add_argument("--list-releases", action=ListReleasesAction, help="list all known releases and exit") parser.add_argument("-B", "--build-type", default=defaults["build-type"], help=("Build flavor - should be a comma separated list" " of build options. Note that on nightly, only" " opt is available most of the time. See" " --list-build-types to see available values" ". Defaults to %(default)s.")) parser.add_argument("--list-build-types", action=ListBuildTypesAction, help="List available build types combinations.") parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", default=defaults["profile"], metavar="PATH", help="profile to use with nightlies.") parser.add_argument('--profile-persistence', choices=('clone', 'clone-first', 'reuse'), default=defaults["profile-persistence"], help=("Persistence of the used profile. Before" " each tested build, a profile is used. If" " the value of this option is 'clone', each" " test uses a fresh clone. If the value is" " 'clone-first', the profile is cloned once" " then reused for all builds during the " " bisection. If the value is 'reuse', the given" " profile is directly used. Note that the" " profile might be modified by mozregression." " Defaults to %(default)s.")) parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument('--pref', nargs='*', dest='prefs', help=(" A preference to set. Must be a key-value pair" " separated by a ':'. Note that if your" " preference is of type float, you should" " pass it as a string, e.g.:" " --pref \"layers.low-precision-opacity:'0.0'\"" )) parser.add_argument('--preferences', nargs="*", dest='prefs_files', help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default=defaults["app"], help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-inbound|fx-team...]", default=defaults["repo"], help="repository name used for the bisection.") parser.add_argument("--bits", choices=("32", "64"), default=defaults["bits"], help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %s bits." % defaults["bits"] or mozinfo.bits)) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", default=defaults["persist"], help=("the directory in which downloaded files are" " to persist. Defaults to %(default)r.")) parser.add_argument('--persist-size-limit', type=float, default=defaults['persist-size-limit'], help=("Size limit for the persist directory in" " gigabytes (GiB). When the limit is reached," " old builds are removed. 0 means no limit. Note" " that at least 5 build files are kept," " regardless of this value." " Defaults to %(default)s.")) parser.add_argument('--http-timeout', type=float, default=float(defaults['http-timeout']), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) parser.add_argument('--no-background-dl', action='store_false', dest="background_dl", default=(defaults['no-background-dl'].lower() not in ('1', 'yes', 'true')), help=("Do not download next builds in the background" " while evaluating the current build.")) parser.add_argument('--background-dl-policy', choices=('cancel', 'keep'), default=defaults['background-dl-policy'], help=('Policy to use for background downloads.' ' Possible values are "cancel" to cancel all' ' pending background downloads or "keep" to keep' ' downloading them when persist mode is enabled.' ' The default is %(default)s.')) parser.add_argument('--approx-policy', choices=('auto', 'none'), default=defaults['approx-policy'], help=("Policy to reuse approximate persistent builds" " instead of downloading the accurate ones." " When auto, mozregression will try its best to" " reuse the files, meaning that for 7 days of" " bisection range it will try to reuse a build" " which date approximates the build to download" " by one day (before or after). Use none to" " disable this behavior." " Defaults to %(default)s.")) parser.add_argument('--launch', metavar="DATE|BUILDID|RELEASE|CHANGESET", help=("Launch only one specific build. Same possible" " values as the --bad option.")) parser.add_argument('-P', '--process-output', choices=('none', 'stdout'), default=defaults['process-output'], help=("Manage process output logging. Set to stdout by" " default when the build type is not 'opt'.")) parser.add_argument('-M', '--mode', choices=('classic', 'no-first-check'), default=defaults['mode'], help=("bisection mode. 'classic' will check for the" " first good and bad builds to really be good" " and bad, and 'no-first-check' won't. Defaults" " to %(default)s.")) parser.add_argument('--archive-base-url', default=defaults['archive-base-url'], help=("Base url used to find the archived builds." " Defaults to %(default)s")) parser.add_argument('--write-config', action=WriteConfigAction, help="Helps to write the configuration file.") parser.add_argument('--debug', '-d', action='store_true', help='Show the debug output.') return parser
def create_parser(defaults): """ Create the mozregression command line parser (ArgumentParser instance). """ usage = ("\n" " %(prog)s [OPTIONS]" " [[--bad BAD_DATE]|[--bad-release BAD_RELEASE]]" " [[--good GOOD_DATE]|[--good-release GOOD_RELEASE]]" "\n" " %(prog)s [OPTIONS]" " --bad-rev BAD_REV --good-rev GOOD_REV" "\n" " %(prog)s [OPTIONS] --launch DATE_OR_REV" "\n" " %(prog)s --list-build-types" "\n" " %(prog)s --list-releases" "\n" " %(prog)s --write-conf") parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="YYYY-MM-DD", dest="bad_date", help=("first known bad nightly build, default is" " today.")) parser.add_argument("-g", "--good", metavar="YYYY-MM-DD", dest="good_date", help="last known good nightly build.") parser.add_argument("--list-releases", action=ListReleasesAction, help="list all known releases and exit") parser.add_argument("--bad-release", type=int, help=("first known bad nightly build. This option" " is incompatible with --bad.")) parser.add_argument("--good-release", type=int, help=("last known good nightly build. This option is" " incompatible with --good.")) parser.add_argument("--bad-rev", dest="first_bad_revision", help=("first known bad revision (for inbound" " bisection).")) parser.add_argument("--good-rev", dest="last_good_revision", help=("last known good revision (for inbound" " bisection).")) parser.add_argument("-B", "--build-type", default=defaults["build-type"], help=("Build flavor - should be a comma separated list" " of build options. Note that on nightly, only" " opt is available most of the time. See" " --list-build-types to see available values" ". Defaults to %(default)s.")) parser.add_argument("--list-build-types", action=ListBuildTypesAction, help="List available build types combinations.") parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", default=defaults["profile"], metavar="PATH", help="profile to use with nightlies.") parser.add_argument('--profile-persistence', choices=('clone', 'clone-first', 'reuse'), default=defaults["profile-persistence"], help=("Persistence of the used profile. Before" " each tested build, a profile is used. If" " the value of this option is 'clone', each" " test uses a fresh clone. If the value is" " 'clone-first', the profile is cloned once" " then reused for all builds during the " " bisection. If the value is 'reuse', the given" " profile is directly used. Note that the" " profile might be modified by mozregression." " Defaults to %(default)s.")) parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument('--pref', nargs='*', dest='prefs', help=(" A preference to set. Must be a key-value pair" " separated by a ':'. Note that if your" " preference is of type float, you should" " pass it as a string, e.g.:" " --pref \"layers.low-precision-opacity:'0.0'\"" )) parser.add_argument('--preferences', nargs="*", dest='prefs_files', help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default=defaults["app"], help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-beta|...]", default=defaults["repo"], help="repository name used for nightly hunting.") parser.add_argument("--inbound-branch", metavar="[b2g-inbound|fx-team|...]", default=defaults["inbound-branch"], help="inbound branch name on archive.mozilla.org.") parser.add_argument("--bits", choices=("32", "64"), default=defaults["bits"], help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %s bits." % defaults["bits"] or mozinfo.bits)) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", default=defaults["persist"], help=("the directory in which downloaded files are" " to persist. Defaults to %(default)r.")) parser.add_argument('--persist-size-limit', type=float, default=defaults['persist-size-limit'], help=("Size limit for the persist directory in" " gigabytes (GiB). When the limit is reached," " old builds are removed. 0 means no limit. Note" " that at least 5 build files are kept," " regardless of this value." " Defaults to %(default)s.")) parser.add_argument('--http-timeout', type=float, default=float(defaults['http-timeout']), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) parser.add_argument('--no-background-dl', action='store_false', dest="background_dl", default=(defaults['no-background-dl'].lower() not in ('1', 'yes', 'true')), help=("Do not download next builds in the background" " while evaluating the current build.")) parser.add_argument('--background-dl-policy', choices=('cancel', 'keep'), default=defaults['background-dl-policy'], help=('Policy to use for background downloads.' ' Possible values are "cancel" to cancel all' ' pending background downloads or "keep" to keep' ' downloading them when persist mode is enabled.' ' The default is %(default)s.')) parser.add_argument('--launch', metavar="DATE_OR_REV", help="Launch only one specific build by date (nightly)" " or changeset (inbound). You can also launch a" " release using a specific release number.") parser.add_argument('--write-config', action=WriteConfigAction, help="Helps to write the configuration file.") commandline.add_logging_group( parser, include_formatters=commandline.TEXT_FORMATTERS ) return parser
def parse_args(argv=None): """ Parse command line options. """ usage = ("\n" " %(prog)s [OPTIONS]" " [[--bad BAD_DATE]|[--bad-release BAD_RELEASE]]" " [[--good GOOD_DATE]|[--good-release GOOD_RELEASE]]" "\n" " %(prog)s [OPTIONS]" " --bad-rev BAD_REV --good-rev GOOD_REV") defaults = get_defaults(DEFAULT_CONF_FNAME) parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="YYYY-MM-DD", dest="bad_date", help=("first known bad nightly build, default is" " today.")) parser.add_argument("-g", "--good", metavar="YYYY-MM-DD", dest="good_date", help="last known good nightly build.") parser.add_argument("--list-releases", action="store_true", help="list all known releases and exit") parser.add_argument("--bad-release", type=int, help=("first known bad nightly build. This option" " is incompatible with --bad.")) parser.add_argument("--good-release", type=int, help=("last known good nightly build. This option is" " incompatible with --good.")) parser.add_argument("--bad-rev", dest="first_bad_revision", help=("first known bad revision (for inbound" " bisection).")) parser.add_argument("--good-rev", dest="last_good_revision", help=("last known good revision (for inbound" " bisection).")) parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", default=defaults.get("profile"), metavar="PATH", help="profile to use with nightlies.") parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument('--pref', nargs='*', dest='prefs', help=(" A preference to set. Must be a key-value pair" " separated by a ':'")) parser.add_argument('--preferences', nargs="*", dest='prefs_files', help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default=defaults.get("app", "firefox"), help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-beta|...]", default=defaults.get("repo"), help="repository name used for nightly hunting.") parser.add_argument("--inbound-branch", metavar="[b2g-inbound|fx-team|...]", default=defaults.get("inbound-branch"), help="inbound branch name on ftp.mozilla.org.") parser.add_argument("--bits", choices=("32", "64"), default=defaults.get("bits", mozinfo.bits), help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %(default)s bits.")) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", default=defaults.get("persist"), help=("the directory in which downloaded files are" " to persist.")) parser.add_argument("--http-cache-dir", default=defaults.get("http-cache-dir"), help=("the directory for caching http requests." " If not set there will be an in-memory cache" " used.")) parser.add_argument('--http-timeout', type=float, default=float(defaults.get("http-timeout", 30.0)), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) parser.add_argument('--no-background-dl', action='store_false', dest="background_dl", default=(defaults.get('no-background-dl', '').lower() not in ('1', 'yes', 'true')), help=("Do not download next builds in the background" " while evaluating the current build.")) commandline.add_logging_group( parser, include_formatters=commandline.TEXT_FORMATTERS) options = parser.parse_args(argv) options.bits = parse_bits(options.bits) return options
def parse_args(argv=None): """ Parse command line options. """ usage = ("\n" " %(prog)s [OPTIONS]" " [[--bad BAD_DATE]|[--bad-release BAD_RELEASE]]" " [[--good GOOD_DATE]|[--good-release GOOD_RELEASE]]" "\n" " %(prog)s [OPTIONS]" " --bad-rev BAD_REV --good-rev GOOD_REV") defaults = get_defaults(DEFAULT_CONF_FNAME) parser = ArgumentParser(usage=usage) parser.add_argument("--version", action="version", version=__version__, help=("print the mozregression version number and" " exits.")) parser.add_argument("-b", "--bad", metavar="YYYY-MM-DD", dest="bad_date", help=("first known bad nightly build, default is" " today.")) parser.add_argument("-g", "--good", metavar="YYYY-MM-DD", dest="good_date", help="last known good nightly build.") parser.add_argument("--list-releases", action="store_true", help="list all known releases and exit") parser.add_argument("--bad-release", type=int, help=("first known bad nightly build. This option" " is incompatible with --bad.")) parser.add_argument("--good-release", type=int, help=("last known good nightly build. This option is" " incompatible with --good.")) parser.add_argument("--bad-rev", dest="first_bad_revision", help=("first known bad revision (for inbound" " bisection).")) parser.add_argument("--good-rev", dest="last_good_revision", help=("last known good revision (for inbound" " bisection).")) parser.add_argument("--find-fix", action="store_true", help="Search for a bug fix instead of a regression.") parser.add_argument("-e", "--addon", dest="addons", action='append', default=[], metavar="PATH1", help="addon to install; repeat for multiple addons.") parser.add_argument("-p", "--profile", default=defaults.get("profile"), metavar="PATH", help="profile to use with nightlies.") parser.add_argument("-a", "--arg", dest="cmdargs", action='append', default=[], metavar="ARG1", help=("a command-line argument to pass to the" " application; repeat for multiple arguments.")) parser.add_argument('--pref', nargs='*', dest='prefs', help=(" A preference to set. Must be a key-value pair" " separated by a ':'")) parser.add_argument('--preferences', nargs="*", dest='prefs_files', help=("read preferences from a JSON or INI file. For" " INI, use 'file.ini:section' to specify a" " particular section.")) parser.add_argument("-n", "--app", choices=FC_REGISTRY.names(), default=defaults.get("app", "firefox"), help="application name. Default: %(default)s.") parser.add_argument("--repo", metavar="[mozilla-aurora|mozilla-beta|...]", default=defaults.get("repo"), help="repository name used for nightly hunting.") parser.add_argument("--inbound-branch", metavar="[b2g-inbound|fx-team|...]", default=defaults.get("inbound-branch"), help="inbound branch name on ftp.mozilla.org.") parser.add_argument("--bits", choices=("32", "64"), default=defaults.get("bits", mozinfo.bits), help=("force 32 or 64 bit version (only applies to" " x86_64 boxes). Default: %(default)s bits.")) parser.add_argument("-c", "--command", help=("Test command to evaluate builds automatically." " A return code of 0 will evaluate build as" " good, any other value will evaluate the build" " as bad.")) parser.add_argument("--persist", default=defaults.get("persist"), help=("the directory in which downloaded files are" " to persist.")) parser.add_argument("--http-cache-dir", default=defaults.get("http-cache-dir"), help=("the directory for caching http requests." " If not set there will be an in-memory cache" " used.")) parser.add_argument('--http-timeout', type=float, default=float(defaults.get("http-timeout", 30.0)), help=("Timeout in seconds to abort requests when there" " is no activity from the server. Default to" " %(default)s seconds - increase this if you" " are under a really slow network.")) parser.add_argument('--no-background-dl', action='store_false', dest="background_dl", default=(defaults.get('no-background-dl', '').lower() not in ('1', 'yes', 'true')), help=("Do not download next builds in the background" " while evaluating the current build.")) commandline.add_logging_group( parser, include_formatters=commandline.TEXT_FORMATTERS ) options = parser.parse_args(argv) options.bits = parse_bits(options.bits) return options