Exemplo n.º 1
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
Exemplo n.º 2
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
Exemplo n.º 3
0
Notes:
Start() is responsible for capturing all pertinent output to the open file
object, log.  True is returned if a new build was created, False is returned
if no code has changed, and an exception is raised if there are problems.
"""

# To appease older Pythons:
True = 1
False = 0

import os, hardhatutil, hardhatlib, sys, re

path = os.environ.get('PATH', os.environ.get('path'))
whereAmI = os.path.dirname(os.path.abspath(hardhatlib.__file__))

svnProgram = hardhatutil.findInPath(path, "svn")
treeName = "Chandler"
sleepMinutes = 5
logPath = 'hardhat.log'
separator = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"

reposRoot = 'http://svn.osafoundation.org/chandler'
reposModules = ['chandler', 'internal/installers']
mainModule = reposModules[0]

releaseModes = ('debug', 'release')


def Start(hardhatScript,
          workingDir,
          buildVersion,
Exemplo n.º 4
0
"""
Notes:
Start() is responsible for capturing all pertinent output to the open file
object, log.  True is returned if a new build was created, False is returned
if no code has changed, and an exception is raised if there are problems.
"""

import os, hardhatutil, hardhatlib, sys, re

path       = os.environ.get('PATH', os.environ.get('path'))
whereAmI   = os.path.dirname(os.path.abspath(hardhatlib.__file__))
svnProgram = hardhatutil.findInPath(path, "svn")

treeName     = "Chandler" 
sleepMinutes = 5
logPath      = 'hardhat.log'
separator    = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"

reposRoot    = 'http://svn.osafoundation.org/chandler'
reposBase    = 'trunk'
reposModules = ['external', 'internal', 'chandler']
releaseModes = ('debug', 'release')

def Start(hardhatScript, workingDir, buildVersion, clobber, log, skipTests=False, upload=False):

    global buildenv, changes

    try:
        buildenv = hardhatlib.defaults
        buildenv['root'] = workingDir
        buildenv['hardhatroot'] = whereAmI
Exemplo n.º 5
0
"""
Notes:
Start() is responsible for capturing all pertinent output to the open file
object, log.  True is returned if a new build was created, False is returned
if no code has changed, and an exception is raised if there are problems.
"""

import os, sys, re
import hardhatutil, hardhatlib

path = os.environ.get("PATH", os.environ.get("path"))
whereAmI = os.path.dirname(os.path.abspath(hardhatlib.__file__))
svnProgram = hardhatutil.findInPath(path, "svn")
antProgram = hardhatutil.findInPath(path, "maven")
logPath = "hardhat.log"
separator = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"

treeName = "Cosmo"
sleepMinutes = 30

reposRoot = "http://svn.osafoundation.org/server"
reposModules = [("cosmo", "cosmo/trunk")]
reposBuild = [("cosmo", "clean build")]
reposTest = [("cosmo", "test")]
reposDist = [("cosmo", "dist:release", "dist", "cosmo*.tar.gz")]


def Start(hardhatScript, workingDir, buildVersion, clobber, log, skipTests=False, upload=False):

    # make sure workingDir is absolute
    workingDir = os.path.abspath(workingDir)
Exemplo n.º 6
0
def main():
    global buildscriptFile, buildDir, fromAddr, mailtoAddr, alertAddr, adminAddr, defaultDomain, defaultRsyncServer

      # this is a sane default - the "true" value is pulled from the module being built
    treeName = "Chandler"

    parser = OptionParser(usage="%prog [options] buildName", version="%prog 1.2")
    parser.add_option("-t", "--toAddr", action="store", type="string", dest="toAddr",
      default=mailtoAddr, help="Where to mail script reports\n"
      " [default] " + mailtoAddr + defaultDomain)
    parser.add_option("-p", "--project", action="store", type="string", dest="project",
      default="newchandler", help="Name of script to use (without .py extension)\n"
      "[default] newchandler")
    parser.add_option("-o", "--output", action="store", type="string", dest="outputDir",
      default=os.path.join(os.environ['HOME'],"output"), help="Name of temp output directory\n"
      " [default] ~/output")
    parser.add_option("-a", "--alert", action="store", type="string", dest="alertAddr",
      default=alertAddr, help="E-mail to notify on build errors \n"
      " [default] " + alertAddr + defaultDomain)
    parser.add_option("-r", "--rsyncServer", action="store", type="string", dest="rsyncServer",
      default=defaultRsyncServer, help="Net address of server where builds get uploaded \n"
      " [default] " + defaultRsyncServer)
    parser.add_option("-s", "--skipRSync", action="store_true", dest="skipRsync",
      default=False, help="Skip rsync step \n"
      " [default] False")
    parser.add_option("-u", "--uploadStaging", action="store_true", dest="uploadStaging",
      default=False, help="Upload tarballs to staging area \n"
      " [default] False")
    parser.add_option("-S", "--skipTests", action="store_true", dest="skipTests",
      default=False, help="Skip Unit Tests \n"
      " [default] False")
    parser.add_option("-w", "--work", action="store", type="string", dest="buildDir",
      default=buildDir, help="Name of working directory\n"
      " [default] ~/tinderbuild")

    (options, args) = parser.parse_args()
    if len(args) < 1:
        parser.print_help()
        parser.error("You must at least provide a name for your build")

    curDir     = os.path.abspath(os.getcwd())
    buildName  = args[0]
    fromAddr  += defaultDomain
    mailtoAddr = options.toAddr
    alertAddr  = options.alertAddr
    buildDir   = options.buildDir

    if mailtoAddr.find('@') == -1:
        mailtoAddr += defaultDomain

    if alertAddr.find('@') == -1:
        alertAddr += defaultDomain

    skipRsync     = options.skipRsync
    uploadStaging = options.uploadStaging

    buildscriptFile = os.path.join("buildscripts", options.project + ".py")

    outputDir = os.path.abspath(options.outputDir)

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

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

    path       = os.environ.get('PATH', os.environ.get('path'))
    svnProgram = hardhatutil.findInPath(path, "svn")

    if not skipRsync:
        rsyncProgram = hardhatutil.findInPath(path, "rsync")

    startInt  = int(time.time())
    startTime = str(startInt)

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

    print "Starting:", nowString, buildVersion, buildDir

    os.chdir(curDir)

    log = open(logFile, "w")
    log.write("Start: " + nowString + "\n")

    try:
        # load (or reload) the buildscript file for the project
        mod = hardhatutil.ModuleFromFile(buildscriptFile, "buildscript")

        treeName     = mod.treeName
        sleepMinutes = mod.sleepMinutes

        SendMail(fromAddr, mailtoAddr, startTime, buildName, "building", treeName, None)

        ret = mod.Start(hardhatFile, buildDir, buildVersion, 0, log, 
                        upload=options.uploadStaging, skipTests=options.skipTests)

    except TinderbuildError, e:
        print e
        print "Tinderbuild:  Build failed"
        log.write("Tinderbuild:  Build failed\n")
        status = "build_failed"
        log.close()

        log = open(logFile, "r")
        logContents = log.read()
        log.close()
        SendMail(fromAddr, alertAddr, startTime, buildName,
                 "The build failed", treeName, None)
        SendMail(fromAddr, mailtoAddr, startTime, buildName, status, 
         treeName, logContents)
        log = open(logFile, "w")
Exemplo n.º 7
0
def main():
    global project

    nowString = time.strftime("%Y-%m-%d %H:%M:%S")
    nowShort = hardhatutil.RemovePunctuation(nowString)
    # nowString is the current time, in a SVN-compatible format
    print nowString
    # nowShort is nowString without punctuation or whitespace
    print nowShort

    try:
        opts, args = getopt.getopt(sys.argv[1:], "b:d:m:p:t:n:s")
    except getopt.GetoptError:
        usage()
        sys.exit(1)

    buildVersionArg = None
    svnDateArg = None
    toAddrArg = None
    projectArg = None
    svnTagArg = None
    buildName = 'buildname'
    noTests = 0

    for opt, arg in opts:

        if opt == "-b":
            buildVersionArg = arg

        if opt == "-d":
            svnDateArg = arg

        if opt == "-m":
            toAddrArg = arg

        if opt == "-p":
            projectArg = arg

        if opt == "-t":
            svnTagArg = arg

        if opt == "-n":
            buildName = arg

        if opt == "-s":
            noTests = 1

    if svnDateArg and svnTagArg:
        print "Please choose either a svn date or tag, not both"
        sys.exit(1)

    # defaults:
    if projectArg:
        project = projectArg

    if toAddrArg:
        toAddr = toAddrArg
    else:
        toAddr = None

    buildVersion = nowString

    if svnDateArg:
        buildVersion = svnDateArg
    if svnTagArg:
        buildVersion = svnTagArg
    if buildVersionArg:
        buildVersion = buildVersionArg

    print "nowString", nowString
    print "nowShort", nowShort
    print "buildVersion", buildVersion
    print "buildName", buildName
    print "skipTests=", noTests

    # buildVersion is encoded into the application's internal version

    whereAmI = os.path.dirname(os.path.abspath(hardhatutil.__file__))
    hardhatFile = os.path.join(whereAmI, "hardhat.py")

    homeDir = os.environ['HOME']
    buildDir = os.path.join(homeDir, "singlebuild")
    logFile = os.path.join(buildDir, "build.log")
    buildscriptFile = os.path.join("buildscripts", project + ".py")
    fromAddr = "builds"
    fromAddr += "@"
    fromAddr += "osafoundation.org"
    print "Mail to ", toAddr
    print "Build dir", buildDir
    print "Build file ", buildscriptFile

    curDir = os.path.abspath(os.getcwd())

    if os.path.exists(buildDir):
        hardhatutil.rmdirRecursive(buildDir)
    os.mkdir(buildDir)

    path = os.environ.get('PATH', os.environ.get('path'))
    svnProgram = hardhatutil.findInPath(path, "svn")

    log = open(logFile, "w+")
    try:
        # bring this hardhat directory up to date
        outputList = hardhatutil.executeCommandReturnOutputRetry(
            [svnProgram, "update"])

        # load the buildscript file for the project
        mod = hardhatutil.ModuleFromFile(buildscriptFile, "buildscript")

        # SendMail(fromAddr, toAddr, nowString, nowString, buildName,
        # "building", None)

        mod.Start(hardhatFile,
                  buildDir,
                  buildVersion,
                  1,
                  log,
                  skipTests=noTests,
                  tagID=svnTagArg)

    except Exception, e:
        import traceback
        traceback.print_exc()
        print "something failed"
        log.write("something failed")
        status = "build_failed"
Exemplo n.º 8
0
"""
Notes:
Start() is responsible for capturing all pertinent output to the open file
object, log.  True is returned if a new build was created, False is returned
if no code has changed, and an exception is raised if there are problems.
"""

import os, sys, re
import hardhatutil, hardhatlib

path = os.environ.get('PATH', os.environ.get('path'))
whereAmI = os.path.dirname(os.path.abspath(hardhatlib.__file__))
svnProgram = hardhatutil.findInPath(path, "svn")
antProgram = hardhatutil.findInPath(path, "maven")
logPath = 'hardhat.log'
separator = "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -\n"

treeName = "Cosmo"
sleepMinutes = 30

reposRoot = 'http://svn.osafoundation.org/server'
reposModules = [
    (
        'cosmo',
        'cosmo/trunk',
    ),
]
reposBuild = [
    ('cosmo', 'clean build'),
]
reposTest = [
Exemplo n.º 9
0
def main():
    global project
    
    nowString = time.strftime("%Y-%m-%d %H:%M:%S")
    nowShort = hardhatutil.RemovePunctuation(nowString)
    # nowString is the current time, in a SVN-compatible format
    print nowString
    # nowShort is nowString without punctuation or whitespace
    print nowShort

    try:
        opts, args = getopt.getopt(sys.argv[1:], "b:d:m:p:t:n:s")
    except getopt.GetoptError:
        usage()
        sys.exit(1)

    buildVersionArg = None
    svnDateArg = None
    toAddrArg = None
    projectArg = None
    svnTagArg = None
    buildName = 'buildname'
    noTests = 0

    for opt, arg in opts:

        if opt == "-b":
            buildVersionArg = arg

        if opt == "-d":
            svnDateArg = arg

        if opt == "-m":
            toAddrArg = arg

        if opt == "-p":
            projectArg = arg

        if opt == "-t":
            svnTagArg = arg

        if opt == "-n":
            buildName = arg

        if opt == "-s":
            noTests = 1

    if svnDateArg and svnTagArg:
        print "Please choose either a svn date or tag, not both"
        sys.exit(1)

    # defaults:
    if projectArg:
        project = projectArg
        
    if toAddrArg:
        toAddr  = toAddrArg
    else:
        toAddr = None

    buildVersion = nowString

    if svnDateArg:
        buildVersion = svnDateArg
    if svnTagArg:
        buildVersion = svnTagArg
    if buildVersionArg:
        buildVersion = buildVersionArg

    print "nowString", nowString
    print "nowShort", nowShort
    print "buildVersion", buildVersion
    print "buildName", buildName
    print "skipTests=", noTests

    # buildVersion is encoded into the application's internal version

    whereAmI = os.path.dirname(os.path.abspath(hardhatutil.__file__))
    hardhatFile = os.path.join(whereAmI, "hardhat.py")

    homeDir = os.environ['HOME']
    buildDir = os.path.join(homeDir, "singlebuild")
    logFile = os.path.join(buildDir, "build.log")
    buildscriptFile = os.path.join("buildscripts", project + ".py")
    fromAddr = "builds"
    fromAddr += "@"
    fromAddr += "osafoundation.org"
    print "Mail to ", toAddr
    print "Build dir", buildDir
    print "Build file ", buildscriptFile

    curDir = os.path.abspath(os.getcwd())

    if os.path.exists(buildDir):
        hardhatutil.rmdirRecursive(buildDir)
    os.mkdir(buildDir)

    path = os.environ.get('PATH', os.environ.get('path'))
    svnProgram = hardhatutil.findInPath(path, "svn")

    log = open(logFile, "w+")
    try:
        # bring this hardhat directory up to date
        outputList = hardhatutil.executeCommandReturnOutputRetry([svnProgram, "update"])

        # load the buildscript file for the project
        mod = hardhatutil.ModuleFromFile(buildscriptFile, "buildscript")

        # SendMail(fromAddr, toAddr, nowString, nowString, buildName,
        # "building", None)

        mod.Start(hardhatFile, buildDir, buildVersion, 1, log, skipTests=noTests, tagID=svnTagArg)

    except Exception, e:
        import traceback
        traceback.print_exc()
        print "something failed"
        log.write("something failed")
        status = "build_failed"