Ejemplo n.º 1
0
def radiant_makeversion(append_about):
  (line, major, minor) = get_version()
  f = open('include/version.h', 'w')
  f.write('// generated header, see makeversion.py\n')
  f.write('#define RADIANT_VERSION "%s"\n' % line)
  f.write('#define RADIANT_MINOR_VERSION "%s"\n' % minor)
  f.write('#define RADIANT_MAJOR_VERSION "%s"\n' % major)
  f.close()
  f = open('include/RADIANT_MINOR', 'w')
  f.write(minor)
  f.close()
  f = open('include/RADIANT_MAJOR', 'w')
  f.write(major)
  f.close()
  f = open('include/version', 'w')
  f.write(line)
  f.close()
  # aboutmsg
  aboutfile = 'include/aboutmsg.default'
  if ( os.environ.has_key('RADIANT_ABOUTMSG') ):
    aboutfile = os.environ['RADIANT_ABOUTMSG']
  line = None
  if os.path.isfile(aboutfile):
    sys.stdout.write("about message is in %s\n" % aboutfile)
    f = open(aboutfile, 'r')
    line = f.readline()
    f.close()
  else:
    line = "Custom build based on revision " + str(svn.getRevision(os.getcwd()))
  # optional additional message
  if ( not append_about is None ):
    line += append_about
  sys.stdout.write("about: %s\n" % line)
  f = open('include/aboutmsg.h', 'w')
  f.write('// generated header, see makeversion.py\n')
  f.write('#define RADIANT_ABOUTMSG "%s"\n' % line)
  f.close()
Ejemplo n.º 2
0
def radiant_makeversion(append_about):
    (line, major, minor) = get_version()
    f = open("include/version.h", "w")
    f.write("// generated header, see makeversion.py\n")
    f.write('#define RADIANT_VERSION "%s"\n' % line)
    f.write('#define RADIANT_MINOR_VERSION "%s"\n' % minor)
    f.write('#define RADIANT_MAJOR_VERSION "%s"\n' % major)
    f.close()
    f = open("include/RADIANT_MINOR", "w")
    f.write(minor)
    f.close()
    f = open("include/RADIANT_MAJOR", "w")
    f.write(major)
    f.close()
    f = open("include/version", "w")
    f.write(line)
    f.close()
    # aboutmsg
    aboutfile = "include/aboutmsg.default"
    if os.environ.has_key("RADIANT_ABOUTMSG"):
        aboutfile = os.environ["RADIANT_ABOUTMSG"]
    line = None
    if os.path.isfile(aboutfile):
        sys.stdout.write("about message is in %s\n" % aboutfile)
        f = open(aboutfile, "r")
        line = f.readline()
        f.close()
    else:
        line = "Custom build based on revision " + str(svn.getRevision(os.getcwd()))
    # optional additional message
    if not append_about is None:
        line += append_about
    sys.stdout.write("about: %s\n" % line)
    f = open("include/aboutmsg.h", "w")
    f.write("// generated header, see makeversion.py\n")
    f.write('#define RADIANT_ABOUTMSG "%s"\n' % line)
    f.close()
Ejemplo n.º 3
0
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)