示例#1
0
def CloneTrove(cfg,
               targetBranch,
               troveSpecList,
               updateBuildInfo=True,
               info=False,
               cloneSources=False,
               message=None,
               test=False,
               fullRecurse=False,
               ignoreConflicts=False,
               exactFlavors=False):
    client = ConaryClient(cfg)
    repos = client.getRepos()

    targetBranch = versions.VersionFromString(targetBranch)
    if not isinstance(targetBranch, versions.Branch):
        raise errors.ParseError(
            'Cannot specify full version "%s" to clone to - must specify target branch'
            % targetBranch)

    troveSpecs = [cmdline.parseTroveSpec(x) for x in troveSpecList]

    componentSpecs = [
        x[0] for x in troveSpecs
        if ':' in x[0] and x[0].split(':')[1] != 'source'
    ]
    if componentSpecs:
        raise errors.ParseError('Cannot clone components: %s' %
                                ', '.join(componentSpecs))

    trovesToClone = repos.findTroves(cfg.installLabelPath,
                                     troveSpecs,
                                     cfg.flavor,
                                     exactFlavors=exactFlavors)
    trovesToClone = list(set(itertools.chain(*trovesToClone.itervalues())))

    if not client.cfg.quiet:
        callback = client_callbacks.CloneCallback(client.cfg, message)
    else:
        callback = callbacks.CloneCallback()

    okay, cs = client.createCloneChangeSet(targetBranch,
                                           trovesToClone,
                                           updateBuildInfo=updateBuildInfo,
                                           infoOnly=info,
                                           callback=callback,
                                           fullRecurse=fullRecurse,
                                           cloneSources=cloneSources)
    if not okay:
        return
    return _finishClone(client,
                        cfg,
                        cs,
                        callback,
                        info=info,
                        test=test,
                        ignoreConflicts=ignoreConflicts)
示例#2
0
def CloneTrove(cfg, targetBranch, troveSpecList, updateBuildInfo = True,
               info = False, cloneSources = False, message = None,
               test = False, fullRecurse = False, ignoreConflicts = False,
               exactFlavors = False):
    client = ConaryClient(cfg)
    repos = client.getRepos()

    targetBranch = versions.VersionFromString(targetBranch)
    if not isinstance(targetBranch, versions.Branch):
        raise errors.ParseError('Cannot specify full version "%s" to clone to - must specify target branch' % targetBranch)

    troveSpecs = [ cmdline.parseTroveSpec(x) for x in troveSpecList]

    componentSpecs = [ x[0] for x in troveSpecs
                       if ':' in x[0] and x[0].split(':')[1] != 'source']
    if componentSpecs:
        raise errors.ParseError('Cannot clone components: %s' % ', '.join(componentSpecs))


    trovesToClone = repos.findTroves(cfg.installLabelPath,
                                    troveSpecs, cfg.flavor,
                                    exactFlavors = exactFlavors)
    trovesToClone = list(set(itertools.chain(*trovesToClone.itervalues())))

    if not client.cfg.quiet:
        callback = client_callbacks.CloneCallback(client.cfg, message)
    else:
        callback = callbacks.CloneCallback()

    okay, cs = client.createCloneChangeSet(targetBranch, trovesToClone,
                                           updateBuildInfo=updateBuildInfo,
                                           infoOnly=info, callback=callback,
                                           fullRecurse=fullRecurse,
                                           cloneSources=cloneSources)
    if not okay:
        return
    return _finishClone(client, cfg, cs, callback, info=info,
                        test=test, ignoreConflicts=ignoreConflicts)