diff options
author | Brent Eagles <brent@zeroc.com> | 2005-12-08 19:27:22 +0000 |
---|---|---|
committer | Brent Eagles <brent@zeroc.com> | 2005-12-08 19:27:22 +0000 |
commit | afba20bc64e154c18fc80e78540702b03f4a1192 (patch) | |
tree | 595e5ece8c9628a0ea2ffd9c80f1b33b19d827dd /cpp | |
parent | adding missing installer components and worked out way to filter out demo (diff) | |
download | ice-afba20bc64e154c18fc80e78540702b03f4a1192.tar.bz2 ice-afba20bc64e154c18fc80e78540702b03f4a1192.tar.xz ice-afba20bc64e154c18fc80e78540702b03f4a1192.zip |
moving makewindist.py to using new staging logic... the vc71 installer does
not build correctly yet
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/install/common/components.py | 320 | ||||
-rwxr-xr-x | cpp/install/common/components/ms.dlls.vc60 | 2 | ||||
-rwxr-xr-x | cpp/install/common/components/ms.dlls.vc71 | 2 | ||||
-rwxr-xr-x | cpp/install/common/makewindist.py | 568 | ||||
-rwxr-xr-x | cpp/install/common/stage.xml | 16 |
5 files changed, 680 insertions, 228 deletions
diff --git a/cpp/install/common/components.py b/cpp/install/common/components.py new file mode 100755 index 00000000000..13df10db731 --- /dev/null +++ b/cpp/install/common/components.py @@ -0,0 +1,320 @@ +# +# Defines Ice components +# + +import ConfigParser, sys, os, logging, fnmatch, os.path, shutil, re + +def listFileLists(): + """Information routine for getting lists of file lists from a components file""" + cfg = ConfigParser.SafeConfigParser() + cfg.read("./components/components.ini") + for f in cfg.sections(): + try: + if cfg.getint(f, "active") == 1: + for item, value in cfg.items(f): + if item.startswith("filelist"): + print value + except ConfigParser.NoOptionError: + continue + +class StageFileError: + """Thrown when there is a problem with the stage configuration file.""" + def __init__(self, msg = None): + self.msg = msg + + def __str__(self): + return repr(self.msg) + +class ComponentDefError: + """Indicates a component definition file has an error that provides + proper interpretation""" + + def __init__(self, msg = None): + self.msg = msg + + def __str__(self): + return repr(self.msg) + +class FileSpecError(ComponentDefError): + """Indicates a filespec component definition file has a syntactical + error""" + def __init__(self, msg = None): + ComponentDefError.__init__(self, msg) + +def recursiveListing(path): + """Provides a recursive directory listing based in path""" + result = [] + files = os.listdir(path) + for x in files: + fullpath = os.path.join(path, x); + if os.path.isdir(fullpath) and not os.path.islink(fullpath): + result.extend(recursiveListing(fullpath)) + else: + result.append(fullpath) + return result + +class FileSpecWorker: + def __init__(self, source, dest): + self.source = source + self.dest = dest + self.include = [] + self.exclude = [] + self.explicit = [] + + def add(self, filename): + parts = filename.split("=") + if len(parts) < 2: + # + # This line doesn"t have a separator and so assume its an + # explicit listing + # + self.explicit.append(filename) + return + + if parts[0].startswith("include"): + self.include.append(parts[1].strip()) + elif parts[0].startswith("exclude"): + self.exclude.append(parts[1].strip()) + elif parts[0].startswith("expect"): + pass + else: + raise FileSpecError("Line \'%s\' does not match filespec schema." % filename) + + def execute(self, fake = False): + """Copy all of the specified files.""" + recursiveIncludes = [] + recursiveExcludes = [] + + midmatchIncludes = [] + midmatchExcludes = [] + + localIncludes = [] + localExcludes = [] + + for f in self.include: + if f.startswith("**/"): + if f.endswith("/**"): + midmatchIncludes.append(".*%s.*" %f[3:len(f) -3].replace('/', '.')) + else: + recursiveIncludes.append(f[3:]) + else: + if f.endswith("/**"): + midmatchIncludes.append("%s.*" %f[0:len(f) -3].replace('/', '.')) + else: + localIncludes.append(f) + + for f in self.exclude: + if f.startswith("**/"): + if f.endswith("/**"): + midmatchExcludes.append(".*%s.*" % f[3:len(f) -3].replace('/', '.')) + else: + recursiveExcludes.append(f[3:]) + else: + if f.endswith("/**"): + midmatchExcludes.append("%s.*" %f[0:len(f) -3].replace('/', '.')) + else: + localExcludes.append(f) + + logging.debug('localIncludes: ' + str(localIncludes)) + logging.debug('localExcludes: ' + str(localExcludes)) + logging.debug('recursiveIncludes: ' + str(recursiveIncludes)) + logging.debug('recursiveExcludes: ' + str(recursiveExcludes)) + logging.debug('midmatchIncludes: ' + str(midmatchIncludes)) + logging.debug('midmatchExcludes: ' + str(midmatchExcludes)) + + fullListing = [] + result = [] + files = os.listdir(self.source) + + for f in files: + fullpath = os.path.join(self.source, f); + if os.path.isdir(fullpath) and not os.path.islink(fullpath): + fullListing.extend(recursiveListing(fullpath)) + continue + + for p in localIncludes + recursiveIncludes: + if fnmatch.fnmatch(f, p): + found = False + for x in localExcludes + recursiveExcludes: + if fnmatch.fnmatch(f, x): + found = True + break + if not found: result.append(f) + + inmatches = [] + for p in recursiveIncludes: + inmatches.extend(fnmatch.filter(fullListing, p)) + + inSet = set(inmatches) + + for p in midmatchIncludes: + r = re.compile(p) + inmatches = [] + for f in fullListing(f): + rel = f[len(self.source):].strip('\\/') + if not r.match(rel) == None: + inmatches.append(f) + inSet = inSet.union(set(inmatches)) + + outmatches = [] + for x in recursiveExcludes: + outmatches.extend(fnmatch.filter(fullListing, x)) + + outSet = set(outmatches) + + for x in midmatchExcludes: + r = re.compile(x) + outmatches = [] + for f in fullListing: + rel = f[len(self.source):].strip('\\/') + if not r.match(rel) == None: + outmatches.append(f) + outSet = outSet.union(set(outmatches)) + + + # + # Using sets is the "easiest" way to do this. If Python"s set + # implementation is/gets buggy then this needs to be written + # "longhand". + # + diff = inSet - outSet + result.extend(list(diff)) + + for i in range(0, len(result)): + if result[i].startswith(self.source): + result[i] = result[i][len(self.source):].strip('\\/') + + result.sort() + result.extend(self.explicit) + + if fake: + for f in result: + print "Copying %s from %s to %s" % (f, self.source, self.dest) + return + + if logging.getLogger().getEffectiveLevel() == logging.DEBUG: + logging.debug("Files to be copied:") + for f in result: + logging.debug(f) + + for f in result: + # + # an f, prefix means flatten. + # + flatten = False + current = f + if f.startswith('f,'): + flatten = True + current = current[2:] + + targetDirectory = self.dest + targetFile = os.path.basename(current) + if not flatten: + targetDirectory = os.path.join(self.dest, os.path.dirname(current)) + + if not os.path.exists(targetDirectory): + os.makedirs(targetDirectory) + + s = os.path.join(self.source, current) + d = os.path.join(targetDirectory, targetFile) + try: + shutil.copy2(s, d) + except IOError, e: + logging.info('Copying %s to %s failed: %s' % (s, d, str(e))) + raise + +def stage(filename, componentdir, stageDirectory, group, defaults): + cfg = ConfigParser.SafeConfigParser() + cfg.read(filename) + if not cfg.has_section(group): + raise StageFileError("Section %s is missing from component list file." % group) + + sections = [] + for entry in cfg.options(group): + section = cfg.get(group, entry) + if not cfg.has_section(section): + raise StageFileError("Section %s is missing from component list file." % section) + sections.append((entry, section)) + + for stageLoc, section in sections: + try: + currentBase = stageDirectory + for f in stageLoc.split('-'): + currentBase = os.path.join(currentBase, f) + + if not os.path.exists(currentBase): + os.makedirs(currentBase) + + elementCount = cfg.getint(section, "elements") + if elementCount < 0: + raise StageFileError("Section %s elements field is negative value" % section) + + for i in range(1, elementCount + 1): + try: + if cfg.has_option(section, "targets"): + target = cfg.get(section, "targets", False, defaults).strip() + + if "~" + defaults["target"] in target: + continue + elif not defaults["target"] in target: + continue + + source = cfg.get(section, "source%d" % i, False, defaults) + filelist = cfg.get(section, "filelist%d" % i, False, defaults) + dest = cfg.get(section, "dest%d" % i, False, defaults) + # + # Most configurations won"t have file templates. These are usually only used so that file lists can + # be reused but need to be slightly modified for each use case. + # + template = None + mapping = None + if cfg.has_option(section, "filetemplate%d" % i): + # + # We need to get the raw value! + # + template = cfg.get(section, "filetemplate%d" %i, True) + mapping = defaults + + filename = os.path.join(componentdir, filelist) + if not (os.path.exists(filename) and os.path.isfile(filename)): + raise StageFileError("Component file %s does not exist or is not a file" % filename) + + componentFile = file(filename, "r") + try: + worker = FileSpecWorker(source, os.path.join(currentBase, dest)) + for line in componentFile: + current = line.strip() + if line.startswith('#'): + continue + + if len(current) == 0: + continue + if not template == None: + mapping['name'] = current + computedName = template % mapping + logging.log(logging.DEBUG, 'Adding templatized name %s' % computedName) + worker.add(computedName) + else: + worker.add(current % defaults) + + if worker == None: + msg = "Component file %s is empty." % filename + logging.warning(msg) + else: + # + # XXX- fake is set to true while we are + # debugging. + # + worker.execute(False) + + finally: + componentFile.close() + + except ConfigParser.NoOptionError: + raise StageFileError("Section %s has invalid value for element %d" % (section, i)) + + except ConfigParser.NoOptionError: + raise StageFileError("Section %s has invalid or missing elements field" % section) + +if __name__ == "__main__": + print 'components' diff --git a/cpp/install/common/components/ms.dlls.vc60 b/cpp/install/common/components/ms.dlls.vc60 new file mode 100755 index 00000000000..28a5d90bdb3 --- /dev/null +++ b/cpp/install/common/components/ms.dlls.vc60 @@ -0,0 +1,2 @@ +msvcrt.dll
+msvcp60.dll
diff --git a/cpp/install/common/components/ms.dlls.vc71 b/cpp/install/common/components/ms.dlls.vc71 new file mode 100755 index 00000000000..6bc62fe0555 --- /dev/null +++ b/cpp/install/common/components/ms.dlls.vc71 @@ -0,0 +1,2 @@ +msvcr71.dll
+msvcp71.dll
diff --git a/cpp/install/common/makewindist.py b/cpp/install/common/makewindist.py index 38fbf82f82e..ab1c8b0aa74 100755 --- a/cpp/install/common/makewindist.py +++ b/cpp/install/common/makewindist.py @@ -8,15 +8,26 @@ # **********************************************************************
import getopt, os, re, shutil, string, sys, zipfile
+import logging, cStringIO, glob
+import components
-def prependEnvPath(name, path):
- """Prepend a path to an existing environment variable."""
- os.environ[name] = path + os.pathsep + os.environ[name]
+#
+# Current default third party library versions.
+#
+OpenSSLVer = '0.9.8'
+Bzip2Ver = '1.0.3'
+STLPortVer = '4.6.3'
+ExpatVer = '1.95.8'
+DBVer = '4.3.29'
-def prependEnvPathList(name, list):
- """Prepend a list of paths to an existing environment variable."""
- for path in list:
- prependEnvPath(name, path)
+DistPrefixes = ["Ice-", "IceJ-", "IceCS-", "IcePy-", "IcePHP-", "IceVB-"]
+
+class DistEnvironmentError:
+ def __init__(self, msg = None):
+ self.msg = msg
+
+ def __str__(self):
+ return repr(self.msg)
class ExtProgramError:
def __init__(self, msg):
@@ -25,10 +36,25 @@ class ExtProgramError: def __str__(self):
return repr(self.msg)
+def prependEnvPath(name, path):
+ """Prepend a path to an existing environment variable."""
+ logging.debug('Prepending %s to %s' % (path, os.environ[name]))
+ os.environ[name] = path + os.pathsep + os.environ[name]
+
+def prependEnvPathList(name, list):
+ """Prepend a list of paths to an existing environment variable."""
+ for path in list:
+ prependEnvPath(name, path)
+
def runprog(command, haltOnError = True):
+ logging.debug('Running external command: %s' % command)
result = os.system(command)
- if not result == 0 and haltOnError:
- raise ExtProgramError('Command %s failed with error code %d' % (command, result))
+ if not result == 0:
+ msg = 'Command %s failed with error code %d' % (command, result)
+ if haltOnError:
+ raise ExtProgramError('Command %s failed with error code %d' % (command, result))
+ else:
+ logging.error(msg)
def usage():
"""Print usage/help information"""
@@ -39,62 +65,99 @@ def usage(): print " --skip-build Do not build any sources."
print " --clean Clean compiled or staged files."
print " --skip-installer Do not build any installers or merge modules."
-
-def cleanIceDists(sourcesDir, sourcesVersion, installVersion):
- """Clean all Ice distributions."""
- iceHome = os.environ['ICE_HOME']
- if installVersion == "vc71":
- #
- # Ice for C++
- #
- os.chdir(iceHome)
- print "Cleaning in " + os.getcwd() + "..."
- runprog("devenv all.sln /useenv /clean Debug")
- runprog("devenv all.sln /useenv /clean Release")
-
- #
- # Ice for Java
- #
- # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- # Leave Ice for Java alone. Everything that is needed is already
- # included in the source distribution.
- # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- #
-
- #
- # Ice for C#
- #
- os.chdir(os.path.join(sourcesDir, "IceCS-" + sourcesVersion))
- print "Cleaning in " + os.getcwd() + "..."
- runprog("devenv all.sln /useenv /clean Debug")
-
- #
- # Ice for PHP
- #
- os.chdir(os.path.join(sourcesDir, "IcePHP-" + sourcesVersion))
- print "Cleaning in " + os.getcwd() + "..."
- runprog("devenv icephp.sln /useenv /clean Release")
-
- #
- # Ice for Python
- #
- os.chdir(os.path.join(sourcesDir, "IcePy-" + sourcesVersion))
- print "Cleaning in " + os.getcwd() + "..."
- runprog("devenv all.sln /useenv /clean Release")
-
- #
- # Ice for Visual Basic
- #
- os.rename(os.path.join(sourcesDir, "IceCS-" + sourcesVersion), os.path.join(sourcesDir, "IceCS")) # XXX temp
- os.chdir(os.path.join(sourcesDir, "IceVB-" + sourcesVersion))
- print "Cleaning in " + os.getcwd() + "..."
- runprog("devenv all.sln /useenv /clean Debug")
- os.rename(os.path.join(sourcesDir, "IceCS"), os.path.join(sourcesDir, "IceCS-" + sourcesVersion)) # XXX temp
- elif installVersion == "vc60":
- os.chdir(iceHome)
- print "Cleaning in " + os.getcwd() + "..."
- runprog("msdev all.dsw /useenv /make all - Win32 Debug /clean")
- runprog("msdev all.dsw /useenv /make all - Win32 Release /clean")
+ print "-i, --info Log information messages"
+ print "-d, --debug Log debug messages"
+ print "-l, --logfile Specify the destination log file"
+
+def environmentCheck(target):
+ """Warning: uses global environment."""
+ required = ["SOURCES", "BUILD_DIR", "DB_HOME", "BZIP2_HOME", "EXPAT_HOME", "OPENSSL_HOME"]
+ if target == "vc60":
+ required.append("STLPORT_HOME")
+ elif target == "vc71":
+ required.extend(["PHP_BIN_HOME", "PHP_SRC_HOME", "PYTHON_HOME"])
+
+ fail = False
+
+ for f in required:
+ if not os.environ.has_key(f):
+ logging.error("Environment variable %s is missing" % f)
+ fail = True
+ continue
+
+ if not os.path.isdir(os.environ[f]):
+ logging.error("Value %s for env var %s is not a valid directory." % (os.environ[f], f))
+ fail = True
+ continue
+
+ if fail:
+ logging.error("Invalid environment. Please consult error log and repair environment/command line settings.")
+ sys.exit(2)
+
+def maxVersion(a, b):
+ """Compares to version strings. The version strings should be trimmed of leading and trailing whitespace."""
+ if a == b:
+ return a
+
+ avalues = a.split('.')
+ bvalues = b.split('.')
+
+ diff = len(avalues) - len(bvalues)
+ if not diff == 0:
+ if diff < 0:
+ for f in range(0, abs(diff)):
+ avalues.append('0')
+ else:
+ for f in range(0, abs(diff)):
+ bvalues.append('0')
+
+ for i in range(0, len(avalues)):
+ if int(avalues[i]) > int(bvalues[i]):
+ return a
+ elif int(avalues[i]) < int(bvalues[i]):
+ return b
+
+ return a
+
+def testMaxVersion():
+ # Case format first, second, expected.
+ cases = [ ("1.0", "1.0.0", "1.0"), ("0.0", "0.1", "0.1"), ("2.1.0", "2.0.1", "2.1.0"),
+ ("2.1", "2.0.1", "2.1"), ("2.1.9", "2.1.12", "2.1.12")]
+ for a, b, expected in cases:
+ result = maxVersion(a, b)
+ if not expected == result:
+ print "Expected %s from %s and %s, got %s" % (expected, a, b, result)
+ assert(False)
+ print "testMaxVersion() succeeded"
+
+def checkSources(sourceDir):
+ """Scans a directory for source distributions. The version is keyed on the Ice for C++ distribution."""
+
+ icezip = glob.glob(os.path.join(sourceDir, "Ice-*.zip"))
+ if len(icezip) == 0:
+ msg = "Source directory %s does not contain a zip archive for any version of Ice for C++" % sourceDir
+ logging.error(msg)
+ raise DistEnvironmentError(msg)
+
+ keyVersion = '0.0.0'
+ exp = re.compile("Ice-([0-9.]*).zip")
+ current = None
+ for d in icezip:
+ m = exp.match(os.path.split(d)[1])
+ if m == None:
+ print icezip
+ current = m.group(1)
+ keyVersion = maxVersion(keyVersion, current)
+
+ prefixes = list(DistPrefixes)
+ prefixes.remove("Ice-")
+ for prefix in prefixes:
+ if not os.path.exists(os.path.join(sourceDir, "%s%s.zip" % (prefix, keyVersion))):
+ msg = "Source directory %s does not contain archive for %s."
+ logging.error(msg)
+ raise DistEnvironmentError(msg)
+
+ return keyVersion
def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion):
"""Build all Ice distributions."""
@@ -104,35 +167,35 @@ def buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion): # building Ice for C++.
#
path = [
- os.path.join(stageDir, "berkeley/dev/bin"),
- os.path.join(stageDir, "berkeley/runtime/bin"),
- os.path.join(stageDir, "berkeley/java/bin"),
- os.path.join(stageDir, "expat/runtime/bin"),
- os.path.join(stageDir, "openssl/runtime/bin")
+ os.path.join(stageDir, "berkeley", "dev", "bin"),
+ os.path.join(stageDir, "berkeley", "runtime", "bin"),
+ os.path.join(stageDir, "berkeley", "java", "bin"),
+ os.path.join(stageDir, "expat", "runtime", "bin"),
+ os.path.join(stageDir, "openssl", "runtime", "bin")
]
if installVersion == "vc60":
- path.append(os.path.join(stageDir, "stlport/dev/bin"))
- path.append(os.path.join(stageDir, "stlport/runtime/bin"))
+ path.append(os.path.join(stageDir, "stlport", "dev", "bin"))
+ path.append(os.path.join(stageDir, "stlport", "runtime", "bin"))
prependEnvPathList('PATH', path)
lib = [
- os.path.join(stageDir, "berkeley/dev/lib"),
- os.path.join(stageDir, "bzip2/dev/lib"),
- os.path.join(stageDir, "expat/dev/lib"),
- os.path.join(stageDir, "openssl/dev/lib")
+ os.path.join(stageDir, "berkeley", "dev", "lib"),
+ os.path.join(stageDir, "bzip2", "dev", "lib"),
+ os.path.join(stageDir, "expat", "dev", "lib"),
+ os.path.join(stageDir, "openssl", "dev", "lib")
]
if installVersion == "vc60":
- lib.append(os.path.join(stageDir, "stlport/dev/lib"))
+ lib.append(os.path.join(stageDir, "stlport", "dev", "lib"))
prependEnvPathList('LIB', lib)
include = [
- os.path.join(stageDir, "berkeley/dev/include"),
- os.path.join(stageDir, "bzip2/dev/include"),
- os.path.join(stageDir, "expat/dev/include"),
- os.path.join(stageDir, "openssl/dev/include")
+ os.path.join(stageDir, "berkeley", "dev", "include"),
+ os.path.join(stageDir, "bzip2", "dev", "include"),
+ os.path.join(stageDir, "expat", "dev", "include"),
+ os.path.join(stageDir, "openssl", "dev", "include")
]
if installVersion == "vc60":
- include.append(os.path.join(stageDir, "stlport/dev/include/stlport"))
+ include.append(os.path.join(stageDir, "stlport", "dev", "include", "stlport"))
prependEnvPathList('INCLUDE', include)
iceHome = os.environ['ICE_HOME']
@@ -244,6 +307,12 @@ def buildMergeModules(startDir, stageDir, sourcesVersion, installVersion): #
# Archive modules in the stage directory root.
#
+
+ #
+ # <brent> Were we doing something special with third-party merge
+ # modules at one point, like redistributing them?</brent>
+ #
+
zipPath = "ThirdPartyMergeModules-" + sourcesVersion + "-" + installVersion.upper() + ".zip"
zip = zipfile.ZipFile(os.path.join(stageDir, zipPath), 'w')
for project, release in modules:
@@ -261,171 +330,224 @@ def buildInstallers(startDir, stageDir, sourcesVersion, installVersion): #
os.chdir(startDir)
for project, release in installers:
- runprog("ISCmdBld -c COMP -a ZEROC -p " + project + ".ism -r " + release)
+ runprog(os.environ['INSTALLSHIELD_HOME'] + "\ISCmdBld -c COMP -a ZEROC -p " + project + ".ism -r " + release)
msi = project + "-" + sourcesVersion + "-" + installVersion.upper() + ".msi"
msiPath = os.path.join(os.getcwd(), project, "ZEROC", release, "DiskImages/DISK1", msi)
shutil.copy(msiPath, stageDir)
+def environToString(tbl):
+ '''Convert an environment hashtable to the typical k=v format'''
+ ofile = cStringIO.StringIO()
+ result = ''
+ try:
+ for k, v in tbl.iteritems():
+ ofile.write('%s=%s\n' % (k, v))
+ result = ofile.getvalue()
+ finally:
+ ofile.close()
+ return result
+
def main():
+
#
- # Save our start dir. This script expects that this will be
- # <ice-cvs-root>/install/[vc60|vc71]
+ # Save our start dir.
#
startDir = os.getcwd()
- print "Start Directory: " + startDir
-
- installDir = startDir[:startDir.rfind("\\")]
- print "Install Directory: " + installDir
#
- # Check the installer version string.
+ # baseDir will be the reference point for locating the working files
+ # for the installer production scripts. It is defined as the parent
+ # directory for this python file. We'll use the absolute path as
+ # while it is verbose, it is more valuable in tracing.
#
- installVersion = startDir[startDir.rfind("\\")+1:].lower()
- if installVersion != "vc60" and installVersion != "vc71":
- print "Invalid install version."
- sys.exit(2)
- else:
- print "Install Version: " + installVersion
+ installDir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
+ os.environ['INSTALL_TOOLS'] = installDir
+
+ try:
+ #
+ # Process args.
+ #
+ try:
+ optionList, args = getopt.getopt(
+ sys.argv[1:], "dhil:", [ "help", "clean", "skip-build", "skip-installer", "info", "debug",
+ "logfile", "vc60", "vc71", "sslhome=", "expathome=", "dbhome=", "stlporthome=", "bzip2home=",
+ "thirdparty="])
+ except getopt.GetoptError:
+ usage()
+ sys.exit(2)
- #
- # Where all the files will be staged so that the install projects
- # can find them.
- #
- stageDir = os.path.join(startDir, "install")
- print "Stage Directory: " + stageDir
+ #
+ # Set a few defaults.
+ #
+ clean = False
+ build = True
+ installer = True
+ debugLevel = logging.NOTSET
+ logFile = None
+ target = None
+
+ for o, a in optionList:
+ if o in ("-h", "--help"):
+ usage()
+ sys.exit()
+ elif o == "--clean":
+ clean = True
+ elif o == "--skip-build":
+ build = False
+ elif o == "--skip-installer":
+ installer = False
+ elif o in ('-l', '--logfile'):
+ logFile = a
+ elif o in ('-d', '--debug'):
+ debugLevel = logging.DEBUG
+ elif o in ('-', '--info'):
+ debugLevel = logging.INFO
+ elif o == '--vc60':
+ target = 'vc60'
+ elif o == '--vc71':
+ target = 'vc71'
+ elif o == '--sources':
+ os.environ['SOURCES'] = a
+ elif o == '--buildDir':
+ os.environ['BUILD_DIR'] = a
+ elif o == '--sslhome':
+ os.environ['OPENSSL_HOME'] = a
+ elif o == '--expathome':
+ os.environ['EXPAT_HOME'] = a
+ elif o == '--dbhome':
+ os.environ['DB_HOME'] = a
+ elif o == '--stlporthome':
+ os.environ['STLPORT_HOME'] = a
+ elif o == '--bzip2home':
+ os.environ['BZIP2_HOME'] = a
+ elif o == '--thirdparty':
+ os.environ['OPENSSL_HOME'] = os.path.join(a, 'openssl-%s' % OpenSSLVer)
+ os.environ['BZIP2_HOME'] = os.path.join(a, 'bzip2-%s' % Bzip2Ver)
+ os.environ['EXPAT_HOME'] = os.path.join(a, 'expat-%s' % ExpatVer)
+ os.environ['DB_HOME'] = os.path.join(a, 'db-%s' % DBVer)
+ os.environ['STLPORT_HOME'] = os.path.join(a, 'STLPort-%s' % STLPortVer)
+
+ if debugLevel != logging.NOTSET:
+ if a != None:
+ logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s', filename = a)
+ else:
+ logging.basicConfig(level = debugLevel, format='%(asctime)s %(levelname)s %(message)s')
+
+ if target == None:
+ print 'The development target must be specified'
+ sys.exit(2)
+
+ os.environ['target'] = target
- #
- # Process args.
- #
- try:
- optionList, args = getopt.getopt(
- sys.argv[1:], "h:", [ "help", "clean", "skip-build", "skip-installer" ])
- except getopt.GetoptError:
- usage()
- sys.exit(2)
+ #
+ # Where all the files will be staged so that the install projects
+ # can find them.
+ #
+ targetDir = os.path.join(installDir, target)
+ stageDir = os.path.join(targetDir, "install")
- #
- # Set a few defaults.
- #
- clean = False
- build = True
- installer = True
-
- for o, a in optionList:
- if o in ("-h", "--help"):
- usage()
- sys.exit()
- elif o == "--clean":
- clean = True
- elif o == "--skip-build":
- build = False
- elif o == "--skip-installer":
- installer = False
-
- if clean:
- print('You have indicated you want to ''clean'' files, starting from scratch.')
- confirm = ''
- while not confirm in ['y', 'n']:
- confirm = raw_input('Are you sure? [y/N]')
- if confirm == '':
- confirm = 'n'
- if confirm == 'n':
- sys.exit()
- else:
- 'Deleting intermediate files and rebuilding from scratch!'
+ logging.info("Install Tool: " + installDir)
+ logging.info("Target Directory: " + targetDir)
+ logging.info("Stage Directory: " + stageDir)
- #
- # Check the environment for the required vars.
- #
- ok = True
- required = ['ICE_HOME', 'BERKELEY_HOME', 'BZIP2_HOME', 'EXPAT_HOME', 'OPENSSL_HOME', 'JGOODIES_HOME']
- if installVersion == "vc71":
- required.extend(['PHP_BIN_HOME', 'PHP_SRC_HOME', 'PYTHON_HOME'])
- elif installVersion == "vc60":
- required.append('STLPORT_HOME')
- for var in required:
- path = os.environ[var]
- if path == "":
- print var + " is not set!"
- ok = False
- elif not os.path.isdir(path):
- print var + " is invalid!"
- ok = False
- else:
- print var + ": " + path
- if not ok:
- sys.exit(2)
+ if clean:
+ print('You have indicated you want to ''clean'' files, starting from scratch.')
+ confirm = ''
+ while not confirm in ['y', 'n']:
+ confirm = raw_input('Are you sure? [y/N]')
+ if confirm == '':
+ confirm = 'n'
+ if confirm == 'n':
+ sys.exit()
+ else:
+ logging.info('Deleting intermediate files and rebuilding from scratch!')
- iceHome = os.environ['ICE_HOME']
- berkeleyHome = os.environ['BERKELEY_HOME']
- bzip2Home = os.environ['BZIP2_HOME']
- expatHome = os.environ['EXPAT_HOME']
- opensslHome = os.environ['OPENSSL_HOME']
- jgoodiesHome = os.environ['JGOODIES_HOME']
+ logging.info('Starting windows installer creation.')
- if installVersion == "vc71":
- phpBinHome = os.environ['PHP_BIN_HOME']
- phpSrcHome = os.environ['PHP_SRC_HOME']
- pythonHome = os.environ['PYTHON_HOME']
- stlportHome = ""
- elif installVersion == "vc60":
- phpBinHome = ""
- phpSrcHome = ""
- pythonHome = ""
- stlportHome = os.environ['STLPORT_HOME']
+ environmentCheck(target)
- #
- # Extract the Ice source distributions directory.
- #
- sourcesDir = iceHome[:iceHome.rfind("\\Ice-")]
- print "Ice Sources Directory: " + sourcesDir
+ buildDir = os.environ['BUILD_DIR']
- #
- # Extract the Ice distribution version.
- #
- sourcesVersion = iceHome[iceHome.rfind("-")+1:]
- if not re.match("^\d\.\d\.\d$", sourcesVersion):
- print "Invalid Version: " + sourcesVersion
- sys.exit(2)
- else:
- print "Ice Sources Version: " + sourcesVersion
-
- antOptions = " -buildfile " + os.path.join(installDir, "common/stage.xml") + \
- " -Dinstall.dir=" + installDir + \
- " -Dinstall.version=" + installVersion + \
- " -Dsources.dir=" + sourcesDir + \
- " -Dsources.version=" + sourcesVersion + \
- " -Dstage.dir=" + stageDir
+ logging.debug(environToString(os.environ))
- #
- # This should be performed every time. The third party libraries are
- # rebuilt 'out-of-band' so there is no way for the script to pickup
- # changes in them.
- #
- runprog("ant" + antOptions + " clean")
+ sourcesVersion = checkSources(os.environ['SOURCES'])
- if clean:
- cleanIceDists(sourcesDir, sourcesVersion, installVersion)
+ #
+ # XXX - implement 'refresher'
+ #
- #
- # Stage the third party packages.
- #
- if installer:
- runprog("ant" + antOptions + " packages-stage-" + installVersion)
+ #
+ # Screw clean rules, run the ultimate clean!
+ #
+ if clean:
+ shutil.rmtree(buildDir)
+ os.mkdir(buildDir)
+
+ for z in DistPrefixes:
+ #
+ # TODO: See if this can be replaced by ZipFile and native
+ # Python code somehow.
+ #
+ filename = os.path.join(os.environ['SOURCES'], "%s%s.zip" % (z, sourcesVersion))
+ if not os.path.exists(os.path.join(os.environ['BUILD_DIR'], "%s%s" % (z, sourcesVersion))):
+ runprog("unzip -q %s -d %s" % (filename, os.environ['BUILD_DIR']))
+
+ os.environ['ICE_HOME'] = os.path.join(os.environ['BUILD_DIR'], "Ice-%s" % sourcesVersion)
+
+ defaults = os.environ
+ defaults['dbver'] = '43'
+ defaults['version'] = sourcesVersion
+ defaults['dllversion'] = sourcesVersion.replace('.', '')[:2]
+
+ if os.path.exists(stageDir):
+ try:
+ shutil.rmtree(stageDir)
+ except IOError:
+ print """
+If you are getting a permission error here, try running 'attrib -r /s'
+on both the stage directory and the source location for the third party
+libraries."""
+ raise
+ os.mkdir(stageDir)
- #
- # Build the Ice distributions.
- #
- if build:
- buildIceDists(stageDir, sourcesDir, sourcesVersion, installVersion)
+ #
+ # The third party packages need to be staged before building the
+ # distributions. This ordering is important because it adds an
+ # additional check that the third party packages that are
+ # included in the installer are suitable for use with Ice.
+ #
+ components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
+ os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "packages", defaults)
- #
- # Build the merge module and installer projects.
- #
- if installer:
- runprog("ant" + antOptions + " ice-stage-" + installVersion)
- buildMergeModules(startDir, stageDir, sourcesVersion, installVersion)
- buildInstallers(startDir, stageDir, sourcesVersion, installVersion)
+ #
+ # Build the merge module projects.
+ #
+ if installer:
+ buildMergeModules(targetDir, stageDir, sourcesVersion, target)
+
+ #
+ # Build the Ice distributions.
+ #
+ if build:
+ buildIceDists(stageDir, os.environ['BUILD_DIR'], sourcesVersion, target)
+
+ #
+ # Stage Ice!
+ #
+ components.stage(os.path.join(os.path.dirname(components.__file__), "components", "components.ini"),
+ os.path.join(os.path.dirname(components.__file__), "components"), stageDir, "ice", defaults)
+
+ #
+ # Build the installer projects.
+ #
+ if installer:
+ buildInstallers(targetDir, stageDir, sourcesVersion, target)
+
+ finally:
+ #
+ # Return the user to where they started.
+ #
+ os.chdir(startDir)
if __name__ == "__main__":
main()
diff --git a/cpp/install/common/stage.xml b/cpp/install/common/stage.xml index 1a359e5548b..38306a727ab 100755 --- a/cpp/install/common/stage.xml +++ b/cpp/install/common/stage.xml @@ -91,6 +91,7 @@ <copy todir="${stage.dir}/packages-common"> <fileset dir="${doc.dir}"> <include name="**.rtf"/> + <!-- should be explicit --> </fileset> </copy> <copy file="${doc.dir}/THIRD_PARTY_LICENSE.rtf" tofile="${stage.dir}/packages-common/LICENSE.rtf"/> @@ -102,13 +103,18 @@ </target> + <!-- XXX Just about all of the copy overwrites are left to their default of + false. This is either a good thing or a bad thing. It all depends if you + want to make it so you can edit something in the staging area and not have + it overwritten. --> + <!-- Ice for C++ Runtime--> <target name="ice-cpp-runtime" depends="setup"> <!-- Binaries --> <mkdir dir="${stage.dir}/ice-cpp/runtime/bin"/> - <copy todir="${stage.dir}/ice-cpp/runtime/bin" flatten="true"> - <fileset dir="${ice.dir}/bin"> + <copy todir="${stage.dir}/ice-cpp/runtime/bin" flatten="true" verbose="true"> + <filelist dir="${ice.dir}/bin"> <include name="freeze30.dll"/> <include name="glacier230.dll"/> <include name="ice30.dll"/> @@ -122,8 +128,8 @@ <include name="icexml30.dll"/> <include name="slice30.dll"/> <include name="icegrid30.dll"/> - </fileset> - <fileset dir="${ice.dir}/src"> + </filelist> + <filelist dir="${ice.dir}/src"> <include name="FreezeScript/Release/dumpdb.exe"/> <include name="FreezeScript/Release/transformdb.exe"/> <include name="Glacier2/Release/glacier2router.exe"/> @@ -138,7 +144,7 @@ <include name="IceGrid/Release/icegridadmin.exe"/> <include name="IceGrid/Release/icegridnode.exe"/> <include name="IceGrid/Release/icegridregistry.exe"/> - </fileset> + </filelist> </copy> <copy file="${icej.dir}/lib/IceGridGUI.jar" todir="${stage.dir}/ice-cpp/runtime/bin" flatten="true"/> |