<commit_before>from buildbot.plugins import buildslave, changes, schedulers, util
from buildbot.status import html, status_push, web, words

import environments as envs
import factories
from passwords import HTTP_USERNAME, HTTP_PASSWORD
from passwords import SLAVE_PASSWORD, CHANGE_PASSWORD
from passwords import HOMU_BUILDBOT_SECRET


LINUX_SLAVES = ["servo-linux1", "servo-linux2", "servo-linux3"]
MAC_SLAVES = ["servo-mac1", "servo-mac2", "servo-mac3", "servo-macpro1"]
CROSS_SLAVES = ["servo-linux-cross1", "servo-linux-cross2"]
WINDOWS_SLAVES = ["servo-windows1"]


c = BuildmasterConfig = {}
c['protocols'] = {'pb': {'port': 9001}}
c['caches'] = {
    'Changes': 1000,
    'Builds': 100,
    'chdicts': 1000,
}


##################
# BUILDSLAVES
##################


c['slaves'] = []
for s in MAC_SLAVES + CROSS_SLAVES + LINUX_SLAVES + WINDOWS_SLAVES:
    c['slaves'].append(buildslave.BuildSlave(s, SLAVE_PASSWORD, max_builds=1))


##################
# CHANGESOURCES
##################


c['change_source'] = [changes.PBChangeSource(passwd=CHANGE_PASSWORD)]


##################
# SCHEDULERS
##################


def servo_auto_try_filter(c):
    return (c.project == 'servo/servo' and
            c.who.startswith('bors-servo') and
            c.branch in ["auto", "try"])


def servo_master_filter(c):
    return (c.project == 'servo/servo' and
            c.who.startswith('bors-servo') and
            c.branch == "master")


c['schedulers'] = []
c['schedulers'].append(schedulers.AnyBranchScheduler(
    name="servo-auto",
    treeStableTimer=None,
    builderNames=[
        "android",
        "arm32",
        "arm64",
        "linux-dev",
        "linux-dev-yaml",
        "linux-rel",
        "mac-dev-unit",
        "mac-rel-css",
        "mac-rel-wpt",
        "windows",
    ],
    change_filter=util.ChangeFilter(filter_fn=servo_auto_try_filter),
))
c['schedulers'].append(schedulers.SingleBranchScheduler(
    name="doc-push",
    treeStableTimer=None,
    builderNames=["doc"],
    change_filter=util.ChangeFilter(filter_fn=servo_master_filter),
))
c['schedulers'].append(schedulers.ForceScheduler(
    name="force",
    builderNames=[
        "android",
        "android-nightly",
        "arm32",
        "arm64",
        "linux-dev",
        "linux-dev-yaml",
        "linux-nightly",
        "linux-rel",
        "mac-dev-unit",
        "mac-nightly",
        "mac-rel-css",
        "mac-rel-wpt",
        "windows",
        "windows-nightly",
    ],
))
c['schedulers'].append(schedulers.Nightly(
    name="Nightly",
    branch="master",
    builderNames=[
        "android-nightly",
        "linux-nightly",
        "mac-nightly",
        "windows-nightly",
    ],
    hour=1,
    minute=0,
))


##################
# BUILDERS
##################


def branch_priority(builder, requests):
    for r in requests:
        if r.source.branch != "try":
            return r
    return requests[0]


class DynamicServoBuilder(util.BuilderConfig):
    """
    Builder which uses DynamicServoFactory to run steps from a yaml file.
    """
    def __init__(self, name, slavenames, environment):
        # util.BuilderConfig is an old-style class so we cannot use super()
        # but must hardcode the superclass here
        util.BuilderConfig.__init__(
            self,
            name=name,
            slavenames=slavenames,
            factory=factories.DynamicServoFactory(name, environment),
            nextBuild=branch_priority,
            category="auto",
        )


class DynamicServoYAMLBuilder(util.BuilderConfig):
    """
    Builder which uses DynamicServoYAMLFactory to run steps from a
    yaml file in the Servo source tree.
    """
    def __init__(self, name, slavenames, environment):
        # util.BuilderConfig is an old-style class so we cannot use super()
        # but must hardcode the superclass here
        util.BuilderConfig.__init__(
            self,
            name=name,
            slavenames=slavenames,
            factory=factories.DynamicServoYAMLFactory(name, environment),
            nextBuild=branch_priority,
            category="auto",
        )

