def validateOptions(options, args):
    errs = ""
    for a in REQUIRED_OPTIONS:
        if not getattr(options, a, None):
            errs += "%s is a required option\n" % a
    if not options.platforms:
        errs += "at least one platform must be provided\n"
    else:
        for p in options.platforms:
            supportedPlatforms = getSupportedPlatforms()
            if not p in supportedPlatforms:
                errs += "%s is not a supported platform\n" % p
    if options.buildNumber < 2:
        errs += "build number must be >= 2\n"
    if errs != "":
        log.error(errs)
        sys.exit(1)
def validateOptions(options, args):
    errs = ""
    for a in REQUIRED_OPTIONS:
        if not getattr(options, a, None):
            errs += "%s is a required option\n" % a
    if not options.platforms:
        errs += "at least one platform must be provided\n"
    else:
        for p in options.platforms:
            supportedPlatforms = getSupportedPlatforms()
            if not p in supportedPlatforms:
                errs += "%s is not a supported platform\n" % p
    if options.buildNumber < 2:
        errs += "build number must be >= 2\n"
    if errs != "":
        log.error(errs)
        sys.exit(1)
from release.info import findOldBuildIDs, getBuildID
from release.l10n import getShippedLocales, getCommonLocales
from release.platforms import buildbot2updatePlatforms, getPlatformLocales, \
  getSupportedPlatforms

logging.basicConfig(stream=sys.stdout,
                    level=logging.INFO,
                    format="%(message)s")
log = logging.getLogger(__name__)

REQUIRED_OPTIONS = ('brandName', 'product', 'appName', 'version', 'appVersion',
                    'oldVersion', 'oldAppVersion', 'buildNumber',
                    'oldBuildNumber', 'platforms', 'oldBaseSnippetDir',
                    'sourceRepo', 'workdir', 'hg')
DEFAULT_CHANNELS = ('beta', 'betatest')
DEFAULT_PLATFORMS = getSupportedPlatforms()
DEFAULT_STAGE_SERVER = 'stage.mozilla.org'
DEFAULT_HG_SERVER = 'http://hg.mozilla.org'


def getSnippetDirname(oldBaseSnippetDir, channel):
    if channel == 'release':
        ausdir = 'aus2'
    elif channel.find('test') != -1:
        ausdir = 'aus2.test'
    elif channel == 'beta':
        # ASSUMPTION: If aus2.beta doesn't exist we must be working on an
        # alpha or beta release, in which case the snippets live in 'aus2'.
        ausdir = 'aus2.beta'
        if not os.path.isdir(os.path.join(oldBaseSnippetDir, ausdir)):
            ausdir = 'aus2'
from release.info import findOldBuildIDs, getBuildID
from release.l10n import getShippedLocales, getCommonLocales
from release.platforms import buildbot2updatePlatforms, getPlatformLocales, \
    getSupportedPlatforms

logging.basicConfig(
    stream=sys.stdout, level=logging.INFO, format="%(message)s")
log = logging.getLogger(__name__)

REQUIRED_OPTIONS = ('brandName', 'product', 'appName', 'version', 'appVersion',
                    'oldVersion', 'oldAppVersion', 'buildNumber',
                    'oldBuildNumber', 'platforms', 'oldBaseSnippetDir',
                    'sourceRepo', 'workdir', 'hg')
DEFAULT_CHANNELS = ('beta', 'betatest')
DEFAULT_PLATFORMS = getSupportedPlatforms()
DEFAULT_STAGE_SERVER = 'stage.mozilla.org'
DEFAULT_HG_SERVER = 'https://hg.mozilla.org'


def getSnippetDirname(oldBaseSnippetDir, channel):
    if channel in ('release', 'esr'):
        ausdir = 'aus2'
    elif channel.find('test') != -1:
        ausdir = 'aus2.test'
    elif channel == 'beta':
        # ASSUMPTION: If aus2.beta doesn't exist we must be working on an
        # alpha or beta release, in which case the snippets live in 'aus2'.
        ausdir = 'aus2.beta'
        if not os.path.isdir(os.path.join(oldBaseSnippetDir, ausdir)):
            ausdir = 'aus2'