diff options
Diffstat (limited to 'cpp/makebindist.py')
-rwxr-xr-x | cpp/makebindist.py | 704 |
1 files changed, 352 insertions, 352 deletions
diff --git a/cpp/makebindist.py b/cpp/makebindist.py index e7f2a5dd303..6fbe3cd77aa 100755 --- a/cpp/makebindist.py +++ b/cpp/makebindist.py @@ -46,27 +46,27 @@ def initDirectory(d): class ExtProgramError: def __init__(self, error = None): - self.msg = error - + self.msg = error + def __str__(self): - return repr(self.msg) + return repr(self.msg) def runprog(commandstring, haltOnError = True): #commandtuple = commandstring.split() #result = os.spawnvpe(os.P_WAIT, commandtuple[0], commandtuple, os.environ) result = os.system(commandstring) if result != 0: - msg = 'Command %s returned error code %d' % (commandstring, result) - if haltOnError: - raise ExtProgramError(msg) + msg = 'Command %s returned error code %d' % (commandstring, result) + if haltOnError: + raise ExtProgramError(msg) def copyfiles(srcDir, destDir): '''Copy the contents of one directory to another (non-recursive)''' for f in os.listdir(srcDir): - src = os.path.join(srcDir, f) - dest = os.path.join(destDir, f) - if not os.path.isdir(src) and not os.path.islink(src): - shutil.copy(src, dest) + src = os.path.join(srcDir, f) + dest = os.path.join(destDir, f) + if not os.path.isdir(src) and not os.path.islink(src): + shutil.copy(src, dest) def getIceVersion(file): """Extract the ICE version string from a file.""" @@ -91,10 +91,10 @@ def getPlatform(): if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): return 'win32' elif sys.platform.startswith('linux'): - if readcommand('uname -p') == 'x86_64': - return 'linux64' - else: - return 'linux' + if readcommand('uname -p') == 'x86_64': + return 'linux64' + else: + return 'linux' elif sys.platform.startswith('sunos'): return 'solaris' elif sys.platform.startswith('hp'): @@ -131,8 +131,8 @@ def getVersion(cvsTag, buildDir): runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/include/IceUtil/Config.h') result = [ getIceVersion('ice/include/IceUtil/Config.h'), \ - getIceSoVersion('ice/include/IceUtil/Config.h'), \ - getIceMMVersion('ice/include/IceUtil/Config.h') ] + getIceSoVersion('ice/include/IceUtil/Config.h'), \ + getIceMMVersion('ice/include/IceUtil/Config.h') ] os.remove('ice/include/IceUtil/Config.h') os.removedirs('ice/include/IceUtil') @@ -142,28 +142,28 @@ def getVersion(cvsTag, buildDir): def fixVersion(filename, version, mmVersion): f = fileinput.input(filename, True) for line in f: - l = line.rstrip('\n') - l = l.replace('@ver@', version) - l = l.replace('@mmver@', mmVersion) - print l + l = line.rstrip('\n') + l = l.replace('@ver@', version) + l = l.replace('@mmver@', mmVersion) + print l f.close() def getInstallFiles(cvsTag, buildDir, version, mmVersion): """Gets the install sources for this revision""" cwd = os.getcwd() try: - os.chdir(buildDir) - runprog('rm -rf ' + buildDir + '/ice/install') - runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/unix') - runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/common') - runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/rpm') - runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/thirdparty') - snapshot = os.walk('./ice/install/unix') - for dirInfo in snapshot: - for f in dirInfo[2]: - fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) + os.chdir(buildDir) + runprog('rm -rf ' + buildDir + '/ice/install') + runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/unix') + runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/common') + runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/rpm') + runprog('cvs -d cvs.zeroc.com:/home/cvsroot export -r ' + cvsTag + ' ice/install/thirdparty') + snapshot = os.walk('./ice/install/unix') + for dirInfo in snapshot: + for f in dirInfo[2]: + fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) finally: - os.chdir(cwd) + os.chdir(cwd) return buildDir + '/ice/install' def getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion): @@ -172,20 +172,20 @@ def getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion): continue working!''' cwd = os.getcwd() try: - os.chdir(buildDir) - target = os.path.join(buildDir, 'ice', 'install') - if os.path.exists(target): - shutil.rmtree(target) - iceloc = os.path.abspath(os.path.join(os.environ['ICE_HOME'],'install')) - os.makedirs(target) - for f in ['unix', 'common', 'rpm', 'thirdparty']: - shutil.copytree(os.path.join(iceloc, f), os.path.join(target, f)) - snapshot = os.walk('./ice/install/unix') - for dirInfo in snapshot: - for f in dirInfo[2]: - fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) + os.chdir(buildDir) + target = os.path.join(buildDir, 'ice', 'install') + if os.path.exists(target): + shutil.rmtree(target) + iceloc = os.path.abspath(os.path.join(os.environ['ICE_HOME'],'install')) + os.makedirs(target) + for f in ['unix', 'common', 'rpm', 'thirdparty']: + shutil.copytree(os.path.join(iceloc, f), os.path.join(target, f)) + snapshot = os.walk('./ice/install/unix') + for dirInfo in snapshot: + for f in dirInfo[2]: + fixVersion(os.path.join(dirInfo[0], f), version, mmVersion) finally: - os.chdir(cwd) + os.chdir(cwd) return buildDir + '/ice/install' def readcommand(cmd): @@ -204,7 +204,7 @@ def collectSourceDistributions(tag, sourceDir, cvsdir, distro): cwd = os.getcwd() os.chdir(cwd + "/../" + cvsdir) if len(tag) > 0: - print 'Making disribution ' + cvsdir + ' with tag ' + tag + print 'Making disribution ' + cvsdir + ' with tag ' + tag # # The sources collected by the makebindist.py script are *NOT* @@ -214,7 +214,7 @@ def collectSourceDistributions(tag, sourceDir, cvsdir, distro): runprog("./makedist.py " + tag) else: runprog("./makedist.py -d " + tag) - + shutil.copy("dist/" + distro + ".tar.gz", sourceDir) os.chdir(cwd) @@ -226,12 +226,12 @@ def editMakeRulesCS(filename, version): reIceLocation = re.compile('^[a-z]*dir.*=\s*\$\(top_srcdir\)') makefile = fileinput.input(filename, True) for line in makefile: - if reIceLocation.search(line) <> None: - print line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - elif line.startswith('prefix'): - print 'prefix = $(ICE_DIR)' - else: - print line.rstrip('\n') + if reIceLocation.search(line) <> None: + print line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) + elif line.startswith('prefix'): + print 'prefix = $(ICE_DIR)' + else: + print line.rstrip('\n') makefile.close() def editMakeRules(filename, version): @@ -245,66 +245,66 @@ def editMakeRules(filename, version): makefile = fileinput.input(filename, True) for line in makefile: - if line.startswith('slicedir'): - print """ + if line.startswith('slicedir'): + print """ ifeq ($(ICE_DIR),/usr) slicedir = $(ICE_DIR)/share/slice else slicedir = $(ICE_DIR)/slice endif """ - elif line.startswith('embedded_runpath_prefix'): - state = 'untilblank' - print """ + elif line.startswith('embedded_runpath_prefix'): + state = 'untilblank' + print """ ifneq ($(ICE_DIR),/usr) embedded_runpath_prefix ?= /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) endif """ - elif line.startswith('embedded_runpath_prefix'): - # - # embedded_runpath_prefix is moved down to after the version - # information is set. - # - pass - elif reIceLocation.search(line) <> None: - output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - if line.startswith('libdir'): - print 'ifeq ($(LP64),yes)' - print ' ' + output + '$(lp64suffix)' - print 'else' - print ' ' + output - print 'endif' - elif line.startswith('bindir'): - print output - # - # NOTE!!! Magic occurs... - # It simplifies building the demos for the user if - # we try to detect whether the executables are 64 - # bit and, if so, set LP64=yes automagically. - # - print '' - print '#' - print '# If LP64 is unset, sample an Ice executable to see if it is 64 bit' - print '# and set automatically. This avoids having to set LP64 if there is' - print '# Ice installation in a well-known location.' - print '#' - print 'ifeq ($(LP64),)' - print ' ifneq ($(shell file $(bindir)/slice2cpp | grep 64-bit),)' - print ' LP64=yes' - print ' endif' - print 'endif' - print '' - else: - print output - - elif line.startswith('install_'): - # - # Do nothing. - # - pass - elif line.startswith('SOVERSION'): - print line.rstrip('\n') - print """ + elif line.startswith('embedded_runpath_prefix'): + # + # embedded_runpath_prefix is moved down to after the version + # information is set. + # + pass + elif reIceLocation.search(line) <> None: + output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) + if line.startswith('libdir'): + print 'ifeq ($(LP64),yes)' + print ' ' + output + '$(lp64suffix)' + print 'else' + print ' ' + output + print 'endif' + elif line.startswith('bindir'): + print output + # + # NOTE!!! Magic occurs... + # It simplifies building the demos for the user if + # we try to detect whether the executables are 64 + # bit and, if so, set LP64=yes automagically. + # + print '' + print '#' + print '# If LP64 is unset, sample an Ice executable to see if it is 64 bit' + print '# and set automatically. This avoids having to set LP64 if there is' + print '# Ice installation in a well-known location.' + print '#' + print 'ifeq ($(LP64),)' + print ' ifneq ($(shell file $(bindir)/slice2cpp | grep 64-bit),)' + print ' LP64=yes' + print ' endif' + print 'endif' + print '' + else: + print output + + elif line.startswith('install_'): + # + # Do nothing. + # + pass + elif line.startswith('SOVERSION'): + print line.rstrip('\n') + print """ # # Checks for ICE_HOME environment variable. If it isn't present, @@ -314,17 +314,17 @@ endif ifeq ($(ICE_HOME),) ICE_DIR = /usr ifneq ($(shell test -f $(ICE_DIR)/bin/icestormadmin && echo 0),0) - NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) - ifneq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) + NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) + ifneq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) $(error Unable to locate Ice distribution, please set ICE_HOME!) - else - ICE_DIR = $(NEXTDIR) - endif + else + ICE_DIR = $(NEXTDIR) + endif else - NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) - ifeq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) + NEXTDIR = /opt/Ice-$(VERSION_MAJOR).$(VERSION_MINOR) + ifeq ($(shell test -f $(NEXTDIR)/bin/icestormadmin && echo 0),0) $(warning Ice distribution found in /usr and $(NEXTDIR)! Installation in "/usr" will be used by default. Use ICE_HOME to specify alternate Ice installation.) - endif + endif endif else ICE_DIR = $(ICE_HOME) @@ -340,15 +340,15 @@ endif prefix = $(ICE_DIR) """ - elif line.startswith('prefix'): - # - # Delete the prefix line. It will be set later on after - # SOVERSION. - # - print "# 'prefix' is automatically defined later on in this file using default" - print "# locations or ICE_HOME" - else: - print line.rstrip('\n') + elif line.startswith('prefix'): + # + # Delete the prefix line. It will be set later on after + # SOVERSION. + # + print "# 'prefix' is automatically defined later on in this file using default" + print "# locations or ICE_HOME" + else: + print line.rstrip('\n') # # Dependency files are all going to be bogus since they contain relative @@ -373,30 +373,30 @@ def editMakeRulesMak(filename, version): makefile = fileinput.input(filename, True) for line in makefile: - if state == 'done': - if reIceLocation.search(line) <> None: - output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) - print output - elif line.startswith('install_'): - # - # Do nothing. - # - pass - elif line.startswith('THIRDPARTY_HOME'): - # - # Do nothing. - # - pass - else: - print line.rstrip('\n') - elif state == 'header': - # - # Reading header. - # - print line.rstrip('\n') - if line.strip() == "": - state = 'untilprefix' - print """ + if state == 'done': + if reIceLocation.search(line) <> None: + output = line.rstrip('\n').replace('top_srcdir', 'ICE_DIR', 10) + print output + elif line.startswith('install_'): + # + # Do nothing. + # + pass + elif line.startswith('THIRDPARTY_HOME'): + # + # Do nothing. + # + pass + else: + print line.rstrip('\n') + elif state == 'header': + # + # Reading header. + # + print line.rstrip('\n') + if line.strip() == "": + state = 'untilprefix' + print """ # # Checks for ICE_HOME environment variable. # @@ -417,9 +417,9 @@ ICE_DIR = $(ICE_HOME) prefix = $(ICE_DIR) """ - elif state == 'untilprefix': - if line.startswith('prefix'): - state = 'done' + elif state == 'untilprefix': + if line.startswith('prefix'): + state = 'done' # # Dependency files are all going to be bogus since they contain relative # paths to Ice headers. We need to adjust this. @@ -435,16 +435,16 @@ def updateIceVersion(filename, version): print 'Updating ice version in ' + filename + ' to ' + version f = fileinput.input(filename, True) for line in f: - print line.rstrip('\n').replace('ICE_VERSION', version) + print line.rstrip('\n').replace('ICE_VERSION', version) f.close() def obliterate(files): for f in files: - if os.path.exists(f): - if os.path.isdir(f): - shutil.rmtree(f) - else: - os.remove(f) + if os.path.exists(f): + if os.path.isdir(f): + shutil.rmtree(f) + else: + os.remove(f) def extractDemos(sources, buildDir, version, distro, demoDir): """Pulls the demo directory out of a distribution and massages its @@ -460,42 +460,42 @@ def extractDemos(sources, buildDir, version, distro, demoDir): # toExtract = "%s/demo " % distro if demoDir == '': - toExtract = toExtract + " %s/ICE_LICENSE" % distro + toExtract = toExtract + " %s/ICE_LICENSE" % distro if not demoDir == 'php': - toExtract = toExtract + " %s/certs %s/config" % (distro, distro) - + toExtract = toExtract + " %s/certs %s/config" % (distro, distro) + runprog("gzip -dc " + os.path.join(sources, distro) + ".tar.gz | tar xf - " + toExtract, False) - + shutil.move(os.path.join(distro, "demo"), os.path.join(buildDir, "Ice-" + version + "-demos", "demo" + demoDir)) if os.path.exists(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE")): - shutil.move(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE"), \ - os.path.join(buildDir, "Ice-%s-demos" % version, "ICE_LICENSE")) + shutil.move(os.path.join(buildDir, "demotree", distro, "ICE_LICENSE"), \ + os.path.join(buildDir, "Ice-%s-demos" % version, "ICE_LICENSE")) # # 'System' copying of files here because its just easier! We don't # need any configuration out of the Python tree. # if not os.path.exists(buildDir + "/Ice-" + version + "-demos/certs"): - os.mkdir(buildDir + "/Ice-" + version + "-demos/certs") - + os.mkdir(buildDir + "/Ice-" + version + "-demos/certs") + if not os.path.exists(buildDir + "/Ice-" + version + "-demos/config"): - os.mkdir(buildDir + "/Ice-" + version + "-demos/config") + os.mkdir(buildDir + "/Ice-" + version + "-demos/config") if os.path.exists('%s/certs' % distro): - runprog("cp -pR " + distro + "/certs " + buildDir + "/Ice-" + version + "-demos") + runprog("cp -pR " + distro + "/certs " + buildDir + "/Ice-" + version + "-demos") srcConfigDir = '%s/%s/config' % (os.getcwd(), distro) destConfigDir = '%s/Ice-%s-demos/config' % (buildDir, version) if not demoDir in ['py', 'vb'] and os.path.exists(srcConfigDir): - for f in os.listdir(srcConfigDir): - src = os.path.join(srcConfigDir, f) - dest = os.path.join(destConfigDir, f) - if not os.path.isdir(src) and not os.path.islink(src): - shutil.copy(src, dest) + for f in os.listdir(srcConfigDir): + src = os.path.join(srcConfigDir, f) + dest = os.path.join(destConfigDir, f) + if not os.path.isdir(src) and not os.path.islink(src): + shutil.copy(src, dest) if demoDir == 'j': - updateIceVersion(os.path.join(destConfigDir, 'common.xml'), version) + updateIceVersion(os.path.join(destConfigDir, 'common.xml'), version) # # Collect files to remove from the demo distribution. @@ -504,24 +504,24 @@ def extractDemos(sources, buildDir, version, distro, demoDir): basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'certs') for f in ['openssl', 'makecerts']: - fullpath = os.path.join(basepath, f) + fullpath = os.path.join(basepath, f) if os.path.exists(fullpath): - remove.append(fullpath) + remove.append(fullpath) if len(demoDir) == 0: - basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'demo') - for f in ['IcePatch2', os.path.join('Ice', 'MFC')]: - fullpath = os.path.join(basepath, f) + basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'demo') + for f in ['IcePatch2', os.path.join('Ice', 'MFC')]: + fullpath = os.path.join(basepath, f) if os.path.exists(fullpath): - remove.append(fullpath) + remove.append(fullpath) basepath = os.path.join(buildDir, 'Ice-' + version + '-demos', 'config') if distro.startswith('Ice-'): - editMakeRules(os.path.join(basepath, 'Make.rules'), version) - editMakeRulesMak(os.path.join(basepath, 'Make.rules.mak'), version) + editMakeRules(os.path.join(basepath, 'Make.rules'), version) + editMakeRulesMak(os.path.join(basepath, 'Make.rules.mak'), version) elif distro.startswith('IceCS-'): - editMakeRulesCS(os.path.join(basepath, 'Make.rules.cs'), version) + editMakeRulesCS(os.path.join(basepath, 'Make.rules.cs'), version) # # Remove collected files. @@ -535,8 +535,8 @@ def archiveDemoTree(buildDir, version, installFiles): cwd = os.getcwd() os.chdir(os.path.join(buildDir, 'Ice-%s-demos' % version)) filesToRemove = ['certs/makecerts.py', 'certs/ImportKey.java', 'certs/ImportKey.class', 'certs/seed.dat', - 'config/convertssl.py', 'config/upgradeicegrid.py', 'config/icegrid-slice.3.1.ice.gz', 'config/PropertyNames.def', 'config/makeprops.py', - 'config/TestUtil.py', 'config/IceGridAdmin.py', 'config/ice_ca.cnf', 'config/icegridgui.pro'] + 'config/convertssl.py', 'config/upgradeicegrid.py', 'config/icegrid-slice.3.1.ice.gz', 'config/PropertyNames.def', 'config/makeprops.py', + 'config/TestUtil.py', 'config/IceGridAdmin.py', 'config/ice_ca.cnf', 'config/icegridgui.pro'] obliterate(filesToRemove) os.chdir(buildDir) @@ -571,9 +571,9 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion shutil.rmtree(distro, True) if not os.path.exists(distro): - filename = sources + '/' + distro + '.tar' + filename = sources + '/' + distro + '.tar' runprog('gzip -d %s.gz' % filename) - runprog('tar xf %s' % filename) + runprog('tar xf %s' % filename) runprog('gzip -9 %s' % filename) os.chdir(distro) @@ -585,18 +585,18 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion if distro.startswith('IceJ'): initDirectory(installDir) initDirectory(os.path.join(installDir, 'lib')) - shutil.copy(buildDir + '/' + distro + '/lib/Ice.jar', installDir + '/lib') - shutil.copy(buildDir + '/' + distro + '/lib/IceGridGUI.jar', installDir + '/lib') - # - # We really just want to copy the files, not move them. - # Shelling out to a copy is easier (and more likely to always - # work) than shutil.copytree(). - # - runprog('cp -pR ' + buildDir + '/' + distro + '/ant ' + installDir) - runprog('find ' + installDir + '/ant -name "*.java" | xargs rm') - destDir = os.path.join(installDir, 'config') - if not os.path.exists(destDir): - os.mkdir(destDir) + shutil.copy(buildDir + '/' + distro + '/lib/Ice.jar', installDir + '/lib') + shutil.copy(buildDir + '/' + distro + '/lib/IceGridGUI.jar', installDir + '/lib') + # + # We really just want to copy the files, not move them. + # Shelling out to a copy is easier (and more likely to always + # work) than shutil.copytree(). + # + runprog('cp -pR ' + buildDir + '/' + distro + '/ant ' + installDir) + runprog('find ' + installDir + '/ant -name "*.java" | xargs rm') + destDir = os.path.join(installDir, 'config') + if not os.path.exists(destDir): + os.mkdir(destDir) shutil.copy(os.path.join('config', 'build.properties'), destDir) os.chdir(cwd) return @@ -610,32 +610,32 @@ def makeInstall(sources, buildDir, installDir, distro, clean, version, mmVersion if pyHome == None or pyHome == '': logging.info('PYTHON_HOME is not set, figuring it out and trying that') pyHome = sys.exec_prefix - os.environ['PYTHON_HOME'] = pyHome + os.environ['PYTHON_HOME'] = pyHome # # XXX- Optimizations need to be turned on for the release. # try: - runprog('gmake NOGAC=yes OPTIMIZE=yes prefix=%s embedded_runpath_prefix=/opt/Ice-%s install' % (installDir, mmVersion)) + runprog('gmake NOGAC=yes OPTIMIZE=yes prefix=%s embedded_runpath_prefix=/opt/Ice-%s install' % (installDir, mmVersion)) except ExtProgramError: - print "gmake failed for makeInstall(%s, %s, %s, %s, %s, %s, %s)" % (sources, buildDir, installDir, distro, str(clean), version, mmVersion) - raise + print "gmake failed for makeInstall(%s, %s, %s, %s, %s, %s, %s)" % (sources, buildDir, installDir, distro, str(clean), version, mmVersion) + raise runprog('rm -rf /opt/Ice-%s' % (mmVersion), False) if distro.startswith('IceCS'): - assemblies = ["glacier2cs", "iceboxcs", "icecs", "icegridcs", "icepatch2cs", "icestormcs"] + assemblies = ["glacier2cs", "iceboxcs", "icecs", "icegridcs", "icepatch2cs", "icestormcs"] - # - # We are relying on pkgconfig to deal with some mono library - # configuration, so we need to copy these files into place. - # - if not os.path.exists("%s/lib/pkgconfig" % installDir): - os.makedirs("%s/lib/pkgconfig" % installDir) + # + # We are relying on pkgconfig to deal with some mono library + # configuration, so we need to copy these files into place. + # + if not os.path.exists("%s/lib/pkgconfig" % installDir): + os.makedirs("%s/lib/pkgconfig" % installDir) - for a in assemblies: - shutil.copy("bin/%s.dll" % a, "%s/bin/%s.dll" % (installDir, a)) - shutil.copy("lib/pkgconfig/%s.pc" % a, "%s/lib/pkgconfig" % installDir) + for a in assemblies: + shutil.copy("bin/%s.dll" % a, "%s/bin/%s.dll" % (installDir, a)) + shutil.copy("lib/pkgconfig/%s.pc" % a, "%s/lib/pkgconfig" % installDir) os.chdir(cwd) @@ -653,11 +653,11 @@ def shlibExtensions(versionString, versionInt): def getPlatformLibExtension(): platform = getPlatform() if platform == 'hpux': - return '.sl' + return '.sl' elif platform == 'macosx': - return '.dylib' + return '.dylib' else: - return '.so' + return '.so' def getDBfiles(dbLocation): cwd = os.getcwd() @@ -672,18 +672,18 @@ def getDBfiles(dbLocation): findCmd = '' if getPlatform() == 'solaris': - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1' elif getPlatform() == 'macosx': - findCmd = 'find lib \( -name "*' + getPlatformLibExtension() + '" -or -name "*jnilib" \) -type f ' + findCmd = 'find lib \( -name "*' + getPlatformLibExtension() + '" -or -name "*jnilib" \) -type f ' else: - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f' pipe_stdin, pipe_stdout = os.popen2(findCmd) lines = pipe_stdout.readlines() pipe_stdin.close() pipe_stdout.close() fileList.extend(lines) if getPlatform() == 'aix': - fileList.append('lib/libdb_cxx.so') + fileList.append('lib/libdb_cxx.so') os.chdir(cwd) return fileList @@ -695,9 +695,9 @@ def copyExpatFiles(expatLocation, version): fileList = [] findCmd = '' if getPlatform() == 'solaris': - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f -maxdepth 1' else: - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type f' pipe_stdin, pipe_stdout = os.popen2(findCmd) lines = pipe_stdout.readlines() pipe_stdin.close() @@ -707,9 +707,9 @@ def copyExpatFiles(expatLocation, version): linkList = [] findCmd = '' if getPlatform() == 'solaris': - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l -maxdepth 1' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l -maxdepth 1' else: - findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l' + findCmd = 'find lib -name "*' + getPlatformLibExtension() + '" -type l' pipe_stdin, pipe_stdout = os.popen2(findCmd) lines = pipe_stdout.readlines() pipe_stdin.close() @@ -717,14 +717,14 @@ def copyExpatFiles(expatLocation, version): fileList.extend(lines) for i in lines: - if i != 'libexpat.' + getPlatformLibExtension(): - linkList.append(i) + if i != 'libexpat.' + getPlatformLibExtension(): + linkList.append(i) os.chdir(cwd) if not os.path.exists('Ice-' + version + '/' + fileList[0].strip()): - shutil.copy(expatLocation + '/' + fileList[0].strip(), 'Ice-' + version + '/' + fileList[0].strip()) - os.symlink(os.path.basename(fileList[0].strip()), 'Ice-' + version + '/' + linkList[0].strip()) + shutil.copy(expatLocation + '/' + fileList[0].strip(), 'Ice-' + version + '/' + fileList[0].strip()) + os.symlink(os.path.basename(fileList[0].strip()), 'Ice-' + version + '/' + linkList[0].strip()) def usage(): """Print usage/help information""" @@ -742,7 +742,7 @@ def usage(): print ' If this is omitted makebindist will traverse' print ' ../icej ../icepy ../icecs, etc and make the' print ' distributions for you.' - print ' (Note: makedist.py seems to only work on Linux.' + print ' (Note: makedist.py seems to only work on Linux.' print ' To use makebindist.py on other UNIX platforms,' print ' you must copy pre-made source distributions onto' print ' the host and use this option to reference their' @@ -753,7 +753,7 @@ def usage(): print ' applicable (some bits will still be cleaned.' print '--nobuild Run through the process but don\'t build' print ' anything new.' - print '--usecvs Use contents of existing CVS directories' + print '--usecvs Use contents of existing CVS directories' print ' to create binary package.' print print 'The following options set the locations for third party libraries' @@ -777,7 +777,7 @@ def usage(): print ' (default=/opt/db).' print '--sslhome=[path] Specify location of OpenSSL' print ' (default=/opt/openssl).' - print '--expathome=[path] Specify location of expat libraries ' + print '--expathome=[path] Specify location of expat libraries ' print ' (default=/opt/expat).' print '--readlinehome=[path] Specify readline library and location ' print ' (defaults to /opt/readline if set).' @@ -808,8 +808,8 @@ def main(): optionList, args = getopt.getopt(sys.argv[1:], 'hvt:', [ 'build-dir=', 'install-dir=', 'install-root=', 'sources=', 'verbose', 'tag=', 'noclean', 'nobuild', - 'stlporthome=', 'bzip2home=', 'dbhome=', 'sslhome=', - 'expathome=', 'readlinehome=', 'usecvs', 'offline', 'debug']) + 'stlporthome=', 'bzip2home=', 'dbhome=', 'sslhome=', + 'expathome=', 'readlinehome=', 'usecvs', 'offline', 'debug']) except getopt.GetoptError: usage() @@ -835,51 +835,51 @@ def main(): clean = False elif o == '--nobuild': build = False - elif o == '--stlporthome': - buildEnvironment['STLPORT_HOME'] = a - elif o == '--bzip2home': - buildEnvironment['BZIP2_HOME'] = a - elif o == '--dbhome': - buildEnvironment['DB_HOME'] = a - elif o == '--sslhome': - buildEnvironment['OPENSSL_HOME'] = a - elif o == '--expathome': - buildEnvironment['EXPAT_HOME'] = a - elif o == '--readlinehome': - buildEnvironment['READLINE_HOME'] = a - elif o == '--offline': - offline = True - elif o == '--usecvs': - cvsMode = True + elif o == '--stlporthome': + buildEnvironment['STLPORT_HOME'] = a + elif o == '--bzip2home': + buildEnvironment['BZIP2_HOME'] = a + elif o == '--dbhome': + buildEnvironment['DB_HOME'] = a + elif o == '--sslhome': + buildEnvironment['OPENSSL_HOME'] = a + elif o == '--expathome': + buildEnvironment['EXPAT_HOME'] = a + elif o == '--readlinehome': + buildEnvironment['READLINE_HOME'] = a + elif o == '--offline': + offline = True + elif o == '--usecvs': + cvsMode = True if verbose: - logging.getLogger().setLevel(logging.DEBUG) + logging.getLogger().setLevel(logging.DEBUG) if offline and sources == None: - logging.error("You must specify a location for the sources if running in offline mode") - sys.exit(1) + logging.error("You must specify a location for the sources if running in offline mode") + sys.exit(1) # # Configure environment. # if getPlatform() == 'aix': - dylibEnvironmentVar = 'LIBPATH' + dylibEnvironmentVar = 'LIBPATH' elif getPlatform() == 'hpux': - dylibEnvironmentVar = 'SHLIB_PATH' + dylibEnvironmentVar = 'SHLIB_PATH' else: - dylibEnvironmentVar = 'LD_LIBRARY_PATH' + dylibEnvironmentVar = 'LD_LIBRARY_PATH' for k, v in buildEnvironment.iteritems(): - os.environ[k] = v - if os.environ.has_key(dylibEnvironmentVar): - os.environ[dylibEnvironmentVar] = v + '/lib:' + os.environ[dylibEnvironmentVar] + os.environ[k] = v + if os.environ.has_key(dylibEnvironmentVar): + os.environ[dylibEnvironmentVar] = v + '/lib:' + os.environ[dylibEnvironmentVar] if buildDir == None: print 'No build directory specified, defaulting to $HOME/tmp/icebuild' buildDir = os.environ.get('HOME') + '/tmp/icebuild' if cvsMode: - print 'Using CVS mode' + print 'Using CVS mode' if installDir == None: print 'No install directory specified, default to $HOME/tmp/iceinstall' @@ -899,9 +899,9 @@ def main(): # the build sources. # if cvsMode: - directories = [] + directories = [] else: - directories = [buildDir, buildDir + '/sources', buildDir + '/demotree'] + directories = [buildDir, buildDir + '/sources', buildDir + '/demotree'] directories.append(installDir) @@ -913,18 +913,18 @@ def main(): # installFiles = None if cvsMode: - version = getIceVersion('include/IceUtil/Config.h') - soVersion = getIceSoVersion('include/IceUtil/Config.h') + version = getIceVersion('include/IceUtil/Config.h') + soVersion = getIceSoVersion('include/IceUtil/Config.h') mmVersion = getIceMMVersion('include/IceUtil/Config.h') - installFiles = 'install' + installFiles = 'install' elif offline: - version = getIceVersion('include/IceUtil/Config.h') - soVersion = getIceSoVersion('include/IceUtil/Config.h') - mmVersion = getIceMMVersion('include/IceUtil/Config.h') - installFiles = getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion) + version = getIceVersion('include/IceUtil/Config.h') + soVersion = getIceSoVersion('include/IceUtil/Config.h') + mmVersion = getIceMMVersion('include/IceUtil/Config.h') + installFiles = getInstallFilesFromLocalDirectory(cvsTag, buildDir, version, mmVersion) else: - version, soVersion, mmVersion = getVersion(cvsTag, buildDir) - installFiles = getInstallFiles(cvsTag, buildDir, version, mmVersion) + version, soVersion, mmVersion = getVersion(cvsTag, buildDir) + installFiles = getInstallFiles(cvsTag, buildDir, version, mmVersion) if verbose: print 'Building binary distributions for Ice-' + version + ' on ' + getPlatform() @@ -934,20 +934,20 @@ def main(): if not cvsMode: - # - # These last build directories will have to wait until we've got - # the version number for the distribution. - # - shutil.rmtree(buildDir + '/Ice-' + version + '-demos', True) - initDirectory(buildDir + '/Ice-' + version + '-demos/config') + # + # These last build directories will have to wait until we've got + # the version number for the distribution. + # + shutil.rmtree(buildDir + '/Ice-' + version + '-demos', True) + initDirectory(buildDir + '/Ice-' + version + '-demos/config') if build and not cvsMode: collectSources = False if sources == None: - if not getPlatform().startswith("linux"): - print "makedist.py is not supported on non-Linux platforms. Create the source" - print "distributions on a Linux box, copy them to a location on this host and" - print "specify their location with the --sources argument" + if not getPlatform().startswith("linux"): + print "makedist.py is not supported on non-Linux platforms. Create the source" + print "distributions on a Linux box, copy them to a location on this host and" + print "specify their location with the --sources argument" sources = buildDir + '/sources' collectSources = clean @@ -955,15 +955,15 @@ def main(): # Ice must be first or building the other source distributions will fail. # sourceTarBalls = [ ('ice', 'Ice-%s' % version, ''), - ('icephp','IcePHP-%s' % version, 'php'), + ('icephp','IcePHP-%s' % version, 'php'), ('icej','IceJ-%s-java2' % version, 'j'), - ('icerb', 'IceRuby-%s' % version, 'rb')] + ('icerb', 'IceRuby-%s' % version, 'rb')] - if not getPlatform() in ['aix', 'solaris', 'hpux']: - sourceTarBalls.append(('icepy','IcePy-' + version, 'py')) + if not getPlatform() in ['aix', 'solaris', 'hpux']: + sourceTarBalls.append(('icepy','IcePy-' + version, 'py')) - if getPlatform().startswith("linux"): - sourceTarBalls.append(('icecs','IceCS-' + version, 'cs')) + if getPlatform().startswith("linux"): + sourceTarBalls.append(('icecs','IceCS-' + version, 'cs')) os.environ['ICE_HOME'] = installDir + '/Ice-' + version currentLibraryPath = None @@ -978,63 +978,63 @@ def main(): os.environ[dylibEnvironmentVar] = installDir + '/Ice-' + version + '/lib64:' + installDir + '/Ice-' + version + '/lib:' + currentLibraryPath os.environ['PATH'] = installDir + '/Ice-' + version + '/bin:' + os.environ['PATH'] - # - # Collect all of the distributions first. This prevents having - # to go through costly builds before finding out that one of the - # distributions doesn't build. - # - if collectSources: - toCollect = list(sourceTarBalls) - toCollect.append(('icevb', 'IceVB-' + version, 'vb')) - for cvs, tarball, demoDir in toCollect: + # + # Collect all of the distributions first. This prevents having + # to go through costly builds before finding out that one of the + # distributions doesn't build. + # + if collectSources: + toCollect = list(sourceTarBalls) + toCollect.append(('icevb', 'IceVB-' + version, 'vb')) + for cvs, tarball, demoDir in toCollect: collectSourceDistributions(cvsTag, sources, cvs, tarball) - print ''' + print ''' >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >> << >> Sources have been collected! << >> << >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<''' - # - # Package up demo distribution. - # - toCollect = list(sourceTarBalls) - for cvs, tarball, demoDir in toCollect: - extractDemos(sources, buildDir, version, tarball, demoDir) - shutil.copy("%s/unix/README.DEMOS" % installFiles, "%s/Ice-%s-demos/README.DEMOS" % (buildDir, version)) - archiveDemoTree(buildDir, version, installFiles) - shutil.move("%s/Ice-%s-demos.tar.gz" % (buildDir, version), "%s/Ice-%s-demos.tar.gz" % (installDir, version)) + # + # Package up demo distribution. + # + toCollect = list(sourceTarBalls) + for cvs, tarball, demoDir in toCollect: + extractDemos(sources, buildDir, version, tarball, demoDir) + shutil.copy("%s/unix/README.DEMOS" % installFiles, "%s/Ice-%s-demos/README.DEMOS" % (buildDir, version)) + archiveDemoTree(buildDir, version, installFiles) + shutil.move("%s/Ice-%s-demos.tar.gz" % (buildDir, version), "%s/Ice-%s-demos.tar.gz" % (installDir, version)) shutil.move("%s/Ice-%s-demos.zip" % (buildDir, version), "%s/Ice-%s-demos.zip" % (installDir, version)) - # - # Everything should be set for building stuff up now. - # + # + # Everything should be set for building stuff up now. + # for cvs, tarball, demoDir in sourceTarBalls: - makeInstall(sources, buildDir, "%s/Ice-%s" % (installDir, version), tarball, clean, version, mmVersion) - - # - # XXX- put java5 Ice.jar in place! - # - prevDir = os.getcwd() - os.chdir("%s/Ice-%s/lib" % (installDir, version)) - os.mkdir("java5") - os.chdir("java5") - os.system("gzip -dc %s/IceJ-%s-java5.tar.gz | tar xf - IceJ-%s-java5/lib/Ice.jar" % (sources, version, version)) - shutil.move("IceJ-%s-java5/lib/Ice.jar" % version, "Ice.jar") - shutil.rmtree("IceJ-%s-java5" % version) - os.chdir(prevDir) + makeInstall(sources, buildDir, "%s/Ice-%s" % (installDir, version), tarball, clean, version, mmVersion) + + # + # XXX- put java5 Ice.jar in place! + # + prevDir = os.getcwd() + os.chdir("%s/Ice-%s/lib" % (installDir, version)) + os.mkdir("java5") + os.chdir("java5") + os.system("gzip -dc %s/IceJ-%s-java5.tar.gz | tar xf - IceJ-%s-java5/lib/Ice.jar" % (sources, version, version)) + shutil.move("IceJ-%s-java5/lib/Ice.jar" % version, "Ice.jar") + shutil.rmtree("IceJ-%s-java5" % version) + os.chdir(prevDir) elif cvsMode: - collectSources = False + collectSources = False - # - # TODO: Sanity check to make sure that the script is being run - # from a location that it expects. - # - cvsDirs = [ 'ice', 'icej', 'icephp' ] - if getPlatform() == 'linux': - cvsDirs.append('icecs', 'icepy', 'icerb') + # + # TODO: Sanity check to make sure that the script is being run + # from a location that it expects. + # + cvsDirs = [ 'ice', 'icej', 'icephp' ] + if getPlatform() == 'linux': + cvsDirs.append('icecs', 'icepy', 'icerb') os.environ['ICE_HOME'] = os.getcwd() currentLibraryPath = None @@ -1046,18 +1046,18 @@ def main(): os.environ[dylibEnvironmentVar] = installDir + '/Ice-' + version + '/lib:' + currentLibraryPath os.environ['PATH'] = installDir + '/Ice-' + version + '/bin:' + os.environ['PATH'] - for d in cvsDirs: - currentDir = os.getcwd() - os.chdir('../' + d) - print 'Going to directory ' + d - if d == 'icej': - shutil.copy('lib/Ice.jar', installDir +'/Ice-' + version + '/lib') - shutil.copy('lib/IceGridGUI.jar', installDir +'/Ice-' + version + '/lib') - runprog('cp -pR ant ' + installDir + '/Ice-' + version) - runprog('find ' + installDir + '/Ice-' + version + ' -name "*.java" | xargs rm') - else: - runprog('gmake prefix=' + installDir + '/Ice-' + version + ' install') - os.chdir(currentDir) + for d in cvsDirs: + currentDir = os.getcwd() + os.chdir('../' + d) + print 'Going to directory ' + d + if d == 'icej': + shutil.copy('lib/Ice.jar', installDir +'/Ice-' + version + '/lib') + shutil.copy('lib/IceGridGUI.jar', installDir +'/Ice-' + version + '/lib') + runprog('cp -pR ant ' + installDir + '/Ice-' + version) + runprog('find ' + installDir + '/Ice-' + version + ' -name "*.java" | xargs rm') + else: + runprog('gmake prefix=' + installDir + '/Ice-' + version + ' install') + os.chdir(currentDir) # # Sources should have already been built and installed. We @@ -1069,34 +1069,34 @@ def main(): os.chdir(installDir) if not getPlatform().startswith('linux'): - # - # Get third party libraries. - # - dbLocation = os.environ['DB_HOME'] - dbFiles = getDBfiles(dbLocation) - for f in dbFiles: + # + # Get third party libraries. + # + dbLocation = os.environ['DB_HOME'] + dbFiles = getDBfiles(dbLocation) + for f in dbFiles: if not os.path.exists('Ice-' + version + '/' + f.strip()): shutil.copy(dbLocation + '/' + f.strip(), 'Ice-' + version + '/' + f.strip()) if getPlatform() == 'macosx': - copyExpatFiles(os.environ['EXPAT_HOME'], version) + copyExpatFiles(os.environ['EXPAT_HOME'], version) if getPlatform() == 'hpux': - ssl = os.environ['OPENSSL_HOME'] - shutil.copy('%s/bin/openssl' % ssl, 'Ice-%s/bin' % version) -# runprog('cp -R ' + ssl + '/include Ice-' + version) - runprog('cp ' + ssl + '/lib/lib*.sl.* Ice-' + version + '/lib') - runprog('rm -rf Ice-' + version + '/lib/libfips*') + ssl = os.environ['OPENSSL_HOME'] + shutil.copy('%s/bin/openssl' % ssl, 'Ice-%s/bin' % version) +# runprog('cp -R ' + ssl + '/include Ice-' + version) + runprog('cp ' + ssl + '/lib/lib*.sl.* Ice-' + version + '/lib') + runprog('rm -rf Ice-' + version + '/lib/libfips*') runprog('rm -rf Ice-' + version + '/lib/engines') - runprog('rm -rf Ice-' + version + '/lib/pkgconfig') - runprog('rm -f Ice-' + version + '/lib/*.a') + runprog('rm -rf Ice-' + version + '/lib/pkgconfig') + runprog('rm -f Ice-' + version + '/lib/*.a') uname = readcommand('uname') platformSpecificFiles = [ 'README', 'SOURCES', 'THIRD_PARTY_LICENSE' ] for psf in platformSpecificFiles: - cf = os.path.join(installFiles, 'unix', psf + '.' + uname) - if os.path.exists(cf): - shutil.copy(cf, os.path.join('Ice-' + version, psf)) + cf = os.path.join(installFiles, 'unix', psf + '.' + uname) + if os.path.exists(cf): + shutil.copy(cf, os.path.join('Ice-' + version, psf)) # # Remove build files from binary distribution. |