c['builders'] = [
    DynamicServoBuilder("android", CROSS_SLAVES, envs.build_android),
    DynamicServoBuilder("android-nightly", CROSS_SLAVES, envs.build_android),
    DynamicServoBuilder("arm32", CROSS_SLAVES, envs.build_arm32),
    DynamicServoBuilder("arm64", CROSS_SLAVES, envs.build_arm64),
    DynamicServoBuilder("linux-dev", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("linux-nightly", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("linux-rel", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("mac-dev-unit", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-nightly", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-rel-css", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-rel-wpt", MAC_SLAVES, envs.build_mac),
    # The below builders are not dynamic but rather have hard-coded factories
    util.BuilderConfig(
        name="windows",
        slavenames=WINDOWS_SLAVES,
        factory=factories.windows,
        nextBuild=branch_priority,
        category="auto",
    ),
    util.BuilderConfig(
        name="windows-nightly",
        slavenames=WINDOWS_SLAVES,
        factory=factories.windows_nightly,
        nextBuild=branch_priority,
        category="auto",
    ),
    util.BuilderConfig(
        name="doc",
        slavenames=LINUX_SLAVES,
        factory=factories.doc,
        category="auto",
    ),
    # Testing the In Tree YAML build
    DynamicServoYAMLBuilder("linux-dev-yaml", LINUX_SLAVES,
                            envs.build_linux)
]


##################
# STATUS TARGETS
##################


c['status'] = []
c['status'].append(status_push.HttpStatusPush(
    serverUrl='http://build.servo.org:54856/buildbot',
    extra_post_params={'secret': HOMU_BUILDBOT_SECRET},
))

authz_cfg = web.authz.Authz(
    auth=web.auth.BasicAuth([(HTTP_USERNAME, HTTP_PASSWORD)]),
    gracefulShutdown='auth',
    forceBuild='auth',
    forceAllBuilds='auth',<commit_msg>Auto merge of #419 - this-jacob:remove_buildbot_categories, r=aneeshusa<commit_after>from buildbot.plugins import buildslave, changes, schedulers, util
from buildbot.status import html, status_push, web, words

import environments as envs
import factories
from passwords import HTTP_USERNAME, HTTP_PASSWORD
from passwords import SLAVE_PASSWORD, CHANGE_PASSWORD
from passwords import HOMU_BUILDBOT_SECRET


LINUX_SLAVES = ["servo-linux1", "servo-linux2", "servo-linux3"]
MAC_SLAVES = ["servo-mac1", "servo-mac2", "servo-mac3", "servo-macpro1"]
CROSS_SLAVES = ["servo-linux-cross1", "servo-linux-cross2"]
WINDOWS_SLAVES = ["servo-windows1"]


c = BuildmasterConfig = {}
c['protocols'] = {'pb': {'port': 9001}}
c['caches'] = {
    'Changes': 1000,
    'Builds': 100,
    'chdicts': 1000,
}


##################
# BUILDSLAVES
##################


c['slaves'] = []
for s in MAC_SLAVES + CROSS_SLAVES + LINUX_SLAVES + WINDOWS_SLAVES:
    c['slaves'].append(buildslave.BuildSlave(s, SLAVE_PASSWORD, max_builds=1))


##################
# CHANGESOURCES
##################


c['change_source'] = [changes.PBChangeSource(passwd=CHANGE_PASSWORD)]


##################
# SCHEDULERS
##################


def servo_auto_try_filter(c):
    return (c.project == 'servo/servo' and
            c.who.startswith('bors-servo') and
            c.branch in ["auto", "try"])


def servo_master_filter(c):
    return (c.project == 'servo/servo' and
            c.who.startswith('bors-servo') and
            c.branch == "master")


c['schedulers'] = []
c['schedulers'].append(schedulers.AnyBranchScheduler(
    name="servo-auto",
    treeStableTimer=None,
    builderNames=[
        "android",
        "arm32",
        "arm64",
        "linux-dev",
        "linux-dev-yaml",
        "linux-rel",
        "mac-dev-unit",
        "mac-rel-css",
        "mac-rel-wpt",
        "windows",
    ],
    change_filter=util.ChangeFilter(filter_fn=servo_auto_try_filter),
))
c['schedulers'].append(schedulers.SingleBranchScheduler(
    name="doc-push",
    treeStableTimer=None,
    builderNames=["doc"],
    change_filter=util.ChangeFilter(filter_fn=servo_master_filter),
))
c['schedulers'].append(schedulers.ForceScheduler(
    name="force",
    builderNames=[
        "android",
        "android-nightly",
        "arm32",
        "arm64",
        "linux-dev",
        "linux-dev-yaml",
        "linux-nightly",
        "linux-rel",
        "mac-dev-unit",
        "mac-nightly",
        "mac-rel-css",
        "mac-rel-wpt",
        "windows",
        "windows-nightly",
    ],
))
c['schedulers'].append(schedulers.Nightly(
    name="Nightly",
    branch="master",
    builderNames=[
        "android-nightly",
        "linux-nightly",
        "mac-nightly",
        "windows-nightly",
    ],
    hour=1,
    minute=0,
))


##################
# BUILDERS
##################


def branch_priority(builder, requests):
    for r in requests:
        if r.source.branch != "try":
            return r
    return requests[0]


class DynamicServoBuilder(util.BuilderConfig):
    """
    Builder which uses DynamicServoFactory to run steps from a yaml file.
    """
    def __init__(self, name, slavenames, environment):
        # util.BuilderConfig is an old-style class so we cannot use super()
        # but must hardcode the superclass here
        util.BuilderConfig.__init__(
            self,
            name=name,
            slavenames=slavenames,
            factory=factories.DynamicServoFactory(name, environment),
            nextBuild=branch_priority,
        )


class DynamicServoYAMLBuilder(util.BuilderConfig):
    """
    Builder which uses DynamicServoYAMLFactory to run steps from a
    yaml file in the Servo source tree.
    """
    def __init__(self, name, slavenames, environment):
        # util.BuilderConfig is an old-style class so we cannot use super()
        # but must hardcode the superclass here
        util.BuilderConfig.__init__(
            self,
            name=name,
            slavenames=slavenames,
            factory=factories.DynamicServoYAMLFactory(name, environment),
            nextBuild=branch_priority,
        )

c['builders'] = [
    DynamicServoBuilder("android", CROSS_SLAVES, envs.build_android),
    DynamicServoBuilder("android-nightly", CROSS_SLAVES, envs.build_android),
    DynamicServoBuilder("arm32", CROSS_SLAVES, envs.build_arm32),
    DynamicServoBuilder("arm64", CROSS_SLAVES, envs.build_arm64),
    DynamicServoBuilder("linux-dev", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("linux-nightly", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("linux-rel", LINUX_SLAVES, envs.build_linux),
    DynamicServoBuilder("mac-dev-unit", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-nightly", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-rel-css", MAC_SLAVES, envs.build_mac),
    DynamicServoBuilder("mac-rel-wpt", MAC_SLAVES, envs.build_mac),
    # The below builders are not dynamic but rather have hard-coded factories
    util.BuilderConfig(
        name="windows",
        slavenames=WINDOWS_SLAVES,
        factory=factories.windows,
        nextBuild=branch_priority,
    ),
    util.BuilderConfig(
        name="windows-nightly",
        slavenames=WINDOWS_SLAVES,
        factory=factories.windows_nightly,
        nextBuild=branch_priority,
    ),
    util.BuilderConfig(
        name="doc",
        slavenames=LINUX_SLAVES,
        factory=factories.doc,
    ),
    # Testing the In Tree YAML build
    DynamicServoYAMLBuilder("linux-dev-yaml", LINUX_SLAVES,
                            envs.build_linux)
]


##################
# STATUS TARGETS
##################


c['status'] = []
c['status'].append(status_push.HttpStatusPush(
    serverUrl='http://build.servo.org:54856/buildbot',
    extra_post_params={'secret': HOMU_BUILDBOT_SECRET},
))

authz_cfg = web.authz.Authz(
    auth=web.auth.BasicAuth([(HTTP_USERNAME, HTTP_PASSWORD)]),
    gracefulShutdown='auth',
    forceBuild='auth',
    forceAllBuilds='auth',
{'fraction_non_alphanumeric': 0.15245670726655067, 'fraction_numerical': 0.008534261330681912, 'mean_word_length': 3.2261904761904763, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3733325', 'n_tokens_mistral': 4088, 'n_tokens_neox': 3983, 'n_words': 675}