diff options
author | Brent Eagles <brent@zeroc.com> | 2007-02-13 16:47:56 +0000 |
---|---|---|
committer | Brent Eagles <brent@zeroc.com> | 2007-02-13 16:47:56 +0000 |
commit | 72e714638a45c9a05e20c399ad7ba1fd704e1c3b (patch) | |
tree | 4c4c072832a633dce569c903b5bbd8af4ba560a8 | |
parent | Removed old scripts (diff) | |
download | ice-72e714638a45c9a05e20c399ad7ba1fd704e1c3b.tar.bz2 ice-72e714638a45c9a05e20c399ad7ba1fd704e1c3b.tar.xz ice-72e714638a45c9a05e20c399ad7ba1fd704e1c3b.zip |
adding a version fixer upper
-rwxr-xr-x | cpp/install/common/components.py | 40 | ||||
-rwxr-xr-x | cpp/install/common/components/components.ini | 5 |
2 files changed, 41 insertions, 4 deletions
diff --git a/cpp/install/common/components.py b/cpp/install/common/components.py index 610e999930c..d9962bc688a 100755 --- a/cpp/install/common/components.py +++ b/cpp/install/common/components.py @@ -54,14 +54,39 @@ def recursiveListing(path): result.append(fullpath) return result +def fixVersion(file, argsHash): + if not argsHash.has_key('version'): + print "fixVersion unable to execute, no version information available" + return + + version = argsHash['version'] + + origfile = file + ".orig" + os.rename(file, origfile) + oldFile = open(origfile, "r") + newFile = open(file, "w") + line = oldFile.read(); + line = re.sub("@ver@", version, line) + newFile.write(line) + newFile.close() + oldFile.close() + os.remove(origfile) + class FileSpecWorker: - def __init__(self, id, source, dest): + def __init__(self, id, source, dest, processors): self.id = id self.source = source self.dest = dest self.include = [] self.exclude = [] self.explicit = [] + self.processors = [] + for p in processors: + if globals().has_key(p.strip()): + self.processors.append(p.strip()) + else: + print "Possible component configuration error:" + print " Section %s is configured with non-existant processor %s." % (id, p.trim()) def add(self, filename): parts = filename.split("=") @@ -308,6 +333,10 @@ class FileSpecWorker: shutil.copy2(d + ".bak", d) os.remove(d + ".bak") + if self.processors != None and len(self.processors) > 0: + for p in self.processors: + e = globals()[p.strip()] + e(d, defaults) except IOError, e: logging.info('Copying %s to %s failed: %s' % (s, d, str(e))) @@ -365,13 +394,17 @@ def stage(filename, componentdir, stageDirectory, group, defaults): template = cfg.get(section, "filetemplate%d" %i, True) mapping = defaults + processors = [] + if cfg.has_option(section, "processor%d" % i): + processors = cfg.get(section, "processor%d" % i).split(',') + 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("%s.%s.%d" % (filename, section.replace(" ", "_"), i), source, os.path.join(currentBase, dest)) + worker = FileSpecWorker("%s.%s.%d" % (filename, section.replace(" ", "_"), i), source, os.path.join(currentBase, dest), processors) for line in componentFile: current = line.strip() if line.startswith('#'): @@ -401,8 +434,7 @@ def stage(filename, componentdir, stageDirectory, group, defaults): logging.warning(msg) else: # - # XXX- fake is set to true while we are - # debugging. + # NOTE: set fake to true while debugging. # worker.execute(defaults, False) diff --git a/cpp/install/common/components/components.ini b/cpp/install/common/components/components.ini index 9b22d1b6c76..27812254d80 100755 --- a/cpp/install/common/components/components.ini +++ b/cpp/install/common/components/components.ini @@ -52,9 +52,11 @@ active=1 source1=%(INSTALL_TOOLS)s/common filelist1=installer.data dest1=./ +processor1=fixVersion source2=%(INSTALL_TOOLS)s/%(target)s/doc filelist2=installer.docs dest2=doc +processor2=fixVersion source3=%(BUILD_DIR)s/release/Ice-%(version)s/doc filelist3=ice.docs dest3=html/doc @@ -70,6 +72,7 @@ dest6=html/doc/reference/stylesheet-images source7=%(INSTALL_TOOLS)s/common/docs/%(target)s filelist7=generated.installer.docs dest7=doc +processor7=fixVersion [ice packages common] elements=3 @@ -77,6 +80,7 @@ active=1 source1=%(INSTALL_TOOLS)s/common filelist1=packages.data dest1=. +processor1=fixVersion source2=%(INSTALL_TOOLS)s/common/docs/%(target)s filelist2=packages.docs.%(target)s dest2=. @@ -135,6 +139,7 @@ dest8=bin source9=%(INSTALL_TOOLS)s/windows filelist9=sample.config.files dest9=config +processor9=fixVersion source10=%(BUILD_DIR)s/release/IceJ-%(version)s-java2/resources filelist10=icegrid.help |