def _buildRedirect(self, trvCsDict, sourceFlavor,
                       sourceVersion, rule, target):
        if target[0] is not None:
            redirInfo = _RedirectInfo(target[0], target[1].branch(), rule.targetFlavor)
        else:
            redirInfo = _RemoveRedirect()

        self.redirections.add(rule.sourceName, sourceFlavor, redirInfo)

        # Groups don't include any additional redirections, and
        # neither do items which aren't collections
        if (trove.troveIsGroup(rule.sourceName) or
            not trove.troveIsCollection(rule.sourceName)):
            return

        if target[0] is not None:
            targetTrove = self.repos.getTrove(withFiles = False, *target)
            targetComponents = set([ x[0].split(':')[1]
                for x in
                targetTrove.iterTroveList(strongRefs = True) ])
        else:
            targetComponents = set()

        # we can't integrity check here because we got
        # the trove w/o files
        trvCs = trvCsDict[(rule.sourceName, sourceVersion, sourceFlavor)]
        trv = trove.Trove(trvCs)

        # assemble a set of all of the components included
        # in this trove
        currentComponents = set([ x[0].split(':')[1] for x in
                        trv.iterTroveList(strongRefs = True) ])

        # components shared between the current trove and
        # the target should be redirected to the target
        # components
        for compName in currentComponents & targetComponents:
            sourceCompName = rule.sourceName + ':' + compName
            targetCompName = redirInfo.targetName + ':' + compName
            self.redirections.add(sourceCompName, sourceFlavor,
                    _RedirectInfo(targetCompName, redirInfo.targetBranch,
                                  redirInfo.targetFlavor))

        # now get all of the components which have been
        # included in this trove anywhere on the branch; those
        # components need to generate erase redirects
        allVersions = self.repos.getTroveVersionsByBranch(
            { trv.getName() :
                { trv.getVersion().branch() : None } } )
        l = []
        for subVersion, subFlavorList in \
                allVersions[trv.getName()].iteritems():
            l += [ ( trv.getName(), subVersion, flavor)
                     for flavor in subFlavorList ]

        allTroves = self.repos.getTroves(l, withFiles = False)
        allComponents = set()
        for otherTrv in allTroves:
            allComponents.update(
               [ x[0].split(':')[1] for x in
                 otherTrv.iterTroveList(strongRefs = True) ] )

        # components which existed at any point for this
        # trove but don't have a component in the redirect
        # target need to be erased
        for subName in targetComponents - allComponents:
            newName = rule.sourceName + ':' + subName
            self.redirections.add(newName, sourceFlavor, _RemoveRedirect())

        # the package redirect includes references to the
        # component redirects to let the update code know
        # how to redirect the components; this tracks the
        # components of this redirect
        redirInfo.addComponents(
            [ rule.sourceName + ':' + x for x in allComponents ])
dataset/ETHPy150Open sassoftware/conary/conary/build/redirectrecipe.py/_RedirectRecipe._buildRedirect/swapped operands of `-`