Exemplo n.º 1
0
def get_sync_config():
    import laniakea.native
    from laniakea.native import SyncSourceSuite, create_native_baseconfig

    lconf = LocalConfig()
    bconf = create_native_baseconfig()

    with session_scope() as session:
        sync_sources = session.query(SynchrotronSource).all()

        # FIXME: SynchrotronConfig needs adjustments in the D code to work
        # better with the new "multiple autosync tasks" model.
        # Maybe when doing this there's a good opportunity to rewrite some of
        # the D code in Python...
        sconf = laniakea.native.SynchrotronConfig()
        sconf.sourceName = sync_sources[0].os_name
        sconf.syncBinaries = False
        sconf.sourceKeyrings = lconf.synchrotron_sourcekeyrings

        sconf.source.defaultSuite = None
        sconf.source.repoUrl = sync_sources[0].repo_url

        source_suites = []
        for sd in sync_sources:
            sssuite = SyncSourceSuite()
            sssuite.name = sd.suite_name
            sssuite.architectures = sd.architectures
            sssuite.components = sd.components

            source_suites.append(sssuite)
        sconf.source.suites = source_suites

    return bconf, sconf
Exemplo n.º 2
0
def _create_debcheck(session, suite_name):
    from laniakea.native import Debcheck, create_native_baseconfig, \
        get_suiteinfo_all_suites, get_suiteinfo_for_suite

    bconf = create_native_baseconfig()

    scan_suites = []
    if suite_name:
        # we only scan a specific suite
        suite = session.query(ArchiveSuite) \
            .filter(ArchiveSuite.name == suite_name).one()
        scan_suites = [get_suiteinfo_for_suite(suite)]
    else:
        scan_suites = get_suiteinfo_all_suites()

    return Debcheck(bconf), scan_suites
Exemplo n.º 3
0
def get_spears_config():
    from laniakea.native import SpearsHint as LknSpearsHint
    from laniakea.native import create_native_baseconfig, get_suiteinfo_all_suites, \
        SpearsConfig, SpearsConfigEntry, int_to_versionpriority
    from laniakea.localconfig import ExternalToolsUrls

    bconf = create_native_baseconfig()

    ext_urls = ExternalToolsUrls()
    sconf = SpearsConfig()
    sconf.britneyGitOriginUrl = ext_urls.britney_git_repository

    session = session_factory()
    migration_entries = session.query(SpearsMigrationEntry).all()
    mdict = {}
    for entry in migration_entries:
        centry = SpearsConfigEntry()
        centry.sourceSuites = entry.source_suites
        centry.targetSuite = entry.target_suite

        d = {}
        for k, v in entry.delays.items():
            d[int_to_versionpriority(int(k))] = int(v)
        centry.delays = d

        hints = session.query(SpearsHint).filter(
            SpearsHint.migration_id == entry.idname).all()
        chints = []
        for hint in hints:
            chint = LknSpearsHint()
            chint.hint = hint.hint
            chint.reason = hint.reason
            chint.date = hint.time
            chints.append(chint)
        centry.hints = chints

        mdict[entry.idname] = centry
    sconf.migrations = mdict

    suites = get_suiteinfo_all_suites()

    return bconf, sconf, suites