* ./bootstrap/buildCoriolis.py:

- New: Support for tarball directly from the user checkout (--user-tarball).
    - New: Full parametrization through a "build.conf" file.
    - Change: Uses user-defined exceptions to terminate.
    - New: guessOs() now detect FreeBSD 8.

  * ./bootstrap/coriolisEnv.py,
    ./bootstrap/coriolis2.sh:
    - Bug: 'lib64' instead of '64' under Linux.
    - New: guessOs() now detect FreeBSD 8.
    - Change: Remove support for Coriolis 1. No more --v2 option either, Coriolis2
        selected by default. Python paths also set by default.
This commit is contained in:
Jean-Paul Chaput 2012-11-16 12:46:27 +00:00
parent bb29bc3057
commit c18e875143
3 changed files with 410 additions and 258 deletions

View File

@ -4,12 +4,73 @@ import sys
import re import re
import os import os
import os.path import os.path
import time import datetime
import socket import socket
import subprocess import subprocess
import optparse import optparse
class ErrorMessage ( Exception ):
def __init__ ( self, code, *arguments ):
self._code = code
self._errors = [ 'Malformed call to ErrorMessage()'
, '%s' % str(arguments) ]
text = None
if len(arguments) == 1:
if isinstance(arguments[0],Exception): text = str(arguments[0]).split('\n')
else:
self._errors = arguments[0]
elif len(arguments) > 1:
text = list(arguments)
if text:
self._errors = []
while len(text[0]) == 0: del text[0]
lstrip = 0
if text[0].startswith('[ERROR]'): lstrip = 8
for line in text:
if line[0:lstrip ] == ' '*lstrip or \
line[0:lstrip-1] == '[ERROR]':
self._errors += [ line[lstrip:] ]
else:
self._errors += [ line.lstrip() ]
return
def __str__ ( self ):
if not isinstance(self._errors,list):
return "[ERROR] %s" % self._errors
formatted = "\n"
for i in range(len(self._errors)):
if i == 0: formatted += "[ERROR] %s" % self._errors[i]
else: formatted += " %s" % self._errors[i]
if i+1 < len(self._errors): formatted += "\n"
return formatted
def addMessage ( self, message ):
if not isinstance(self._errors,list):
self._errors = [ self._errors ]
if isinstance(message,list):
for line in message:
self._errors += [ line ]
else:
self._errors += [ message ]
return
def terminate ( self ):
print self
sys.exit(self._code)
def _getCode ( self ): return self._code
code = property(_getCode)
class Project: class Project:
def __init__ ( self, name, tools, repository ): def __init__ ( self, name, tools, repository ):
@ -53,8 +114,14 @@ class ProjectBuilder:
self._projects = [] self._projects = []
self._standalones = [] self._standalones = []
self._svnTag = "x" self._svnTag = "x"
self._svnMethod = "svn+ssh://coriolis.soc.lip6.fr" self._svnMethod = None
self._rootDir = os.path.join ( os.environ["HOME"], "coriolis-2.x" ) self._projectDir = 'coriolis-2.x'
self._rootDir = os.path.join ( os.environ["HOME"], self._projectDir )
self._packageName = None
self._packageVersion = None
self._packageExcludes = []
self._packageProject = []
self._quiet = False self._quiet = False
self._buildMode = "Release" self._buildMode = "Release"
self._rmBuild = False self._rmBuild = False
@ -81,7 +148,10 @@ class ProjectBuilder:
if attribute == "svnTag": self._svnTag = value if attribute == "svnTag": self._svnTag = value
elif attribute == "svnMethod": self._svnMethod = value elif attribute == "svnMethod": self._svnMethod = value
elif attribute == "projectDir": self._projectDir = value
elif attribute == "rootDir": self._rootDir = os.path.expanduser(value) elif attribute == "rootDir": self._rootDir = os.path.expanduser(value)
elif attribute == "packageName": self._packageName = value
elif attribute == "packageVersion": self._packageVersion = value
elif attribute == "quiet": self._quiet = value elif attribute == "quiet": self._quiet = value
elif attribute == "buildMode": self._buildMode = value elif attribute == "buildMode": self._buildMode = value
elif attribute == "rmBuild": self._rmBuild = value elif attribute == "rmBuild": self._rmBuild = value
@ -100,11 +170,14 @@ class ProjectBuilder:
def _updateSecondary ( self ): def _updateSecondary ( self ):
self._rootDir = os.path.join ( os.environ["HOME"], self._projectDir )
self._rpmbuildDir = os.path.join ( self._rootDir , "rpmbuild" ) self._rpmbuildDir = os.path.join ( self._rootDir , "rpmbuild" )
self._debbuildDir = os.path.join ( self._rootDir , "debbuild" ) self._debbuildDir = os.path.join ( self._rootDir , "debbuild" )
self._tmppathDir = os.path.join ( self._rpmbuildDir, "tmp" ) self._tmppathDir = os.path.join ( self._rpmbuildDir, "tmp" )
self._tarballDir = os.path.join ( self._rootDir , "tarball" ) self._tarballDir = os.path.join ( self._rootDir , "tarball" )
self._archiveDir = os.path.join ( self._tarballDir , "coriolis2-1.0.%s" % self._svnTag ) self._archiveDir = os.path.join ( self._tarballDir , "%s-%s.%s" % (self._packageName
,self._packageVersion
,self._svnTag) )
self._sourceDir = os.path.join ( self._rootDir , "src" ) self._sourceDir = os.path.join ( self._rootDir , "src" )
self._osDir = os.path.join ( self._rootDir self._osDir = os.path.join ( self._rootDir
, self._osType , self._osType
@ -115,14 +188,14 @@ class ProjectBuilder:
if self._enableShared == "ON": self._libMode = "Shared" if self._enableShared == "ON": self._libMode = "Shared"
else: self._libMode = "Static" else: self._libMode = "Static"
self._specFileIn = os.path.join ( self._sourceDir, "bootstrap", "coriolis2.spec.in" ) self._specFileIn = os.path.join ( self._sourceDir, "bootstrap", "%s.spec.in"%self._packageName )
self._specFile = os.path.join ( self._sourceDir, "bootstrap", "coriolis2.spec" ) self._specFile = os.path.join ( self._sourceDir, "bootstrap", "%s.spec" %self._packageName )
self._debianDir = os.path.join ( self._sourceDir, "bootstrap", "debian" ) self._debianDir = os.path.join ( self._sourceDir, "bootstrap", "debian" )
self._debChangelogIn = os.path.join ( self._debianDir, "changelog.in" ) self._debChangelogIn = os.path.join ( self._debianDir, "changelog.in" )
self._debChangelog = os.path.join ( self._debianDir, "changelog" ) self._debChangelog = os.path.join ( self._debianDir, "changelog" )
self._sourceTarBz2 = "coriolis2-1.0.%s.tar.bz2" % self._svnTag self._sourceTarBz2 = "%s-%s.%s.tar.bz2" % (self._packageName,self._packageVersion,self._svnTag)
self._binaryTarBz2 = "coriolis2-binary-1.0.%s-1.el5_soc.tar.bz2" % self._svnTag self._binaryTarBz2 = "%s-binary-%s.%s-1.slsoc6.tar.bz2" % (self._packageName,self._packageVersion,self._svnTag)
self._distribPatch = os.path.join ( self._sourceDir, "bootstrap", "coriolis2-for-distribution.patch" ) self._distribPatch = os.path.join ( self._sourceDir, "bootstrap", "%s-for-distribution.patch"%self._packageName )
return return
@ -134,6 +207,9 @@ class ProjectBuilder:
self._osSLSoC5x = re.compile (".*Linux.*(el5|2.6.23.13.*SoC).*") self._osSLSoC5x = re.compile (".*Linux.*(el5|2.6.23.13.*SoC).*")
self._osLinux_64 = re.compile (".*Linux.*x86_64.*") self._osLinux_64 = re.compile (".*Linux.*x86_64.*")
self._osLinux = re.compile (".*Linux.*") self._osLinux = re.compile (".*Linux.*")
self._osFreeBSD8x_amd64 = re.compile (".*FreeBSD 8.*amd64.*")
self._osFreeBSD8x_64 = re.compile (".*FreeBSD 8.*x86_64.*")
self._osFreeBSD8x = re.compile (".*FreeBSD 8.*")
self._osDarwin = re.compile (".*Darwin.*") self._osDarwin = re.compile (".*Darwin.*")
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
@ -152,6 +228,13 @@ class ProjectBuilder:
self._libSuffix = "64" self._libSuffix = "64"
elif self._osLinux .match(lines[0]): self._osType = "Linux.i386" elif self._osLinux .match(lines[0]): self._osType = "Linux.i386"
elif self._osDarwin .match(lines[0]): self._osType = "Darwin" elif self._osDarwin .match(lines[0]): self._osType = "Darwin"
elif self._osFreeBSD8x_amd64.match(lines[0]):
self._osType = "FreeBSD.8x.amd64"
self._libSuffix = "64"
elif self._osFreeBSD8x_64.match(lines[0]):
self._osType = "FreeBSD.8x.x86_64"
self._libSuffix = "64"
elif self._osFreeBSD8x .match(lines[0]): self._osType = "FreeBSD.8x.i386"
else: else:
uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-sr"], stdout=subprocess.PIPE )
self._osType = uname.stdout.readlines()[0][:-1] self._osType = uname.stdout.readlines()[0][:-1]
@ -220,8 +303,11 @@ class ProjectBuilder:
(pid,status) = os.waitpid ( child.pid, 0 ) (pid,status) = os.waitpid ( child.pid, 0 )
status >>= 8 status >>= 8
if status != 0: if status != 0:
print "[ERROR] %s (status:%d)." % (error,status) ErrorMessage( status, "%s (status:%d)."%(error,status) ).terminate()
sys.exit ( status ) return
def _enableTool ( self, tool ):
return return
@ -232,7 +318,7 @@ class ProjectBuilder:
#cmakeModules = os.path.join ( self._installDir, "share", "cmake", "Modules" ) #cmakeModules = os.path.join ( self._installDir, "share", "cmake", "Modules" )
if not os.path.isdir(toolSourceDir): if not os.path.isdir(toolSourceDir):
print "[ERROR] Missing tool source directory: \"%s\" (skipped)." % toolSourceDir print ErrorMessage( 0, "Missing tool source directory: \"%s\" (skipped)."%toolSourceDir )
return return
if self._rmBuild: if self._rmBuild:
@ -273,7 +359,8 @@ class ProjectBuilder:
command = [ "make" ] command = [ "make" ]
#command += [ "DESTDIR=%s" % self._installDir ] #command += [ "DESTDIR=%s" % self._installDir ]
if self._enableDoc == "ON": if self._enableDoc == "ON":
if tool == "crlcore" or tool == "stratus1": #if tool == "crlcore" or tool == "stratus1":
if tool == "stratus1":
command += [ "dvi", "safepdf", "html" ] command += [ "dvi", "safepdf", "html" ]
command += self._makeArguments command += self._makeArguments
print "Make command:", command print "Make command:", command
@ -286,7 +373,7 @@ class ProjectBuilder:
toolSourceDir = os.path.join ( self._sourceDir , tool ) toolSourceDir = os.path.join ( self._sourceDir , tool )
if not os.path.isdir(toolSourceDir): if not os.path.isdir(toolSourceDir):
if not self._quiet: if not self._quiet:
print "[ERROR] Missing tool source directory: \"%s\" (skipped)." % toolSourceDir print ErrorMessage( 0, "Missing tool source directory: \"%s\" (skipped)."%toolSourceDir )
return return
os.chdir ( toolSourceDir ) os.chdir ( toolSourceDir )
@ -301,7 +388,7 @@ class ProjectBuilder:
toolSourceDir = os.path.join ( self._sourceDir , tool ) toolSourceDir = os.path.join ( self._sourceDir , tool )
if not os.path.isdir(toolSourceDir): if not os.path.isdir(toolSourceDir):
if not self._quiet: if not self._quiet:
print "[ERROR] Missing tool source directory: \"%s\" (skipped)." % toolSourceDir print ErrorMessage( 0, "Missing tool source directory: \"%s\" (skipped)."%toolSourceDir)
return return
os.chdir ( toolSourceDir ) os.chdir ( toolSourceDir )
@ -315,11 +402,11 @@ class ProjectBuilder:
def _svnCheckout ( self, tool ): def _svnCheckout ( self, tool ):
project = self.getToolProject ( tool ) project = self.getToolProject ( tool )
if not project: if not project:
print "[ERROR] Tool \"%s\" is not part of any project." % tool print ErrorMessage( 0, "Tool \"%s\" is not part of any project."%tool
print " Cannot guess the SVN repository." ,"Cannot guess the SVN repository." )
return return
if not project.getRepository (): if not project.getRepository ():
print "[ERROR] Project \"%s\" isn't associated to a repository." % project.getName() print ErrorMessage( 0, "Project \"%s\" isn't associated to a repository."%project.getName() )
return return
toolSvnTrunkDir = os.path.join ( self._svnMethod+project.getRepository(), tool, "trunk" ) toolSvnTrunkDir = os.path.join ( self._svnMethod+project.getRepository(), tool, "trunk" )
@ -335,11 +422,11 @@ class ProjectBuilder:
def _svnExport ( self, tool ): def _svnExport ( self, tool ):
project = self.getToolProject ( tool ) project = self.getToolProject ( tool )
if not project: if not project:
print "[ERROR] Tool \"%s\" is not part of any project." % tool print ErrorMessage( 0, "Tool \"%s\" is not part of any project."%tool
print " Cannot guess the SVN repository." , "Cannot guess the SVN repository.")
return return
if not project.getRepository (): if not project.getRepository ():
print "[ERROR] Project \"%s\" isn't associated to a repository." % project.getName() print ErrorMessage( 0, "Project \"%s\" isn't associated to a repository."%project.getName() )
return return
toolSvnTrunkDir = os.path.join ( self._svnMethod+project.getRepository(), tool, "trunk" ) toolSvnTrunkDir = os.path.join ( self._svnMethod+project.getRepository(), tool, "trunk" )
@ -380,7 +467,7 @@ class ProjectBuilder:
def register ( self, project ): def register ( self, project ):
for registered in self._projects: for registered in self._projects:
if registered.getName() == project.getName(): if registered.getName() == project.getName():
print "[ERROR] Project \"%s\" is already registered (ignored)." print ErrorMessage( 0, "Project \"%s\" is already registered (ignored)." )
return return
self._projects += [ project ] self._projects += [ project ]
return return
@ -422,8 +509,7 @@ class ProjectBuilder:
for projectName in projects: for projectName in projects:
project = self.getProject ( projectName ) project = self.getProject ( projectName )
if not project: if not project:
print "[ERROR] No project of name \"%s\"." % projectName ErrorMessage( 1, "No project of name \"%s\"."%projectName ).terminate()
sys.exit ( 1 )
project.activateAll() project.activateAll()
if not tools and not projects: if not tools and not projects:
@ -441,6 +527,18 @@ class ProjectBuilder:
return return
def enable ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_enableTool" )
return
def enabledTools ( self ):
tools = []
for project in self._projects:
tools += project.getActives()
return tools
def build ( self, tools, projects ): def build ( self, tools, projects ):
self._commandTemplate ( tools, projects, "_build" ) self._commandTemplate ( tools, projects, "_build" )
return return
@ -466,7 +564,7 @@ class ProjectBuilder:
return return
def tarball ( self, tools, projects ): def svnTarball ( self, tools, projects ):
if self._svnTag == "x": if self._svnTag == "x":
self._guessSvnTag ( self.getProject(projects[0]) ) self._guessSvnTag ( self.getProject(projects[0]) )
@ -482,12 +580,8 @@ class ProjectBuilder:
os.makedirs ( self._tarballDir ) os.makedirs ( self._tarballDir )
self.svnExport ( tools, projects ) self.svnExport ( tools, projects )
removeds = [ os.path.join("vlsisapd","src","openChams")
, os.path.join("vlsisapd","src","dtr")
]
# Remove unpublisheds (yet) tools/files. # Remove unpublisheds (yet) tools/files.
for item in removeds: for item in self._packageExcludes:
command = [ "/bin/rm", "-r", os.path.join(self._archiveDir,item) ] command = [ "/bin/rm", "-r", os.path.join(self._archiveDir,item) ]
self._execute ( command, "rm of %s failed" % item) self._execute ( command, "rm of %s failed" % item)
@ -510,7 +604,8 @@ class ProjectBuilder:
os.chdir ( self._tarballDir ) os.chdir ( self._tarballDir )
command = [ "/bin/tar" command = [ "/bin/tar"
, "--exclude", "\\.svn" , "--exclude-backups"
, "--exclude-vcs"
, "-jcvf", self._sourceTarBz2, os.path.basename(self._archiveDir) ] , "-jcvf", self._sourceTarBz2, os.path.basename(self._archiveDir) ]
self._execute ( command, "tar command failed" ) self._execute ( command, "tar command failed" )
@ -521,8 +616,33 @@ class ProjectBuilder:
return return
def doRpm ( self, tools, projects ): def userTarball ( self, tools, projects ):
self.tarball ( tools, projects ) self.enable( tools, projects )
userSourceTarBz2 = os.path.join ( self._tarballDir
, datetime.date.today().strftime('%s-%s-%%Y%%m%%d.tar.bz2'%
(self._packageName
,self._packageVersion)) )
excludes = []
for exclude in self._packageExcludes:
excludes += [ '--exclude='+exclude ]
os.chdir ( self._sourceDir )
command = [ "/bin/tar"
, "--exclude-backups"
, "--exclude-vcs"
, "--transform=s,^,%s/src/,"%self._projectDir ] \
+ excludes \
+ [ "-jcvf", userSourceTarBz2 ] \
+ self.enabledTools()
self._execute ( command, "tar command failed" )
return
def doRpm ( self ):
self.svnTarball ( [], self._packageProjects )
for rpmDir in [ "SOURCES", "SPECS", "BUILD", "tmp" for rpmDir in [ "SOURCES", "SPECS", "BUILD", "tmp"
, "SRPMS", "RPMS/i386", "RPMS/i686", "RPMS/x86_64" ]: , "SRPMS", "RPMS/i386", "RPMS/i686", "RPMS/x86_64" ]:
@ -554,8 +674,8 @@ class ProjectBuilder:
return return
def doDeb ( self, tools, projects ): def doDeb ( self ):
self.tarball ( tools, projects ) self.svnTarball ( [], self._packageProjects )
if not os.path.isdir(self._debbuildDir): if not os.path.isdir(self._debbuildDir):
os.makedirs ( self._debbuildDir ) os.makedirs ( self._debbuildDir )
@ -583,52 +703,96 @@ class ProjectBuilder:
return return
def loadConfiguration ( self, confFile ):
moduleGlobals = globals()
print 'Reading configuration from:'
print ' <%s>' % options.conf
if not os.path.isfile(confFile):
ErrorMessage( 1, 'Missing configuration file:', '<%s>'%confFile ).terminate()
try:
execfile( confFile, moduleGlobals )
except Exception, e:
ErrorMessage( 1, 'An exception occured while loading the configuration file:'
, '<%s>\n' % (confFile)
, 'You should check for simple python errors in this file.'
, 'Error was:'
, '%s\n' % e ).terminate()
if moduleGlobals.has_key('projects'):
entryNb = 0
for entry in moduleGlobals['projects']:
entryNb += 1
if not entry.has_key('name'):
raise ErrorMessage( 1, 'Missing project name in project entry #%d.' % entryNb )
if not entry.has_key('tools'):
raise ErrorMessage( 1, 'Missing tools list in project entry #%d (<%s>).' \
% (entryNb,entry['name']) )
if not isinstance(entry['tools'],list):
raise ErrorMessage( 1, 'Tools item of project entry #%d (<%s>) is not a list.' \
% (entryNb,entry['name']) )
if not entry.has_key('repository'):
raise ErrorMessage( 1, 'Missing project repository in project entry #%d.' \
% entryNb )
self.register( Project(entry['name'],entry['tools'],entry['repository']) )
else:
ErrorMessage( 1, 'Configuration file is missing the \'project\' symbol.'
, '<%s>'%confFile ).terminate()
if moduleGlobals.has_key('projectdir'):
self.projectDir = moduleGlobals['projectdir']
if moduleGlobals.has_key('svnconfig'):
svnconfig = moduleGlobals['svnconfig']
if svnconfig.has_key('method'): self._svnMethod = svnconfig['method']
if moduleGlobals.has_key('package'):
package = moduleGlobals['package']
if package.has_key('name' ): self.packageName = package['name']
if package.has_key('version' ): self.packageVersion = package['version']
if package.has_key('excludes'):
if not isinstance(package['excludes'],list):
raise ErrorMessage( 1, 'Excludes of package configuration is not a list.')
self._packageExcludes = package['excludes']
if package.has_key('projects'):
if not isinstance(package['projects'],list):
raise ErrorMessage( 1, 'Projects to package is not a list.')
self._packageProjects = package['projects']
return
def showConfiguration ( self ):
print 'BuildCoriolis Configuration:'
if self._svnMethod:
print ' SVN Method: <%s>' % self._svnMethod
else:
print ' SVN Method not defined, will not be able to checkout/commit.'
for project in self._projects:
print ' project:%-15s repository:<%s>' % ( ('<%s>'%project.getName()), project.getRepository() )
toolOrder = 1
for tool in project.getTools():
print '%s%02d:<%s>' % (' '*26,toolOrder,tool)
toolOrder += 1
print
return
if __name__ == "__main__": if __name__ == "__main__":
bootstrap = Project ( name = "bootstrap" try:
, tools =[ "bootstrap" ] scriptPath = os.path.abspath( os.path.dirname(sys.argv[0]) )
, repository="/users/outil/coriolis/svn" print 'buildCoriolis.py is run from:'
) print ' <%s>' % scriptPath
vlsisapd = Project ( name = "vlsisapd"
, tools =[ "vlsisapd" ]
, repository="/users/outil/coriolis/svn"
)
coriolis = Project ( name = "coriolis"
, tools =[ "hurricane"
, "crlcore"
, "nimbus"
, "metis"
, "mauka"
, "knik"
, "katabatic"
, "kite"
, "equinox"
, "solstice"
, "unicorn"
, "ispd"
, "cumulus"
, "stratus1"
]
, repository="/users/outil/coriolis/svn"
)
chams = Project ( name = "chams"
, tools =[ "hurricaneAMS"
, "amsCore"
, "opSim"
, "scribe"
, "graph"
, "pharos"
, "isis"
, "schematic"
, "autoDTR"
]
, repository="/users/outil/chams/svn"
)
parser = optparse.OptionParser () parser = optparse.OptionParser ()
# Build relateds. # Build relateds.
parser.add_option ( "-c", "--conf", type="string", dest="conf", default=os.path.join(scriptPath,'build.conf')
, help="Fichier de configuration." )
parser.add_option ( "--show-conf" , action="store_true" , dest="showConf" , help="Display the Project/Tools configuration, then exit." )
parser.add_option ( "-q", "--quiet" , action="store_true" , dest="quiet" , help="Do not print all the informative messages." ) parser.add_option ( "-q", "--quiet" , action="store_true" , dest="quiet" , help="Do not print all the informative messages." )
parser.add_option ( "-r", "--release" , action="store_true" , dest="release" , help="Build a <Release> aka optimized version." ) parser.add_option ( "-r", "--release" , action="store_true" , dest="release" , help="Build a <Release> aka optimized version." )
parser.add_option ( "-d", "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." ) parser.add_option ( "-d", "--debug" , action="store_true" , dest="debug" , help="Build a <Debug> aka (-g) version." )
@ -649,6 +813,7 @@ if __name__ == "__main__":
parser.add_option ( "--svn-update" , action="store_true" , dest="svnUpdate" , help="Update to the latest SVN version *or* the one given by svn-tag." ) parser.add_option ( "--svn-update" , action="store_true" , dest="svnUpdate" , help="Update to the latest SVN version *or* the one given by svn-tag." )
parser.add_option ( "--svn-checkout" , action="store_true" , dest="svnCheckout", help="Checkout the latest SVN version *or* the one given by svn-tag." ) parser.add_option ( "--svn-checkout" , action="store_true" , dest="svnCheckout", help="Checkout the latest SVN version *or* the one given by svn-tag." )
# Miscellaneous. # Miscellaneous.
parser.add_option ( "--user-tarball" , action="store_true" , dest="userTarball", help="Regenerate a tarball from checked out sources (in <root>/tarball/." )
parser.add_option ( "--tarball" , action="store_true" , dest="tarball" , help="Regenerate a tarball (in <root>/tarball/." ) parser.add_option ( "--tarball" , action="store_true" , dest="tarball" , help="Regenerate a tarball (in <root>/tarball/." )
parser.add_option ( "--rpm" , action="store_true" , dest="doRpm" , help="Regenerate RPM packages." ) parser.add_option ( "--rpm" , action="store_true" , dest="doRpm" , help="Regenerate RPM packages." )
parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." ) parser.add_option ( "--deb" , action="store_true" , dest="doDeb" , help="Regenerate Debian/Ubuntu packages." )
@ -658,10 +823,11 @@ if __name__ == "__main__":
( options, args ) = parser.parse_args () ( options, args ) = parser.parse_args ()
builder = ProjectBuilder () builder = ProjectBuilder ()
builder.register ( bootstrap ) builder.loadConfiguration ( options.conf )
builder.register ( vlsisapd )
builder.register ( coriolis ) if options.showConf:
builder.register ( chams ) builder.showConfiguration ()
sys.exit(0)
if options.quiet: builder.quiet = True if options.quiet: builder.quiet = True
if options.release: builder.buildMode = "Release" if options.release: builder.buildMode = "Release"
@ -684,9 +850,16 @@ if __name__ == "__main__":
if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects ) if options.svnStatus: builder.svnStatus ( tools=options.tools, projects=options.projects )
elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects ) elif options.svnUpdate: builder.svnUpdate ( tools=options.tools, projects=options.projects )
elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects ) elif options.svnCheckout: builder.svnCheckout ( tools=options.tools, projects=options.projects )
elif options.tarball: builder.tarball ( tools=options.tools, projects=options.projects ) elif options.userTarball: builder.userTarball ( tools=options.tools, projects=options.projects )
elif options.doRpm: builder.doRpm ( tools=[] , projects=packagedProjects ) elif options.tarball: builder.svnTarball ( tools=options.tools, projects=options.projects )
elif options.doDeb: builder.doDeb ( tools=[] , projects=packagedProjects ) elif options.doRpm: builder.doRpm ()
elif options.doDeb: builder.doDeb ()
else: builder.build ( tools=options.tools, projects=options.projects ) else: builder.build ( tools=options.tools, projects=options.projects )
except ErrorMessage, e:
print e
sys.exit(e.code)
#except Exception, e:
# print e
# sys.exit(1)
sys.exit ( 0 ) sys.exit ( 0 )

