예제 #1
0
def main(args):
    import time
    from conary import conarycfg
    from conary.conaryclient.cmdline import parseTroveSpec

    setupLogging(consoleLevel=logging.DEBUG, consoleFormat='file')

    if len(args) == 2:
        troveSpec, kernelSpec, workDir = args[0], args[1], '.'
    elif len(args) == 3:
        troveSpec, kernelSpec, workDir = args
    else:
        sys.exit("Usage: %s <troveSpec> <kernelSpec> [<workDir>]" % sys.argv[0])

    cfg = conarycfg.ConaryConfiguration(False)
    cfg.configLine('includeConfigFile http://localhost/conaryrc')
    cli = ConaryClient(cfg)
    repos = cli.getRepos()

    troveTup = sorted(repos.findTrove(None, parseTroveSpec(troveSpec)))[-1]
    kernelTup = sorted(repos.findTrove(None, parseTroveSpec(kernelSpec)))[-1]

    generator = TemplateGenerator(troveTup, kernelTup, cfg, workDir)
    generator.getTemplate(start=True)
    while True:
        status, path = generator.getTemplate(start=False)
        if status == generator.Status.NOT_FOUND:
            print 'Failed!'
            break
        elif status == generator.Status.DONE:
            print 'Done:', path
            break
        time.sleep(1)

    generator.wait()
예제 #2
0
파일: clone.py 프로젝트: pombreda/conary-1
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)
예제 #3
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)