def main():
    bot = getBot(Bot, None)
    helper = bot._updater._conaryhelper

    log.info("Collecting RPM list")
    rpmBins = set()
    for name, verDict in helper._getLatestTroves().iteritems():
        if not name.endswith(':rpm'):
            continue
        for version, flavors in verDict.iteritems():
            for flavor in flavors:
                rpmBins.add((name, version, flavor))
    rpmBins = sorted(rpmBins)

    total = len(rpmBins)
    n = 0
    numBins = 100
    # Map dep to the troves that provide it
    provMap = {}
    # Map trove to the deps it requires
    reqMap = {}
    while rpmBins:
        log.info("Analyzing requirements (%d/%d)", n, total)
        toFetch, rpmBins = rpmBins[:numBins], rpmBins[numBins:]
        n += len(toFetch)

        fetchReqs = helper._repos.getDepsForTroveList(toFetch)
        for binTup, (provs, reqs) in zip(toFetch, fetchReqs):
            for depClass in DEP_CLASSES:
                for dep in provs.iterDepsByClass(depClass):
                    provMap.setdefault(dep, set()).add(binTup)
                for dep in reqs.iterDepsByClass(depClass):
                    reqMap.setdefault(binTup, set()).add(dep)

    # For each source, collect all the troves that provide a dep that its built
    # binaries require.
    allRequiringBins = set(reqMap)
    log.info("Collecting source list for %d troves", len(allRequiringBins))
    srcNameMap = helper.getSourceVersions(allRequiringBins)
    buildRequiresMap = {}
    for srcTup, binTups in srcNameMap.iteritems():
        name = srcTup[0]
        assert name.endswith(':source')
        name = name.split(':')[0]

        reqTroves = set()
        for binTup in binTups:
            for dep in reqMap[binTup]:
                for provTup in provMap.get(dep, set()):
                    if provTup[0].split(':')[0] == name:
                        # Reqs between subpackages of the same source aren't
                        # interesting for build requirements, because neither has been
                        # built yet.
                        continue
                    reqTroves.add(provTup[0])

        reqTroves.discard('perl:rpm')
        reqTroves.discard('python:rpm')
        reqTroves.discard('python-test:rpm')
        if reqTroves:
            buildRequiresMap[name] = reqTroves

    print 'buildRequiresMap = ',
    pprint.PrettyPrinter().pprint(buildRequiresMap)
def main():
    bot = getBot(Bot, None)
    helper = bot._updater._conaryhelper

    log.info("Collecting RPM list")
    rpmBins = set()
    for name, verDict in helper._getLatestTroves().iteritems():
        if not name.endswith(':rpm'):
            continue
        for version, flavors in verDict.iteritems():
            for flavor in flavors:
                rpmBins.add((name, version, flavor))
    rpmBins = sorted(rpmBins)

    total = len(rpmBins)
    n = 0
    numBins = 100
    # Map dep to the troves that provide it
    provMap = {}
    # Map trove to the deps it requires
    reqMap = {}
    while rpmBins:
        log.info("Analyzing requirements (%d/%d)", n, total)
        toFetch, rpmBins = rpmBins[:numBins], rpmBins[numBins:]
        n += len(toFetch)

        fetchReqs = helper._repos.getDepsForTroveList(toFetch)
        for binTup, (provs, reqs) in zip(toFetch, fetchReqs):
            for depClass in DEP_CLASSES:
                for dep in provs.iterDepsByClass(depClass):
                    provMap.setdefault(dep, set()).add(binTup)
                for dep in reqs.iterDepsByClass(depClass):
                    reqMap.setdefault(binTup, set()).add(dep)

    # For each source, collect all the troves that provide a dep that its built
    # binaries require.
    allRequiringBins = set(reqMap)
    log.info("Collecting source list for %d troves", len(allRequiringBins))
    srcNameMap = helper.getSourceVersions(allRequiringBins)
    buildRequiresMap = {}
    for srcTup, binTups in srcNameMap.iteritems():
        name = srcTup[0]
        assert name.endswith(':source')
        name = name.split(':')[0]

        reqTroves = set()
        for binTup in binTups:
            for dep in reqMap[binTup]:
                for provTup in provMap.get(dep, set()):
                    if provTup[0].split(':')[0] == name:
                        # Reqs between subpackages of the same source aren't
                        # interesting for build requirements, because neither has been
                        # built yet.
                        continue
                    reqTroves.add(provTup[0])

        reqTroves.discard('perl:rpm')
        reqTroves.discard('python:rpm')
        reqTroves.discard('python-test:rpm')
        if reqTroves:
            buildRequiresMap[name] = reqTroves

    print 'buildRequiresMap = ',
    pprint.PrettyPrinter().pprint(buildRequiresMap)
Esempio n. 3
0
            group.removePackage(name, missingOk=True)

        import epdb;epdb.st()
        # Sanity check the group model and write out the current state so that
        # you can do a local test cook.
        group._copyVersions()
        group._sanityCheck()
        group._setGroupFlags()
        group._mgr._persistGroup(group)

        # You probably want to do a test cook if your groups here. It would be
        # nice if mirrorball could just do this for you, but it can't right now.
        # To run a test cook take a look at group._mgr._helper._checkoutCache to
        # find the directory where the checkout is and then run cvc cook from
        # that directory.
        import epdb; epdb.st()

        # Commit and build the group.
        group = group.commit()
        built = group.build()

        import epdb; epdb.st()

        return built

if __name__ == '__main__':
    bot = getBot(Bot)
    trvMap = bot.generateInitialGroup()

    import epdb; epdb.st()
Esempio n. 4
0
        # you can do a local test cook.
        group._copyVersions()
        group._sanityCheck()
        group._setGroupFlags()
        group._mgr._persistGroup(group)

        # You probably want to do a test cook if your groups here. It would be
        # nice if mirrorball could just do this for you, but it can't right now.
        # To run a test cook take a look at group._mgr._helper._checkoutCache to
        # find the directory where the checkout is and then run cvc cook from
        # that directory.
        import epdb
        epdb.st()

        # Commit and build the group.
        group = group.commit()
        built = group.build()

        import epdb
        epdb.st()

        return built


if __name__ == '__main__':
    bot = getBot(Bot, None)
    trvMap = bot.generateInitialGroup()

    import epdb
    epdb.st()
Esempio n. 5
0
        for name in removals:
            group.removePackage(name, missingOk=True)

        # Sanity check the group model and write out the current state so that
        # you can do a local test cook.
        group._copyVersions()
        group._sanityCheck()
        group._setGroupFlags()
        group._mgr._persistGroup(group)

        # You probably want to do a test cook if your groups here. It would be
        # nice if mirrorball could just do this for you, but it can't right now.
        # To run a test cook take a look at group._mgr._helper._checkoutCache to
        # find the directory where the checkout is and then run cvc cook from
        # that directory.
        import epdb; epdb.st()

        # Commit and build the group.
        group = group.commit()
        built = group.build()

        import epdb; epdb.st()

        return built

if __name__ == '__main__':
    bot = getBot(Bot, None)
    trvMap = bot.generateInitialGroup()

    import epdb; epdb.st()