View File

@ -16,7 +16,7 @@
echo $coriolisEnvPy echo $coriolisEnvPy
if [ -e ${coriolisEnvPy} ]; then if [ -e ${coriolisEnvPy} ]; then
eval "`${coriolisEnvPy} --v2 --release --shared --python`" eval "`${coriolisEnvPy} --release --shared`"
else else
echo "[ERROR] Missing ${coriolisEnvPy} script." echo "[ERROR] Missing ${coriolisEnvPy} script."
fi fi

View File

@ -41,6 +41,9 @@ def guessOs ():
osDarwin = re.compile (".*Darwin.*") osDarwin = re.compile (".*Darwin.*")
osUbuntu1004 = re.compile (".*Linux.*ubuntu.*") osUbuntu1004 = re.compile (".*Linux.*ubuntu.*")
osUbuntu1004_64 = re.compile (".*Linux.*ubuntu.*x86_64.*") osUbuntu1004_64 = re.compile (".*Linux.*ubuntu.*x86_64.*")
osFreeBSD8x_amd64 = re.compile (".*FreeBSD 8.*amd64.*")
osFreeBSD8x_64 = re.compile (".*FreeBSD 8.*x86_64.*")
osFreeBSD8x = re.compile (".*FreeBSD 8.*")
uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE ) uname = subprocess.Popen ( ["uname", "-srm"], stdout=subprocess.PIPE )
lines = uname.stdout.readlines() lines = uname.stdout.readlines()
@ -48,7 +51,7 @@ def guessOs ():
libDir="lib" libDir="lib"
if osSlsoc6x_64.match(lines[0]): if osSlsoc6x_64.match(lines[0]):
osType = "Linux.slsoc6x_64" osType = "Linux.slsoc6x_64"
libDir = "64" libDir = "lib64"
elif osSlsoc6x.match(lines[0]): osType = "Linux.slsoc6x" elif osSlsoc6x.match(lines[0]): osType = "Linux.slsoc6x"
elif osSLSoC5x_64.match(lines[0]): elif osSLSoC5x_64.match(lines[0]):
osType = "Linux.SLSoC5x_64" osType = "Linux.SLSoC5x_64"
@ -65,6 +68,14 @@ def guessOs ():
libDir = "lib64" libDir = "lib64"
elif osLinux.match(lines[0]): elif osLinux.match(lines[0]):
osType = "Linux.i386" osType = "Linux.i386"
elif osFreeBSD8x_64.match(lines[0]):
osType = "FreeBSD.8x.x86_64"
libDir = "lib64"
elif osFreeBSD8x_amd64.match(lines[0]):
osType = "FreeBSD.8x.amd64"
libDir = "lib64"
elif osFreeBSD8x.match(lines[0]):
osType = "FreeBSD.8x.i386"
elif osDarwin.match(lines[0]): elif osDarwin.match(lines[0]):
osType = "Darwin" osType = "Darwin"
else: else:
@ -84,25 +95,20 @@ if __name__ == "__main__":
(osType,libDir) = guessOs() (osType,libDir) = guessOs()
buildType = "Release" buildType = "Release"
linkType = "Shared" linkType = "Shared"
coriolisVersion = None
rootDir = None rootDir = None
parser = optparse.OptionParser () parser = optparse.OptionParser ()
# Build relateds. # Build relateds.
parser.add_option ( "--csh" , action="store_true" , dest="csh" ) parser.add_option ( "--csh" , action="store_true" , dest="csh" )
parser.add_option ( "--v1" , action="store_true" , dest="v1" )
parser.add_option ( "--v2" , action="store_true" , dest="v2" )
parser.add_option ( "--release" , action="store_true" , dest="release" ) parser.add_option ( "--release" , action="store_true" , dest="release" )
parser.add_option ( "--debug" , action="store_true" , dest="debug" ) parser.add_option ( "--debug" , action="store_true" , dest="debug" )
parser.add_option ( "--devel" , action="store_true" , dest="devel" ) parser.add_option ( "--devel" , action="store_true" , dest="devel" )
parser.add_option ( "--static" , action="store_true" , dest="static" ) parser.add_option ( "--static" , action="store_true" , dest="static" )
parser.add_option ( "--shared" , action="store_true" , dest="shared" ) parser.add_option ( "--shared" , action="store_true" , dest="shared" )
parser.add_option ( "--python" , action="store_true" , dest="python" ) parser.add_option ( "--no-python", action="store_true" , dest="nopython" )
parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" ) parser.add_option ( "--root" , action="store" , type="string", dest="rootDir" )
( options, args ) = parser.parse_args () ( options, args ) = parser.parse_args ()
if options.v1: coriolisVersion = 1
if options.v2: coriolisVersion = 2
if options.release: buildType = "Release" if options.release: buildType = "Release"
if options.debug: buildType = "Debug" if options.debug: buildType = "Debug"
if options.devel: buildType = "Debug" if options.devel: buildType = "Debug"
@ -114,29 +120,26 @@ if __name__ == "__main__":
strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" ) strippedLibraryPath = stripPath ( "LD_LIBRARY_PATH" )
strippedPythonPath = stripPath ( "PYTHONPATH" ) strippedPythonPath = stripPath ( "PYTHONPATH" )
if coriolisVersion == 1: shellScriptSh = \
"""echo "%(MESSAGE)s";\n""" \
"""echo "Switching to Coriolis 2.x (%(buildDir)s)";\n""" \
"""PATH="%(PATH)s";\n""" \
"""LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";\n""" \
"""BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";\n""" \
"""CORIOLIS_TOP="%(CORIOLIS_TOP)s";\n""" \
"""STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";\n""" \
"""export PATH LD_LIBRARY_PATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;\n""" \
"""hash -r;\n"""
if not rootDir: shellScriptCsh = \
rootDir = os.getenv("HOME") + "/coriolis-1.x" """echo "%(MESSAGE)s";\n""" \
"""echo "Switching to Coriolis 2.x (%(buildDir)s)";\n""" \
hurricaneTop = "%s/coriolis/%s/install" % ( rootDir, osType ) """setenv PATH "%(PATH)s";\n""" \
buildDir = None """setenv LD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";\n""" \
shellScript = \ """setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";\n""" \
""" """setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";\n""" \
echo "Switching to Coriolis 1.x"; """setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";\n""" \
PATH=%(PATH)s; """rehash\n;"""
LD_LIBRARY_PATH=%(LD_LIBRARY_PATH)s;
PYTHONPATH=%(PYTHONPATH)s;
HURRICANE_TOP=%(HURRICANE_TOP)s;
CORIOLIS_TOP=%(HURRICANE_TOP)s;
export PATH LD_LIBRARY_PATH PYTHONPATH HURRICANE_TOP CORIOLIS_TOP;
hash -r;
if [ -f "%(HURRICANE_TOP)s/share/etc/coriolis.sh" ]; then
. "%(HURRICANE_TOP)s/share/etc/coriolis.sh"
fi
"""
elif coriolisVersion == 2:
buildDir = buildType + "." + linkType buildDir = buildType + "." + linkType
scriptDir = os.path.dirname ( os.path.abspath(__file__) ) scriptDir = os.path.dirname ( os.path.abspath(__file__) )
@ -161,7 +164,7 @@ fi
strippedPath = "%s/bin:%s" % ( coriolisTop, strippedPath ) strippedPath = "%s/bin:%s" % ( coriolisTop, strippedPath )
strippedLibraryPath = "%s:%s" % ( absLibDir , strippedLibraryPath ) strippedLibraryPath = "%s:%s" % ( absLibDir , strippedLibraryPath )
if options.python: if not options.nopython:
pyVersion = sys.version_info pyVersion = sys.version_info
version = "%d.%d" % (pyVersion[0],pyVersion[1]) version = "%d.%d" % (pyVersion[0],pyVersion[1])
if osType.startswith("Linux.SL") or osType.startswith("Linux.sl"): if osType.startswith("Linux.SL") or osType.startswith("Linux.sl"):
@ -173,34 +176,10 @@ fi
strippedPythonPath = "%s/cumulus:" % (sitePackagesDir) + strippedPythonPath strippedPythonPath = "%s/cumulus:" % (sitePackagesDir) + strippedPythonPath
strippedPythonPath = "%s/stratus:" % (sitePackagesDir) + strippedPythonPath strippedPythonPath = "%s/stratus:" % (sitePackagesDir) + strippedPythonPath
shellScriptSh = \ shellScriptSh += """PYTHONPATH="%(PYTHONPATH)s";\n""" \
""" """export PYTHONPATH"""
echo "%(MESSAGE)s"; shellScriptCsh += """setenv PYTHONPATH "%(PYTHONPATH)s";"""
echo "Switching to Coriolis 2.x (%(buildDir)s)";
PATH="%(PATH)s";
LD_LIBRARY_PATH="%(LD_LIBRARY_PATH)s";
PYTHONPATH="%(PYTHONPATH)s";
BOOTSTRAP_TOP="%(BOOTSTRAP_TOP)s";
CORIOLIS_TOP="%(CORIOLIS_TOP)s";
STRATUS_MAPPING_NAME="%(SYSCONF_DIR)s/stratus2sxlib.xml";
export PATH LD_LIBRARY_PATH PYTHONPATH BOOTSTRAP_TOP CORIOLIS_TOP STRATUS_MAPPING_NAME;
hash -r
"""
shellScriptCsh = \
"""
echo "%(MESSAGE)s";
echo "Switching to Coriolis 2.x (%(buildDir)s)";
setenv PATH "%(PATH)s";
setenv LD_LIBRARY_PATH "%(LD_LIBRARY_PATH)s";
setenv PYTHONPATH "%(PYTHONPATH)s";
setenv BOOTSTRAP_TOP "%(BOOTSTRAP_TOP)s";
setenv CORIOLIS_TOP "%(CORIOLIS_TOP)s";
setenv STRATUS_MAPPING_NAME "%(SYSCONF_DIR)s/stratus2sxlib.xml";
rehash
"""
if coriolisVersion:
if options.csh: shellScript = shellScriptCsh if options.csh: shellScript = shellScriptCsh
else: shellScript = shellScriptSh else: shellScript = shellScriptSh