示例#1
0
def changesInSVN(moduleDir, workingDir, log):
    changesAtAll = False

    for module in reposModules:
        log.write("[tbox] Checking for updates [%s] [%s]\n" %
                  (workingDir, module))

        moduleDir = os.path.join(workingDir, module)

        print "[%s] [%s] [%s]" % (workingDir, module, moduleDir)
        os.chdir(moduleDir)

        outputList = hardhatutil.executeCommandReturnOutputRetry(
            [svnProgram, "up"])

        hardhatutil.dumpOutputList(outputList, log)

        if NeedsUpdate(outputList):
            changesAtAll = True
            print "" + module + " needs updating"
        else:
            # print "NO, unchanged"
            log.write("Module unchanged" + "\n")

    log.write(separator)
    log.write("Done with SVN\n")
    return changesAtAll
示例#2
0
def doUploadToStaging(buildmode, workingDir, buildVersion, log):
    print "doUploadToStaging..."
    
    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    buildRoot =  os.path.join(workingDir, 'external')
    print 'Setting BUILD_ROOT=', buildRoot
    log.write('Setting BUILD_ROOT=' + buildRoot + '\n')
    os.putenv('BUILD_ROOT', buildRoot)
    os.chdir(buildRoot)
    uploadDir = os.path.join(buildRoot, buildVersion)
    if not os.path.exists(uploadDir):
        os.mkdir(uploadDir)

    try:
        upload = ' uploadworld UPLOAD=' + uploadDir
        print "Doing make " + dbgStr + upload
        log.write("Doing make " + dbgStr + upload + "\n")

        outputList = hardhatutil.executeCommandReturnOutput( [buildenv['make'], dbgStr, upload])
        hardhatutil.dumpOutputList(outputList, log)

        log.write(separator)

    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "upload error"
        log.write("***Error during upload***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        raise e
示例#3
0
def changesInSVN(workingDir, log):
    changesDict = {}

    os.chdir(workingDir)

    for module in reposModules:
        log.write("[tbox] Checking for updates [%s] [%s]\n" %
                  (workingDir, module))

        moduleDir = os.path.join(workingDir, module)

        changesDict[module] = False

        print "[%s] [%s] [%s]" % (workingDir, module, moduleDir)
        os.chdir(moduleDir)

        outputList = hardhatutil.executeCommandReturnOutputRetry(
            [svnProgram, "up"])

        hardhatutil.dumpOutputList(outputList, log)

        if NeedsUpdate(outputList):
            changesDict[module] = True
            log.write("%s needs updating\n" % module)
        else:
            log.write("%s unchanged\n" % module)

    log.write(separator)
    log.write("Done with SVN\n")
    return changesDict
示例#4
0
def doTests(hardhatScript, mode, workingDir, outputDir, buildVersion, log):

    testDir = os.path.join(workingDir, "chandler")
    os.chdir(testDir)

    if mode == "debug":
        dashT = '-dvt'
    else:
        dashT = '-vrt'
    
    try: # test
        print "Testing " + mode
        log.write(separator)
        log.write("Testing " + mode + " ...\n")

        print "hardhatScript [%s]" % hardhatScript

        outputList = hardhatutil.executeCommandReturnOutput(
         [hardhatScript, dashT])
        hardhatutil.dumpOutputList(outputList, log)

    except Exception, e:
        print "a testing error"
        doCopyLog("***Error during tests***", workingDir, logPath, log)
        forceBuildNextCycle(log, workingDir)
        return "test_failed"
示例#5
0
def doTests(hardhatScript, mode, workingDir, outputDir, buildVersion, log):

    testDir = os.path.join(workingDir, "chandler")
    os.chdir(testDir)

    if mode == "debug":
        dashT = '-dvt'
    else:
        dashT = '-vrt'

    try:  # test
        print "Testing " + mode
        log.write(separator)
        log.write("Testing " + mode + " ...\n")

        print "hardhatScript [%s]" % hardhatScript

        outputList = hardhatutil.executeCommandReturnOutput(
            [hardhatScript, dashT])
        hardhatutil.dumpOutputList(outputList, log)

    except Exception, e:
        print "a testing error"
        doCopyLog("***Error during tests***", workingDir, logPath, log)
        forceBuildNextCycle(log, workingDir)
        return "test_failed"
示例#6
0
def changesInSVN(workingDir, log):
    changesDict = {}

    os.chdir(workingDir)
    
    for module in reposModules:
        log.write("[tbox] Checking for updates [%s] [%s]\n" % (workingDir, module))
                                              
        moduleDir = os.path.join(workingDir, module)

        changesDict[module] = False

        print "[%s] [%s] [%s]" % (workingDir, module, moduleDir)
        os.chdir(moduleDir)

        outputList = hardhatutil.executeCommandReturnOutputRetry([svnProgram, "up"])

        hardhatutil.dumpOutputList(outputList, log) 

        if NeedsUpdate(outputList):
            changesDict[module] = True
	    log.write("%s needs updating\n" % module)
        else:
            log.write("%s unchanged\n" % module)

    log.write(separator)
    log.write("Done with SVN\n")
    return changesDict
示例#7
0
def changesInSVN(moduleDir, workingDir, log):
    changesAtAll = False

    for module in reposModules:
        log.write("[tbox] Checking for updates [%s] [%s]\n" % (workingDir, module))
                                              
        moduleDir = os.path.join(workingDir, module)

        print "[%s] [%s] [%s]" % (workingDir, module, moduleDir)
        os.chdir(moduleDir)

        outputList = hardhatutil.executeCommandReturnOutputRetry([svnProgram, "up"])

        hardhatutil.dumpOutputList(outputList, log) 

        if NeedsUpdate(outputList):
            changesAtAll = True
            print "" + module + " needs updating"
        else:
            # print "NO, unchanged"
            log.write("Module unchanged" + "\n")

    log.write(separator)
    log.write("Done with SVN\n")
    return changesAtAll
示例#8
0
def doInstall(buildmode, workingDir, log, cleanFirst=False):
    # for our purposes, we do not really do a build
    # we will update chandler from SVN, and grab new tarballs when they appear
    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    if cleanFirst:
        clean = " clean "
    else:
        clean = " "

    moduleDir = os.path.join(workingDir, mainModule)
    os.chdir(moduleDir)
    print "Doing make " + dbgStr + clean + "install strip\n"
    log.write("Doing make " + dbgStr + clean + "install strip\n")

    try:
        outputList = hardhatutil.executeCommandReturnOutput(
            [buildenv['make'], dbgStr, clean, "install", "strip"])
        hardhatutil.dumpOutputList(outputList, log)
    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "build error"
        log.write("***Error during build***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#9
0
def doDistribution(workingDir, log, outputDir, buildVersion,
                   buildVersionEscaped):
    log.write(separator)
    log.write("[tbox] Creating distribution files\n")

    for (module, target, distSource, fileGlob) in reposDist:
        moduleDir = os.path.join(workingDir, module)

        print "Distribution [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput(
                [antProgram, target])

            hardhatutil.dumpOutputList(outputList, log)

            sourceDir = os.path.join(moduleDir, distSource)
            targetDir = os.path.join(outputDir, buildVersion)

            if not os.path.exists(targetDir):
                os.mkdir(targetDir)

            print sourceDir, targetDir

            log.write("[tbox] Moving %s to %s\n" % (sourceDir, targetDir))

            hardhatlib.copyFiles(sourceDir, targetDir, fileGlob)

        except Exception, e:
            doCopyLog("***Error during distribution building process*** ",
                      workingDir, logPath, log)
            raise e
示例#10
0
def doDistribution(workingDir, log, outputDir, buildVersion, buildVersionEscaped):
    log.write(separator)
    log.write("[tbox] Creating distribution files\n")

    for (module, target, distSource, fileGlob) in reposDist:
        moduleDir = os.path.join(workingDir, module)

        print "Distribution [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput([antProgram, target])

            hardhatutil.dumpOutputList(outputList, log)

            sourceDir = os.path.join(moduleDir, distSource)
            targetDir = os.path.join(outputDir, buildVersion)

            if not os.path.exists(targetDir):
                os.mkdir(targetDir)

            print sourceDir, targetDir

            log.write("[tbox] Moving %s to %s\n" % (sourceDir, targetDir))

            hardhatlib.copyFiles(sourceDir, targetDir, fileGlob)

        except Exception, e:
            doCopyLog("***Error during distribution building process*** ", workingDir, logPath, log)
            raise e
示例#11
0
def doInstall(buildmode, workingDir, log, cleanFirst=False):
    # for our purposes, we do not really do a build
    # we will update chandler from SVN, and grab new tarballs when they appear
    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    if cleanFirst:
        clean = " clean "
    else:
        clean = " "

    moduleDir = os.path.join(workingDir, mainModule)
    os.chdir(moduleDir)
    print "Doing make " + dbgStr + clean + "install strip\n"
    log.write("Doing make " + dbgStr + clean + "install strip\n")

    try:
        outputList = hardhatutil.executeCommandReturnOutput(
          [buildenv['make'], dbgStr, clean, "install", "strip" ])
        hardhatutil.dumpOutputList(outputList, log)
    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "build error"
        log.write("***Error during build***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#12
0
def doDistribution(releaseMode, workingDir, log, outputDir, buildVersion,
                   buildVersionEscaped, hardhatScript):
    #   Create end-user, developer distributions
    chanDir = os.path.join(workingDir, 'chandler')
    os.chdir(chanDir)

    print "Making distribution files for " + releaseMode
    log.write(separator)
    log.write("Making distribution files for " + releaseMode + "\n")
    if releaseMode == "debug":
        distOption = "-dD"
    else:
        distOption = "-D"

    try:
        outputList = hardhatutil.executeCommandReturnOutput([
            hardhatScript, "-o",
            os.path.join(outputDir, buildVersion), distOption,
            buildVersionEscaped
        ])
        hardhatutil.dumpOutputList(outputList, log)
    except Exception, e:
        doCopyLog("***Error during distribution building process*** ",
                  workingDir, logPath, log)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#13
0
def doBuild(buildmode, workingDir, log, svnChanges, clean='realclean'):
    # We only build external if there were changes in it
    # We build internal if external or internal were changed
    # We never build in chandler, because there is nothing to build
    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    buildRoot =  os.path.join(workingDir, 'external')
    print 'Setting BUILD_ROOT=', buildRoot
    log.write('Setting BUILD_ROOT=' + buildRoot + '\n')
    os.putenv('BUILD_ROOT', buildRoot)

    try:
        for module in reposModules:
            print module, "..."
            log.write("- - - - " + module + " - - - - - - -\n")

            if module == 'external' and not svnChanges['external']:
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue
            if module == 'internal' and not svnChanges['external'] and not svnChanges['internal']:
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue
            if module == 'chandler':
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue

            moduleDir = os.path.join(workingDir, module)
            print "cd", moduleDir
            log.write("cd " + moduleDir + "\n")
            os.chdir(moduleDir)

            buildCmds = ' all binaries install'
                
            print "Doing make " + dbgStr + " " + clean + buildCmds + "\n"
            log.write("Doing make " + dbgStr + " " + clean + buildCmds + "\n")

            outputList = hardhatutil.executeCommandReturnOutput( [buildenv['make'], dbgStr, clean, buildCmds ])
            hardhatutil.dumpOutputList(outputList, log)

            log.write(separator)
            
    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "build error"
        log.write("***Error during build***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#14
0
def doRealclean(log, workingDir):
    try:
        # If make install fails, it will almost certainly fail next time
        # as well - the typical case has been bad binaries packages.
        # So what we do here is try to do realclean which will force
        # the build to get new binaries tarballs next time, and if fixed
        # binaries were uploaded in the meanwhile we'll recover
        # automatically. This will also sort us out of corrupted debug/release.
        print "Doing make realclean\n"
        log.write("Doing make realclean\n")
        moduleDir = os.path.join(workingDir, mainModule)
        os.chdir(moduleDir)
        outputList = hardhatutil.executeCommandReturnOutput(
         [buildenv['make'], "realclean"])
        hardhatutil.dumpOutputList(outputList, log)
    except:
        print "make realclean failed\n"
        log.write("make realclean failed\n")
示例#15
0
def doBuild(workingDir, log):
    log.write("[tbox] Building\n")

    for (module, target) in reposBuild:
        moduleDir = os.path.join(workingDir, module)
        mavenDir = os.path.join(workingDir, "..", "tbox_maven", module)

        print "Building [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput([antProgram, "-Dmaven.home.local=" + mavenDir, target])

            hardhatutil.dumpOutputList(outputList, log)

        except:
            log.write("[tbox] Build failed for [%s]\n" % module)
示例#16
0
def doRealclean(log, workingDir):
    try:
        # If make install fails, it will almost certainly fail next time
        # as well - the typical case has been bad binaries packages.
        # So what we do here is try to do realclean which will force
        # the build to get new binaries tarballs next time, and if fixed
        # binaries were uploaded in the meanwhile we'll recover
        # automatically. This will also sort us out of corrupted debug/release.
        print "Doing make realclean\n"
        log.write("Doing make realclean\n")
        moduleDir = os.path.join(workingDir, mainModule)
        os.chdir(moduleDir)
        outputList = hardhatutil.executeCommandReturnOutput(
            [buildenv['make'], "realclean"])
        hardhatutil.dumpOutputList(outputList, log)
    except:
        print "make realclean failed\n"
        log.write("make realclean failed\n")
示例#17
0
def doDistribution(releaseMode, workingDir, log, outputDir, buildVersion, buildVersionEscaped, hardhatScript):
    #   Create end-user, developer distributions
    print "Making distribution files for " + releaseMode
    log.write(separator)
    log.write("Making distribution files for " + releaseMode + "\n")
    if releaseMode == "debug":
        distOption = "-dD"
    else:
        distOption = "-D"

    try:
        outputList = hardhatutil.executeCommandReturnOutput(
         [hardhatScript, "-o", os.path.join(outputDir, buildVersion), distOption, buildVersionEscaped])
        hardhatutil.dumpOutputList(outputList, log)
    except Exception, e:
        doCopyLog("***Error during distribution building process*** ", workingDir, logPath, log)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#18
0
def doBuild(workingDir, log):
    log.write("[tbox] Building\n")

    for (module, target) in reposBuild:
        moduleDir = os.path.join(workingDir, module)
        mavenDir = os.path.join(workingDir, '..', 'tbox_maven', module)

        print "Building [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput(
                [antProgram, '-Dmaven.home.local=' + mavenDir, target])

            hardhatutil.dumpOutputList(outputList, log)

        except:
            log.write("[tbox] Build failed for [%s]\n" % module)
示例#19
0
def doTests(workingDir, log):
    log.write("[tbox] Running unit tests\n")

    for (module, target) in reposTest:
        moduleDir = os.path.join(workingDir, module)

        print "Testing [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput([antProgram, target])

            hardhatutil.dumpOutputList(outputList, log)

        except Exception, e:
            doCopyLog("***Error during tests***", workingDir, logPath, log)
            return "test_failed"
        else:
            doCopyLog("Tests successful", workingDir, logPath, log)
示例#20
0
def main():
    curDir = os.path.abspath(os.getcwd())
    path = os.environ.get('PATH', os.environ.get('path'))
    svnProgram = hardhatutil.findInPath(path, "svn")

    if os.path.exists(stopFile):
        os.remove(stopFile)

    go = 1
    firstRound = 1

    while go:
        os.chdir(curDir)

        if not firstRound:
            print "Sleeping 5 minutes"
            time.sleep(5 * 60)

        nowString = time.strftime("%Y-%m-%d %H:%M:%S")
        
        # check SVN for any new hardhat script
        try:
            # bring this hardhat directory up to date
            outputList = hardhatutil.executeCommandReturnOutputRetry(
             [svnProgram, "-q", "update"])
            hardhatutil.dumpOutputList(outputList)
        except:
            raise TinderbuildError, "Error updating HardHat"
        
        try:
            # launch the real build script
            outputList = hardhatutil.executeCommandReturnOutput(
             [os.path.join(curDir, 'tinderbox.py'), ' '.join(sys.argv[1:])])
            hardhatutil.dumpOutputList(outputList)
        except:
            raise TinderbuildError, "Failed to launch build script"

        if os.path.exists(stopFile):
            go = 0

        firstRound = 0
示例#21
0
def main():
    curDir = os.path.abspath(os.getcwd())
    path = os.environ.get('PATH', os.environ.get('path'))
    svnProgram = hardhatutil.findInPath(path, "svn")

    if os.path.exists(stopFile):
        os.remove(stopFile)

    go = 1
    firstRound = 1

    while go:
        os.chdir(curDir)

        if not firstRound:
            print "Sleeping 5 minutes"
            time.sleep(5 * 60)

        nowString = time.strftime("%Y-%m-%d %H:%M:%S")

        # check SVN for any new hardhat script
        try:
            # bring this hardhat directory up to date
            outputList = hardhatutil.executeCommandReturnOutputRetry(
                [svnProgram, "-q", "update"])
            hardhatutil.dumpOutputList(outputList)
        except:
            raise TinderbuildError, "Error updating HardHat"

        try:
            # launch the real build script
            outputList = hardhatutil.executeCommandReturnOutput(
                [os.path.join(curDir, 'tinderbox.py'), ' '.join(sys.argv[1:])])
            hardhatutil.dumpOutputList(outputList)
        except:
            raise TinderbuildError, "Failed to launch build script"

        if os.path.exists(stopFile):
            go = 0

        firstRound = 0
示例#22
0
def doTests(workingDir, log):
    log.write("[tbox] Running unit tests\n")

    for (module, target) in reposTest:
        moduleDir = os.path.join(workingDir, module)

        print "Testing [%s]" % module

        try:
            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutput(
                [antProgram, target])

            hardhatutil.dumpOutputList(outputList, log)

        except Exception, e:
            doCopyLog("***Error during tests***", workingDir, logPath, log)
            return "test_failed"
        else:
            doCopyLog("Tests successful", workingDir, logPath, log)
示例#23
0
def doUploadToStaging(buildmode, workingDir, buildVersion, log):
    print "doUploadToStaging..."

    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    buildRoot = os.path.join(workingDir, 'external')
    print 'Setting BUILD_ROOT=', buildRoot
    log.write('Setting BUILD_ROOT=' + buildRoot + '\n')
    os.putenv('BUILD_ROOT', buildRoot)
    os.chdir(buildRoot)
    uploadDir = os.path.join(buildRoot, buildVersion)
    if not os.path.exists(uploadDir):
        os.mkdir(uploadDir)

    try:
        upload = ' uploadworld UPLOAD=' + uploadDir
        print "Doing make " + dbgStr + upload
        log.write("Doing make " + dbgStr + upload + "\n")

        outputList = hardhatutil.executeCommandReturnOutput(
            [buildenv['make'], dbgStr, upload])
        hardhatutil.dumpOutputList(outputList, log)

        log.write(separator)

    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "upload error"
        log.write("***Error during upload***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        raise e
示例#24
0
def Start(hardhatScript,
          workingDir,
          buildVersion,
          clobber,
          log,
          skipTests=False,
          upload=False):

    # make sure workingDir is absolute
    workingDir = os.path.abspath(workingDir)

    os.chdir(workingDir)

    # remove outputDir and create it
    outputDir = os.path.join(workingDir, "output")

    if os.path.exists(outputDir):
        hardhatutil.rmdirRecursive(outputDir)

    os.mkdir(outputDir)

    buildVersionEscaped = "\'" + buildVersion + "\'"
    buildVersionEscaped = buildVersionEscaped.replace(" ", "|")

    sourceChanged = False

    log.write("[tbox] Pulling source tree\n")

    for (module, moduleSource) in reposModules:
        moduleDir = os.path.join(workingDir, module)

        if os.path.exists(moduleDir):
            log.write("[tbox] Checking for source updates\n")
            print "updating %s" % module

            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutputRetry(
                [svnProgram, "up"])

            hardhatutil.dumpOutputList(outputList, log)

            if NeedsUpdate(outputList):
                sourceChanged = True
                log.write("[tbox] %s modified\n" % module)
            else:
                log.write("[tbox] %s unchanged\n" % module)

        else:
            svnSource = os.path.join(reposRoot, moduleSource)

            log.write("[tbox] Retrieving source tree [%s]\n" % svnSource)
            print "pulling %s" % module

            os.chdir(workingDir)

            outputList = hardhatutil.executeCommandReturnOutputRetry(
                [svnProgram, "-q", "co", svnSource, module])

            hardhatutil.dumpOutputList(outputList, log)

            sourceChanged = True

    os.chdir(workingDir)

    doBuild(workingDir, log)

    if skipTests:
        ret = 'success'
    else:
        ret = doTests(workingDir, log)

    if sourceChanged:
        doDistribution(workingDir, log, outputDir, buildVersion,
                       buildVersionEscaped)

        changes = "-changes"
    else:
        changes = "-nochanges"

    print ret + changes

    return ret + changes
示例#25
0
    buildVersionEscaped = buildVersionEscaped.replace(" ", "|")

    if not os.path.exists(chanDir):
        # Initialize sources
        print "Setup source tree..."
        log.write("- - - - tree setup - - - - - - -\n")

        for module in reposModules:
            svnSource = os.path.join(reposRoot, reposBase, module)

            log.write("[tbox] Retrieving source tree [%s]\n" % svnSource)

            outputList = hardhatutil.executeCommandReturnOutputRetry(
                [svnProgram, "-q", "co", svnSource, module])

            hardhatutil.dumpOutputList(outputList, log)

        os.chdir(chanDir)

        for releaseMode in releaseModes:
            doInstall(releaseMode, workingDir, log)

            doDistribution(releaseMode, workingDir, log, outputDir,
                           buildVersion, buildVersionEscaped, hardhatScript)

            if skipTests:
                ret = 'success'
            else:
                ret = doTests(hardhatScript, releaseMode, workingDir,
                              outputDir, buildVersion, log)
                if ret != 'success':
示例#26
0
def doBuild(buildmode, workingDir, log, svnChanges, clean='realclean'):
    # We only build external if there were changes in it
    # We build internal if external or internal were changed
    # We never build in chandler, because there is nothing to build
    if buildmode == "debug":
        dbgStr = "DEBUG=1"
    else:
        dbgStr = ""

    buildRoot = os.path.join(workingDir, 'external')
    print 'Setting BUILD_ROOT=', buildRoot
    log.write('Setting BUILD_ROOT=' + buildRoot + '\n')
    os.putenv('BUILD_ROOT', buildRoot)

    try:
        for module in reposModules:
            print module, "..."
            log.write("- - - - " + module + " - - - - - - -\n")

            if module == 'external' and not svnChanges['external']:
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue
            if module == 'internal' and not svnChanges[
                    'external'] and not svnChanges['internal']:
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue
            if module == 'chandler':
                print 'Nothing to be done for module', module
                log.write('Nothing to be done for module ' + module + '\n')
                log.write(separator)
                continue

            moduleDir = os.path.join(workingDir, module)
            print "cd", moduleDir
            log.write("cd " + moduleDir + "\n")
            os.chdir(moduleDir)

            buildCmds = ' all binaries install'

            print "Doing make " + dbgStr + " " + clean + buildCmds + "\n"
            log.write("Doing make " + dbgStr + " " + clean + buildCmds + "\n")

            outputList = hardhatutil.executeCommandReturnOutput(
                [buildenv['make'], dbgStr, clean, buildCmds])
            hardhatutil.dumpOutputList(outputList, log)

            log.write(separator)

    except hardhatutil.ExternalCommandErrorWithOutputList, e:
        print "build error"
        log.write("***Error during build***\n")
        log.write(separator)
        log.write("Build log:" + "\n")
        hardhatutil.dumpOutputList(e.outputList, log)
        log.write(separator)
        forceBuildNextCycle(log, workingDir)
        raise e
示例#27
0
def Start(hardhatScript, workingDir, buildVersion, clobber, log, skipTests=False, upload=False):

    # make sure workingDir is absolute
    workingDir = os.path.abspath(workingDir)

    os.chdir(workingDir)

    # remove outputDir and create it
    outputDir = os.path.join(workingDir, "output")

    if os.path.exists(outputDir):
        hardhatutil.rmdirRecursive(outputDir)

    os.mkdir(outputDir)

    buildVersionEscaped = "'" + buildVersion + "'"
    buildVersionEscaped = buildVersionEscaped.replace(" ", "|")

    sourceChanged = False

    log.write("[tbox] Pulling source tree\n")

    for (module, moduleSource) in reposModules:
        moduleDir = os.path.join(workingDir, module)

        if os.path.exists(moduleDir):
            log.write("[tbox] Checking for source updates\n")
            print "updating %s" % module

            os.chdir(moduleDir)

            outputList = hardhatutil.executeCommandReturnOutputRetry([svnProgram, "up"])

            hardhatutil.dumpOutputList(outputList, log)

            if NeedsUpdate(outputList):
                sourceChanged = True
                log.write("[tbox] %s modified\n" % module)
            else:
                log.write("[tbox] %s unchanged\n" % module)

        else:
            svnSource = os.path.join(reposRoot, moduleSource)

            log.write("[tbox] Retrieving source tree [%s]\n" % svnSource)
            print "pulling %s" % module

            os.chdir(workingDir)

            outputList = hardhatutil.executeCommandReturnOutputRetry([svnProgram, "-q", "co", svnSource, module])

            hardhatutil.dumpOutputList(outputList, log)

            sourceChanged = True

    os.chdir(workingDir)

    doBuild(workingDir, log)

    if skipTests:
        ret = "success"
    else:
        ret = doTests(workingDir, log)

    if sourceChanged:
        doDistribution(workingDir, log, outputDir, buildVersion, buildVersionEscaped)

        changes = "-changes"
    else:
        changes = "-nochanges"

    print ret + changes

    return ret + changes
示例#28
0
          # Initialize sources
        print "Setup source tree..."
        log.write("- - - - tree setup - - - - - - -\n")

        svnChanges = {}
        clean      = ''

        for module in reposModules:
            svnSource = os.path.join(reposRoot, reposBase, module)
    
            log.write("[tbox] Retrieving source tree [%s]\n" % svnSource)
                     
            outputList = hardhatutil.executeCommandReturnOutputRetry(
             [svnProgram, "-q", "co", svnSource, module])

            hardhatutil.dumpOutputList(outputList, log) 

            svnChanges[module] = True

        for releaseMode in releaseModes:
            doBuild(releaseMode, workingDir, log, svnChanges, clean)
            
            if upload:
                doUploadToStaging(releaseMode, workingDir, buildVersion, log)

            clean = 'clean'

        for releaseMode in releaseModes:
            doDistribution(releaseMode, workingDir, log, outputDir, buildVersion, buildVersionEscaped, hardhatScript)

        if skipTests: