Beispiel #1
0
def blockOnTasks(options, tasks):
    maxTaskNameLen = tasks and max([len(t.name) for t in tasks]) or 0
    sleepTime = 1
    ##
    # Loop until all of the tasks are in state FAILED or COMPLETED
    while [
            t for t in tasks
            if t.state not in [task.TASK_FAILED, task.TASK_COMPLETED]
    ]:
        if showAnyMsg(options):
            if not options('general.no_print_polling'):
                commands.runSystem('clear')
                for t in tasks:
                    printTask(options, t, maxTaskNameLen)
        time.sleep(sleepTime)
        sleepTime = sleepTime < 30 and sleepTime * 2 or 30
        tasks = [
            loadTask(options('general.host'), options('general.name'), t.name)
            for t in tasks
        ]

    ##
    # If we are showing any messages then clear the screen because after this
    # the tasks will be printed out again
    if showAnyMsg(options) and not options('general.no_print_polling'):
        commands.runSystem('clear')

    return tasks
Beispiel #2
0
def addJavaCert(outputdir, host, port):
    """This installs a java cert.  It is assumed that install-cert.sh is in the PATH"""

    runSystemEx("""cd /tmp/ && echo 1 | install-cert.sh %s:%d""" %
                (host, port))
    if outputdir not in ['/tmp', '/tmp/']:
        runSystem("""mv /tmp/jssecacerts %s""" % (outputdir, ))
Beispiel #3
0
    def checkout(self, options, repo, repoPath, outputPath, branch):
        fullPath = os.path.join(repo.repoUrl, branch, repoPath)
        stderr = []
        try:
            # Test to see if it's already checked out, if not continue
            self._raiseIfCheckout(outputPath)
            commands.runSingleProgramEx('svn co %s %s' %
                                        (fullPath, outputPath),
                                        stdoutf=None,
                                        stderrf=stderr.append,
                                        log=logging.DEBUG)
        except CheckoutModifiedError:
            logging.errorPrint(
                'You have uncommited changes to %s, please revert changes or commit them'
                % outputPath)
            raise
        except commands.ProgramRunError:
            if 'refers to a file, not a directory' in ''.join(stderr):
                try:
                    tmpPath = os.path.dirname(
                        os.path.join(options('general.codir'), repoPath))
                    self._raiseIfCheckout(tmpPath)
                    commands.runSystem('rm -rf ' + tmpPath, log=logging.DEBUG)
                    commands.runSystemEx('mkdir -p ' + tmpPath,
                                         log=logging.DEBUG)
                    commands.runSingleProgramEx(
                        'svn co %s %s' % (os.path.dirname(fullPath), tmpPath),
                        stdoutf=None,
                        stderrf=logging.errorPrintS,
                        log=logging.DEBUG)
                    commands.runSystem('rm -rf ' + outputPath,
                                       log=logging.DEBUG)
                    commands.runSystemEx('ln -s %s %s' % (os.path.join(
                        options('general.codir'), repoPath), outputPath),
                                         log=logging.DEBUG)
                except CheckoutModifiedError:
                    logging.errorPrint(
                        'You have uncommited changes to %s, please revert changes or commit them'
                        % tmpPath)
                    raise
            else:
                for l in stderr:
                    logging.errorPrintS(l)
                raise

        logExport(options('general.config_dir'), repo, repoPath, outputPath,
                  branch, CHECKOUT)
Beispiel #4
0
def blockOnTasks(options, tasks):
    maxTaskNameLen = tasks and max([len(t.name) for t in tasks]) or 0
    sleepTime = 1
    ##
    # Loop until all of the tasks are in state FAILED or COMPLETED
    while [t for t in tasks if t.state not in [task.TASK_FAILED, task.TASK_COMPLETED]]:
        if showAnyMsg(options):
            if not options('general.no_print_polling'):
                commands.runSystem('clear')
                for t in tasks:
                    printTask(options, t, maxTaskNameLen)
        time.sleep(sleepTime)
        sleepTime = sleepTime < 30 and sleepTime * 2 or 30
        tasks = [loadTask(options('general.host'), options('general.name'), t.name)
                 for t in tasks]

    ##
    # If we are showing any messages then clear the screen because after this
    # the tasks will be printed out again
    if showAnyMsg(options) and not options('general.no_print_polling'):
        commands.runSystem('clear')
        
    return tasks
