# -*- python -*-
# ex: set syntax=python:

from buildbot_config.config.master import options
from buildbot_config.master import (
    get_builders,
    get_change_sources,
    get_schedulers,
    get_slaves_from_config,
    get_status)

# This is the special key that Buildbot looks for. We use
# an alias to ``c`` to save us a lot of typing.
c = BuildmasterConfig = {}

#----------------------------------------------------------------------
# Project Identity and Basic Configuration
#----------------------------------------------------------------------
# Title and URL of project
c['title'] = options.title
c['titleURL'] = options.title_url

# URL to the actual buildbot installation
c['buildbotURL'] = options.buildbot_url

# This specifies what database buildbot uses to store change and scheduler
# state.  You can leave this at its default for all but the largest
# installations.
c['db_url'] = "sqlite:///state.sqlite"

#----------------------------------------------------------------------
# Data Storage and Caching
#----------------------------------------------------------------------
# Time horizons. These specify the number of items that are kept
# persisted on disk before being pruned away. See the buildbot
# documentation for more information on each horizon setting.
c['changeHorizon'] = 0
c['buildHorizon'] = 0
c['eventHorizon'] = 0
c['logHorizon'] = 0

# Cache sizes. These are the number of the respective objects to
# hold in memory while buildbot is running. By default buildbot
# only stores 1, so all the numbers are greatly increased.
c['caches'] = {
    'Changes' : 100,
    'chdicts' : 100,
    'BuildRequests' : 10,
    'SourceStamps' : 20,
    'ssdicts' : 20,
    'objectids' : 10,
    'usdicts' : 100,
}
c['buildCacheSize'] = 500

#----------------------------------------------------------------------
# Build Slaves
#----------------------------------------------------------------------
# The port that the buildmaster listens for buildslaves on.
c['slavePortnum'] = 9989

# The actual list of slave machines we have.
c['slaves'] = get_slaves_from_config(options.slaves)
c['status'] = get_status(options)
c['builders'] = get_builders(c['slaves'])
c['schedulers'] = get_schedulers(c['builders'])
c['change_source'] = get_change_sources()