def build_win32(srcdir, builddir, installdir, assertions, customerRelease): log.info("build_win32: srcdir = '%s'", srcdir) log.info("build_win32: builddir = '%s'", builddir) log.info("build_win32: installdir = '%s'", installdir) # deprecated os.environ["NTA"] = installdir # These are what I would like to use. Currently only used by the test project os.environ["NTAX_INSTALL_DIR"] = installdir os.environ["NTAX_BUILD_DIR"] = builddir log.debug("build_win32: srcdir: '%s'", srcdir) log.debug("build_win32: installdir: '%s'", installdir) log.debug("build_win32: builddir: '%s'", builddir) # how to quote "Release|Win32" so that it doesn't cause an error? # command = ["vcbuild", "/logcommands", "/showenv", "/time", os.path.join(srcdir, "trunk.sln")] utils.changeDir(srcdir) if customerRelease: import glob solutionFiles = glob.glob("*.sln") if len(solutionFiles) == 0: raise Exception("Unable to find any solution files in customer source release") elif len(solutionFiles) > 1: raise Exception("More than one solution file found in customer source release: %s" % solutionFiles) command = 'vcbuild /logcommands /showenv /time %s "Release|Win32"' % solutionFiles[0] else: command = 'vcbuild /logcommands /showenv /time trunk.sln "Release|Win32"' utils.runCommand(command) postbuild_win32(srcdir, installdir)
def prepareSourceTree(srcdir, customerRelease=False): if not customerRelease: # import setup.py from src/build_system buildsystemdir = os.path.join(srcdir, "build_system") if sys.path[0] != buildsystemdir: if buildsystemdir in sys.path: sys.path.remove(buildsystemdir) sys.path.insert(0, buildsystemdir) import setup setup.setup(srcdir) # Run autogen.sh if sys.platform != "win32": origDir = os.getcwd() # autogen.sh in the source dir try: utils.changeDir(srcdir) utils.runCommand('sh build_system/unix/autogen.sh') finally: utils.changeDir(origDir)
def build_unix(srcdir, builddir, installdir, assertions, customerRelease=False, nprocs=1): # VPATH configure utils.changeDir(builddir) if assertions: assertstr="yes" else: assertstr="no" utils.runCommand('%s/configure --disable-debugsymbols --enable-assertions=%s --prefix=%s' % (srcdir, assertstr, installdir)) # # Build the software. Use make -k rather than make so that we see all errors, not just the first # Any error will result in an exception from runCommand # if nprocs != 1: utils.runCommand('make -j %s -k' % nprocs) else: utils.runCommand('make -k') # Install if customerRelease: utils.runCommand('make install') else: utils.runCommand('make install')
def buildit(rootdir, srcdir, builddir, installdir, svnpath, stamp, revision, datestamp, assertions, update, nprocs=1): """ Do a full checkout and build """ arch = getArch() log.info("Building for architecture " + arch) # # If source dir already exists, we're doing an incremental checkout. If not, we're # doing a full checkout. # incremental = True if not os.path.exists(srcdir): if not update: log.error("No svn update requested, but source dir '%s' does not exist.", srcdir) raise Exception() else: incremental = False log.info("Source directory %s does not exist. Will do a full checkout", srcdir) else: if not os.path.isdir(srcdir): log.error("Source directory %s is not a directory.", srcdir) raise Exception() log.debug("Creating release directory %s", installdir) utils.createDir(installdir, True) utils.changeDir(os.path.join(installdir, os.pardir)) buildfilename = os.path.join(installdir, ".buildinfo") # # Bring source tree up to date if requested # if update: log.info("Bringing source tree up to date at svnpath %s revision %s", svnpath, revision) svn.checkout(srcdir, repo=svnpath, revision=revision, incremental=incremental, keepLocalMods=False) else: log.warn("Skipping bringing up to date. Build will be tainted") utils.touchFile(os.path.join(installdir, "TAINTED_BUILD")) # # Revision may not be a number. May be "HEAD" or "PREV" or something else, so # retrieve it from svn # revisionnum = svn.getRevision(srcdir) # # place a temporary file in the install dir to indicate a build in progress # the file is removed at the end of the build process # build_in_progress_filename = os.path.join(installdir,"UNFINISHED_BUILD." + arch) utils.touchFile(build_in_progress_filename) log.debug("Updating build description file " + buildfilename) try: f = open(buildfilename, mode = "a") print >> f, "=============================" print >> f, "Timestamp: " + datestamp print >> f, "Arch: " + arch print >> f, "Buildhost: " + platform.node() print >> f, "Svnpath: " + svnpath print >> f, "Revision: " + str(revisionnum) print >> f, "Rootdir: " + rootdir print >> f, "Srcdir: " + srcdir print >> f, "Stamp: " + stamp print >> f, "Assertions:" + str(assertions) print >> f, "Update: " + str(update) print >> f, "" f.close() except Exception, e: raise Exception("Error writing to build description file '%s'", buildfilename)
def buildPlugins(binaryTarball, pluginTarball, srcDir, integrateScript=None, pluginList=None): """ Test a plugin source release by 1. extract binary tarball 2. extract algorithm source tarball 3. integrate test code into algorithm source tarball if integrate script is not None, run: integrateScript algorithmSrcDir srcDir 4. build from algorithm source and install into binary release 4a. move all plugins from lib to testlib directory in binary release @param binaryTarball Absolute pathname to the binary tarball @param pluginTarball Absolute path to plugin source release tarball @param srcDir Absolute path to source tree (where tests may reside) @param integrateScript Script for integrating test code into algorithm source directory @param testlist Name of testlist. If None, no tests are performed. @param short If True, short version of tests is run @param pluginList File containing a list of directories that will be integrated into the source Must be set if integrateScript is set @retval tuple of (binaryDir, tmpDir) binaryDir is in tmpDir; tmpDir must be deleted by called """ # XXX PORT FOR WINDOWS # METHOD IS CURRENTLY UNUSED? if integrateScript is not None: assert os.path.exists(integrateScript), "integrateScript '%s' does not exist" % integrateScript assert pluginList is not None assert os.path.exists(pluginList), "pluginList '%s' does not exist" % pluginList tmpDir = utils.backquote("mktemp -d -q /tmp/plugin_test.XXXXXX") binaryDir = utils.extractArchive(binaryTarball, tmpDir) pluginSrcDir = utils.extractArchive(pluginTarball, tmpDir) try: # Move the original plugins out of the way. Save them in case we want to use t hem. libDir = os.path.join(binaryDir, "lib") origPluginDir = os.path.join(binaryDir, "origLib") os.mkdir(origPluginDir) for file in os.listdir(libDir): (base, ext) = os.path.splitext(file) if ext == ".so" or ext == ".dylib": os.rename(os.path.join(libDir, file), os.path.join(origPluginDir, file)) if integrateScript is not None: command = ["python", integrateScript, pluginSrcDir, srcDir, pluginList] utils.runCommand(command) buildDir = os.path.join(tmpDir, "build") os.mkdir(buildDir) if integrateScript is not None: utils.changeDir(pluginSrcDir) command = "/bin/sh autogen.sh" utils.runCommand(command) # configure utils.changeDir(buildDir) command = "%s/configure --prefix=%s" % (pluginSrcDir, binaryDir) utils.runCommand(command) # build command = "make -k install" utils.runCommand(command) # With an integrate script, put all the plugins in a "testLib" directory # and let the tests copy in the plugins they need if integrateScript is not None: testPluginDir = os.path.join(binaryDir, "testLib") os.mkdir(testPluginDir) for file in os.listdir(libDir): (base, ext) = os.path.splitext(file) if ext == ".so" or ext == ".dylib": os.rename(os.path.join(libDir, file), os.path.join(testPluginDir, file)) except Exception, e: # import traceback # traceback.print_exc() raise Exception("Caught exception in integrate/build: %s" % e)
buildCustomerRelease(releaseType, srcDir, releaseTarball, binaryTarball, testdir, nprocs=nprocs) except Exception, e: log.error("Source release failed: %s", e) failed = ["build source release"] if len(failed) == 0: if buildOnly: passed = ["build source release"] failed = list() disabled = list() else: utils.setupCleanEnvironment(testdir) (passed, failed, disabled) = test.runTests(testdir, srcDir, short=short, testlist=testlist, nprocs=nprocs) # make sure we're not in the directory we're about to remove utils.changeDir("/") if len(failed) == 0: utils.remove(tmpDir, throwOnError=False) else: newname = tmpDir + "_failed"; try: os.rename(tmpDir, newname) except: log.warn("Unable to rename directory %s to %s after failure", tmpDir, newname) return (passed, failed, disabled) def buildPlugins(binaryTarball, pluginTarball, srcDir, integrateScript=None, pluginList=None): """ Test a plugin source release by 1. extract binary tarball