Beispiel #5
0
    def checkout(self, options, repo, repoPath, outputPath, branch):
        fullPath = os.path.join(repo.repoUrl, branch, repoPath)
        stderr = []
        try:
            # Test to see if it's already checked out, if not continue
            self._raiseIfCheckout(outputPath)
            commands.runSingleProgramEx('svn co %s %s' % (fullPath, outputPath),
                                        stdoutf=None,
                                        stderrf=stderr.append,
                                        log=logging.DEBUG)
        except CheckoutModifiedError:
            logging.errorPrint('You have uncommited changes to %s, please revert changes or commit them' % outputPath)
            raise
        except commands.ProgramRunError:
                if 'refers to a file, not a directory' in ''.join(stderr):
                    try:
                        tmpPath = os.path.dirname(os.path.join(options('general.codir'), repoPath))
                        self._raiseIfCheckout(tmpPath)
                        commands.runSystem('rm -rf ' + tmpPath, log=logging.DEBUG)
                        commands.runSystemEx('mkdir -p ' + tmpPath, log=logging.DEBUG)
                        commands.runSingleProgramEx('svn co %s %s' % (os.path.dirname(fullPath), tmpPath),
                                                    stdoutf=None,
                                                    stderrf=logging.errorPrintS,
                                                    log=logging.DEBUG)
                        commands.runSystem('rm -rf ' + outputPath, log=logging.DEBUG)
                        commands.runSystemEx('ln -s %s %s' % (os.path.join(options('general.codir'), repoPath),
                                                              outputPath),
                                             log=logging.DEBUG)
                    except CheckoutModifiedError:
                        logging.errorPrint('You have uncommited changes to %s, please revert changes or commit them' % tmpPath)
                        raise
                else:
                    for l in stderr:
                        logging.errorPrintS(l)
                    raise

        logExport(options('general.config_dir'), repo, repoPath, outputPath, branch, CHECKOUT)
Beispiel #6
0
def addJavaCert(outputdir, host, port):
    """This installs a java cert.  It is assumed that install-cert.sh is in the PATH"""

    runSystemEx("""cd /tmp/ && echo 1 | install-cert.sh %s:%d""" % (host, port))
    if outputdir not in ['/tmp', '/tmp/']:
        runSystem("""mv /tmp/jssecacerts %s""" % (outputdir,))
Beispiel #7
0
def main(options, _args):
    logging.DEBUG = options('debug')
    env = {'PATH': os.path.join(options('prefix'), 'bin') + ':' + os.getenv('PATH')}

    tmpDir = os.path.join(options('tmpdir'), 'ca-ocaml-platform')
    buildDir = os.path.join(tmpDir, 'build')
    commands.runSystem('rm -rf ' + tmpDir, log=logging.DEBUG)
    commands.runSystemEx('mkdir -p ' + tmpDir, log=logging.DEBUG)
    commands.runSystemEx('mkdir -p ' + buildDir, log=logging.DEBUG)
    
    #
    # Download everything first
    for _, url in URLS:
        commands.runSystemEx('wget --quiet -P %s %s' % (tmpDir, url), log=logging.DEBUG)

    for project, url in URLS:
        fileName = os.path.basename(url)
        downloadedName = os.path.join(tmpDir, fileName)
        untarToDir(downloadedName, buildDir)
        
        # Ocaml gets special attention because it needs the prefix
        if project == 'ocaml':
            commands.runSingleProgramEx('cd %s/*%s*; ./configure -prefix %s' % (buildDir, project, options('prefix')),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        log=logging.DEBUG)
            commands.runSingleProgramEx('cd %s/*%s*; make world.opt install' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,                                        
                                        log=logging.DEBUG)
        elif project in ['findlib']:
            commands.runSingleProgramEx('cd %s/*%s*; ./configure' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)
            commands.runSingleProgramEx('cd %s/*%s*; make all opt install' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)
        elif project == 'core':
            commands.runSingleProgramEx('cd %s/*%s*; patch -p1 -i %s/patches/core-0.6.0-3.12.0.patch' % (buildDir, project, os.getcwd()),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,                                        
                                        log=logging.DEBUG)
            commands.runSingleProgramEx('cd %s/*%s*; make' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)
            commands.runSingleProgramEx('cd %s/*%s*; make install' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)
        else:
            commands.runSingleProgramEx('cd %s/*%s*; make' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)
            commands.runSingleProgramEx('cd %s/*%s*; make install' % (buildDir, project),
                                        stdoutf=None,
                                        stderrf=sys.stderr.write,
                                        addEnv=env,
                                        log=logging.DEBUG)

        commands.runSystemEx('rm -rf %s/*' % buildDir, log=logging.DEBUG)

    print 'Be sure to update your environment variables:'
    print 'export PATH=%s:$PATH' % (os.path.join(options('prefix'), 'bin'),)