def main():
    global Logger, Options, sections, priorities

    cnf = Config()

    Arguments = [('h', "help", "Check-Overrides::Options::Help"),
                 ('n', "no-action", "Check-Overrides::Options::No-Action")]
    for i in ["help", "no-action"]:
        key = "Check-Overrides::Options::%s" % i
        if key not in cnf:
            cnf[key] = ""
    apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
    Options = cnf.subtree("Check-Overrides::Options")

    if Options["Help"]:
        usage()

    session = DBConn().session()

    # init sections, priorities:

    # We need forward and reverse
    sections = get_sections(session)
    for name, entry in list(sections.items()):
        sections[entry] = name

    priorities = get_priorities(session)
    for name, entry in list(priorities.items()):
        priorities[entry] = name

    if not Options["No-Action"]:
        Logger = daklog.Logger("check-overrides")
    else:
        Logger = daklog.Logger("check-overrides", 1)

    for suite in session.query(Suite).filter(Suite.overrideprocess == True):  # noqa:E712
        originosuite = None
        originremark = ''

        if suite.overrideorigin is not None:
            originosuite = get_suite(suite.overrideorigin, session)
            if originosuite is None:
                utils.fubar("%s has an override origin suite of %s but it doesn't exist!" % (suite.suite_name, suite.overrideorigin))
            originosuite = originosuite.suite_name
            originremark = " taking missing from %s" % originosuite

        print("Processing %s%s..." % (suite.suite_name, originremark))

        # Get a list of all suites that use the override file of 'suite.suite_name' as
        # well as the suite
        ocodename = suite.codename
        suiteids = [x.suite_id for x in session.query(Suite).filter(Suite.overridecodename == ocodename).all()]
        if suite.suite_id not in suiteids:
            suiteids.append(suite.suite_id)

        if len(suiteids) < 1:
            utils.fubar("Couldn't find id's of all suites: %s" % suiteids)

        for component in session.query(Component).all():
            # It is crucial for the dsc override creation based on binary
            # overrides that 'dsc' goes first
            component_name = component.component_name
            otypes = ['dsc']
            for ot in session.query(OverrideType):
                if ot.overridetype == 'dsc':
                    continue
                otypes.append(ot.overridetype)

            for otype in otypes:
                print("Processing %s [%s - %s]"
                    % (suite.suite_name, component_name, otype))
                sys.stdout.flush()
                process(suite.suite_name, suiteids, originosuite, component_name, otype, session)

    Logger.close()