From: akl Date: Mon, 26 May 2008 06:52:47 +0000 (+0000) Subject: Restore InstallWizard batch mode. X-Git-Tag: V4_1_3~12 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cce125e11c43fea1e4c554b50880e87d721cb6f1;p=tools%2Finstall.git Restore InstallWizard batch mode. --- diff --git a/bin/SALOME_InstallWizard b/bin/SALOME_InstallWizard index a91cf1c..3449bc7 100755 Binary files a/bin/SALOME_InstallWizard and b/bin/SALOME_InstallWizard differ diff --git a/runInstall b/runInstall index 0bfbf96..2979f28 100755 --- a/runInstall +++ b/runInstall @@ -17,7 +17,7 @@ import warnings warnings.filterwarnings("ignore", "", DeprecationWarning) # --- imports --- # -import xmllib +import xml.sax, xml.dom.minidom import sys, os, re import types import random @@ -26,16 +26,13 @@ import random opt_parser = None root_path = None -# --- XML tags definition --- # -__TAG__SOURCES__ = "install sources" -__TAG__BINARIES__ = "install binaries" -__TAG__NATIVE__ = "use native" -__TAG__PREINSTALL__ = "not install" -__TAG__BUILDSRC__ = "build sources" +# --- actions definition --- # +__BINARIES__ = "install_binary" +__BUILDSRC__ = "install_source_and_build" +__PREINSTALL__ = "try_preinstalled" -# --- product context definition --- # -__CTX__SALOME__SRC__ = "salome sources" -__CTX__SALOME__BIN__ = "salome binaries" +# --- product type definition --- # +__CTX__COMPONENT__ = "component" __CTX__PREREQUISITE__ = "prerequisite" #------------------------------------------------------------------# @@ -159,7 +156,7 @@ class ArgOption: msg = "invalid type: %s : should be 'bool' or None" % self.type raise OptError(msg, self) # default - if self.default: + if self.default is not None: try: if self.type == "string": self.default = str(self.default) if self.type == "int": self.default = int(self.default) @@ -223,7 +220,7 @@ class ArgParser: if not args: args = sys.argv[1:] values = Values() for o in self.options: - if o.default: + if o.default is not None: setattr(values, o.dest, o.default) elif not hasattr(values,o.dest): setattr(values, o.dest, None) @@ -388,21 +385,6 @@ class Config : self.targetdir = strip(theTargetdir) self.tmpdir = strip(theTmpdir) -## #=================================================================== -## # class Path : default target, temporary directories options -## #=================================================================== -## class Path : -## """ -## Path options: -## - default target directory -## - default temporary directory -## """ -## def __init__(self, -## theTargetdir = None, -## theTmpdir = None): -## self.targetdir = strip(theTargetdir) -## self.tmpdir = strip(theTmpdir) - #============================================================== # class Product : pre-requisite product options #============================================================== @@ -411,7 +393,6 @@ class Product : Product options: - name, version - target Linux OS version - - supported installation modes and the default one - dependencies - required disk space - installation script @@ -422,128 +403,141 @@ class Product : theType = None, theOS = None, theVersion = None, - theInstall = None, - theSupportred = None, theDependencies = None, + theWoGuiInstallation = None, theInstalldiskspace = None, - theTemporarydiskspace = None, theScript = None, thePickUpEnvironment = None): self.name = strip(theName) self.type = strip(theType) self.os = strip(theOS) self.version = strip(theVersion) - self.install = strip(theInstall) - self.supported = strip(theSupportred) self.dependencies = strip(theDependencies) + self.woguiinst = strip(theWoGuiInstallation) self.installdiskspace = strip(theInstalldiskspace) - self.temporarydiskspace = strip(theTemporarydiskspace) self.script = strip(theScript) self.pickupEnv = strip(thePickUpEnvironment) - self.whattodo = self.install + self.whattodo = __BINARIES__ - def hasContext(self, ctx): - try: - return ctx in [ strip(s) for s in self.context.split(",") ] - except: - pass - return False - def setMode(self, mode): - if mode not in [__TAG__SOURCES__, __TAG__BINARIES__, __TAG__NATIVE__, __TAG__PREINSTALL__]: + if mode not in [__BINARIES__, __BUILDSRC__, __PREINSTALL__]: return - try: - supported = [ strip(s) for s in self.supported.split(",") ] - if mode in supported or mode == __TAG__PREINSTALL__: - self.install = mode - self.whattodo = self.install - salbin = self.hasContext(__CTX__SALOME__BIN__) - salsrc = self.hasContext(__CTX__SALOME__SRC__) - if mode == __TAG__SOURCES__: - if salbin and not salsrc: - self.install = __TAG__PREINSTALL__ - self.whattodo = self.install - elif salsrc: - self.whattodo = __TAG__BUILDSRC__ - except: - pass + self.whattodo = mode return #=================================================================== # class ConfigParser : XML files parser implementation #=================================================================== -class ConfigParser(xmllib.XMLParser): +class ConfigParser: """ XML configuration files parser """ def __init__(self, is_force_src=False): - xmllib.XMLParser.__init__(self) - self.products = [] - self.currentdata = [] -## self.path = None + self.docElem = None + self.products = list() + self.full_prods_list = list() self.config = None self.is_force_src = is_force_src + pass - def handle_data(self, data): - self.currentdata.append(data) + def parse_config(self): + # Parse 'config' part of the XML file + configElem = self.docElem.getElementsByTagName('config')[0] - def start_config(self, attrs): - self.config = Config(attrs.get('version', None), - attrs.get('caption', None), - attrs.get('copyright', None), - attrs.get('license', None), - attrs.get('platforms', None), - attrs.get('targetdir', None), - attrs.get('tempdir', None)) + self.config = Config(configElem.getAttribute('version').strip(), + configElem.getAttribute('caption').strip(), + configElem.getAttribute('copyright').strip(), + configElem.getAttribute('license').strip(), + configElem.getAttribute('platforms').strip(), + configElem.getAttribute('targetdir').strip(), + configElem.getAttribute('tempdir').strip()) pass - def end_config(self): - pass - - def start_product(self, attrs): - if not attrs.get('name', '').strip(): return - if check_bool(attrs.get('disable', 'false')): return - aProduct = Product(attrs.get('name'), - attrs.get('type', None), - attrs.get('version', None), - attrs.get('install', None), - attrs.get('supported', None), - attrs.get('dependancies', None), - attrs.get('installdiskspace', None), - attrs.get('temporarydiskspace', None), - attrs.get('script', None), - attrs.get('pickupenv', None)) - if self.is_force_src: - aProduct.setMode(__TAG__SOURCES__) - self.products.append(aProduct) + def parse_dependencies(self): + # Parse 'dependencies' part of the XML file + depsMap = {} + depsElem = self.docElem.getElementsByTagName('dependencies')[0] + for prodElem in depsElem.getElementsByTagName('product'): + prodName = prodElem.getAttribute('name').strip() + if not prodName: continue + depsList = list() + for depElem in prodElem.getElementsByTagName('dep'): + depsList.append(depElem.firstChild.data) + pass + depsMap[prodName] = depsList + pass + return depsMap + + def parse_product(self): + # Parse 'products' part of the XML file + depsMap = self.parse_dependencies() + prodsElem = self.docElem.getElementsByTagName('products')[0] + sal_prods_list = list(); req_prods_list = list() + modules_list = list(); prereqs_list = list() + for prodElem in prodsElem.getElementsByTagName('product'): + prodName = prodElem.getAttribute('name').strip() + if not prodName: continue + instElem = prodElem.getElementsByTagName('installation')[0] + if check_bool(str(instElem.getAttribute('disable').strip())): continue + depsList = list() + if prodName in depsMap: depsList = depsMap[prodName] + aProduct = Product(prodName, + prodElem.getAttribute('type').strip(), + instElem.getAttribute('os').strip(), + instElem.getAttribute('version').strip(), + depsList, + instElem.getAttribute('woguimode').strip(), + instElem.getAttribute('installdiskspace').strip(), + instElem.getAttribute('script').strip(), + instElem.getAttribute('pickupenv').strip()) + if self.is_force_src: + aProduct.setMode(__BUILDSRC__) + pass + if prodElem.getAttribute('type').strip() == "component": + sal_prods_list.append(aProduct) + # fill an ordered modules list ----------- + modules_list.append(prodName) + modules_list.append(prodName + "_src") + pass + else: #prerequisite + req_prods_list.append(aProduct) + # fill an ordered prerequisites list ----------- + prereqs_list.append(prodName) + #AKL: prerequisite sources and temp files are removed, by default. + # So, there is no need to make sources environment + #if aProduct.whattodo == __BUILDSRC__: prereqs_list.append(prodName + "_src") + pass + pass + self.products.extend( req_prods_list ) + self.products.extend( sal_prods_list ) + if len(self.products) != 0: + gcc_product = Product("gcc", + __CTX__PREREQUISITE__, + self.products[0].os, + "", + list(), + None, + "0,0,0", + "gcc-common.sh", + "") + gcc_product.setMode(__PREINSTALL__) + self.products.insert(0, gcc_product) + prereqs_list.insert(0, gcc_product.name) + pass + self.full_prods_list.extend( prereqs_list ) + self.full_prods_list.extend( modules_list ) pass - def end_product(self): - pass + def parse(self, xml_file): + filehandle = open(xml_file) + sax_parser = xml.sax.make_parser() + doc = xml.dom.minidom.parse(filehandle, sax_parser) + filehandle.close() - def start_installation(self, attrs): -## anInstallation = Installation(attrs.get('os', None), -## attrs.get('type', None), -## attrs.get('version', None), -## attrs.get('install', None), -## attrs.get('supported', None), -## attrs.get('dependancies', None), -## attrs.get('installdiskspace', None), -## attrs.get('temporarydiskspace', None), -## attrs.get('script', None), -## attrs.get('pickupenv', None)) + self.docElem = doc.documentElement + self.parse_config() + self.parse_product() pass - - def end_installation(self): - pass - -## def start_path (self, attrs): -## self.path = Path(attrs.get('targetdir', None), -## attrs.get('tempdir', None)) -## pass - -## def end_path(self): -## pass def getProduct(self, prod): for product in self.products: @@ -551,11 +545,6 @@ class ConfigParser(xmllib.XMLParser): return product return None - def getInstallation(self, os): - for product in self.products: - if product.name == prod: - return product - return None #------------------------------------------------------------------# # # @@ -668,7 +657,7 @@ def parse_parameters(): dest="gui", default=True, help=help_str) - help_str = "Runs the Installation Wizard in the TUI mode (UNAVAILABLE NOW)." + help_str = "Runs the Installation Wizard in the TUI mode." opt_parser.add_option("-b", "--batch", action="store_false", @@ -702,6 +691,15 @@ def parse_parameters(): dest="tmp_dir", metavar="DIR", help=help_str) + help_str = "Force all products to be installed from sources \n" + help_str += "including SALOME modules.\n" + help_str += "If this option is used all the default installation modes are ignored." + opt_parser.add_option("-a", + "--all-from-sources", + action="store_true", + dest="force_sources", + default=False, + help=help_str) help_str = "Prints version information and quits." opt_parser.add_option("-v", "--version", @@ -726,7 +724,7 @@ def parse_parameters(): os.system(cmd) print "" sys.exit(0) - return [options.xmlfile, options.target_dir, options.tmp_dir, options.gui] + return [options.xmlfile, options.target_dir, options.tmp_dir, options.gui, options.force_sources] #================================================================= # strip : removes spaces at the beginning and at the end of the @@ -746,19 +744,26 @@ def strip(param): #================================================================= def get_dependencies(prods): """ - Gets full list of pre-requisite products. + Gets a list of installed and required products. """ - list = [] + prods_list = list() for product in prods: - deps = product.dependencies.split(",") - for dep in deps: - if dep and not dep in list: - list.append( dep ) - - if product and not product in list: - list.append( product.name ) + for dep in product.dependencies: + if dep and dep not in prods_list: + prods_list.append( dep ) + dep_name = dep + if product.whattodo == __BUILDSRC__: + dep_name = dep + "_src" + if dep_name not in parser.full_prods_list: + msg = "Prerequisite '%s' is required for '%s' product,\n"%(dep, product.name) + msg += "but the first one is absent in the list of products to be installed!\n" + msg += "Please check your XML file." + warning(msg) + + if product.name and product.name not in prods_list: + prods_list.append( product.name ) - return " ".join( list ) + return " ".join( prods_list ) #============================================================== # create_dir : creates a directory with (optional) permissions, @@ -848,35 +853,28 @@ def check_disk_space(products, scripts_dir, target_dir, tmp_dir, is_force_src=Fa install_space = 0 temporary_space = 0 for product in products: - if product.install in [__TAG__NATIVE__, __TAG__PREINSTALL__]: - continue prod_space = 0 try: spaces = product.installdiskspace.split(',') prod_space = int( spaces[0] ) - if len( spaces ) > 1 and product.install == __TAG__SOURCES__ and not is_force_src: - prod_space = int( spaces[1] ) + if product.whattodo == __BINARIES__: + prod_space = int( spaces[0] ) + if product.type == __CTX__COMPONENT__: + prod_space += int( spaces[1] ) + else: + if product.type == __CTX__PREREQUISITE__: + prod_space = int( spaces[0] ) + else: + prod_space = int( spaces[2] ) except: pass install_space = install_space + prod_space - if product.install == __TAG__SOURCES__: - tmp_space = 0 - try: - tmp_space = int( product.temporarydiskspace ) - except: - pass - temporary_space = max( temporary_space, tmp_space ) pass res = os.system("%s/%s %s %d"%(scripts_dir, "checkSize.sh", target_dir, install_space)) if res: msg = "There is no enough space to install the products. Stopped..." error_exit(msg, False) - - res = os.system("%s/%s %s %d"%(scripts_dir, "checkSize.sh", tmp_dir, temporary_space)) - if res: - msg = "There is no enough space for temporary directory. Stopped..." - error_exit(msg, False) pass #=============================================================== @@ -899,7 +897,7 @@ def has_binaries(products): Returns True if some product is installed in 'binaries' mode. """ for product in products: - if product.install == __TAG__BINARIES__: + if product.whattodo == __BINARIES__: return True return False @@ -912,7 +910,7 @@ def has_sources(products): Returns True if some product is installed in 'sources' mode. """ for product in products: - if product.install == __TAG__SOURCES__: + if product.whattodo == __BUILDSRC__: return True return False @@ -933,31 +931,56 @@ def get_tmp_dir(dir): return "%s/%s%d"%(dir, dir_prefix, random.randint(range_bottom,range_top)) #============================================================== -# get_current_platform : gets name, version and bit of -# the current user's Linux platform +# get_os_release : gets OS release; the OS name, version and +# architecture +# For example: +# RedHat, 8.0; Mandriva, 2006.0, 64 #=============================================================== -def get_current_platform(): - """ - Gets name, version and bit of - the current user's Linux platform. - """ - plt_name = ""; plt_ver = ""; plt_bit = "" - if os.path.exists("/etc/issue"): - data = open("/etc/issue").readline() - res = re.search(r'(.*)[L|l]inux.*release\s+([\d.]*)', data) - if not res: - # Debian identification - res = re.search(r'(.*)GNU/Linux\s+([\d.]*)', data) - if res: - plt_name = "".join(res.group(1).split()) - plt_ver = res.group(2) - if re.search(r'x86_64', data): - plt_bit = "_64" - pass +def get_os_release(): + filename = "/etc/issue" + # --- + plt_name = "unknown" + plt_ver = "" + plt_arch = "" + if os.path.exists(filename): + # --- + f = open(filename) + lines = f.readlines() + f.close() + # --- + regvar = re.compile("(.*)\s+[^\s]*[R|r]elease[^\s]*\s+([\d.]*)") + regvar1 = re.compile("(.*)\s+[^\s]*[L|l][I|i][N|n][U|u][X|x][^\s]*(.*)\s+([\d.]*)\s+") + for l in lines: + res = re.search(regvar, l) + if not res: + res = re.search(regvar1, l) + if res: + plt_name = "".join("".join(res.groups()[:len(res.groups())-1]).split()) + # workaround for Mandrake and other platforms + plt_name = plt_name.replace("Linux", "").replace("linux", "").replace("LINUX", "").strip() + # workaround for SuSe + plt_name = plt_name.replace("Welcometo", "").strip() + # --- + plt_ver = res.group(len(res.groups())) + if re.search(r'x86_64', l): + plt_arch = "64" + pass + # workaround for Red Hat Enterprise + if not plt_arch: + try: + import platform + if platform.machine() == "x86_64": + plt_arch = "64" + pass + pass + except: + pass + pass + break pass pass - return plt_name, plt_ver, plt_bit + return plt_name, plt_ver, plt_arch #============================================================== # check_xml_file : checks XML file existence and readability @@ -1016,7 +1039,7 @@ def get_supported_platforms(xml_file=None): if __name__ == "__main__": # parse command line - [xml_file, target_dir, tmp_dir, is_gui] = parse_parameters() + [xml_file, target_dir, tmp_dir, is_gui, is_force_src] = parse_parameters() if xml_file: xml_file = os.path.abspath(xml_file) if target_dir: target_dir = os.path.abspath(target_dir) if tmp_dir: tmp_dir = os.path.abspath(tmp_dir) @@ -1042,59 +1065,45 @@ if __name__ == "__main__": cmd += " --target %s"%target_dir if tmp_dir is not None: cmd += " --tmp %s"%tmp_dir + if is_force_src: + cmd += " --all-from-sources" cmd += "&" sys.exit(os.system(cmd)) #----- TUI --------------------- - msg = "Sorry, batch mode is unavailable in current version of SALOME Install Wizard!\n" - msg += "Use GUI mode to install SALOME, please." - error_exit(msg) - - # get program dir - cur_dir = get_program_path() + # define xml file to be used + if not xml_file: + # get current Linux platform + plt_name = ""; plt_ver = ""; plt_arch = "" + plt_name, plt_ver, plt_arch = get_os_release() + data = [] + for i in plt_name, plt_ver, plt_arch: + if i: data.append(i) + full_plt_name = "_".join(data) + xml_file_name = "config_%s.xml" % full_plt_name + if not plt_name or not plt_ver or not os.path.exists("%s/%s"%(cur_dir, xml_file_name)): + msg = "Not supported Linux platform: %s!" % full_plt_name + error_exit(msg) + pass - # get current Linux platform - plt_name = ""; plt_ver = ""; plt_bit = "" - plt_name, plt_ver, plt_bit = get_current_platform() - full_plt_name = plt_name + plt_ver + plt_bit - print "full_plt_name = %s" % full_plt_name - - # get supported Linux platforms - supported_plts_map = get_supported_platforms(xml_file) - # check: whether the current platform is supported - if supported_plts_map.has_key(full_plt_name): - # define xml file to be used - xml_file = supported_plts_map.get(full_plt_name, "") - print "set xml_file = %s" % os.path.basename(xml_file) + xml_file= "%s/%s"%(cur_dir, xml_file_name) pass - else: - msg = "Not supported Linux platform!\n" - warning(msg) + check_xml_file(xml_file) + # parse XML file ----------- message("Parsing XML configuration file: %s"%xml_file) - filehandle = open(xml_file) - data = filehandle.read() - filehandle.close() parser = ConfigParser(is_force_src) - parser.feed(data) - parser.close() - - # actions map - what_to_do = { __TAG__SOURCES__ : "install_source", - __TAG__BINARIES__ : "install_binary", - __TAG__NATIVE__ : "try_native", - __TAG__PREINSTALL__ : "try_preinstalled", - __TAG__BUILDSRC__ : "install_source_and_build"} + parser.parse(xml_file) + # source directory map bin_dir = "" - if parser.config.os: - bin_dir += "/%s"%parser.config.os - subdir = { __TAG__SOURCES__ : "SOURCES", - __TAG__BINARIES__ : "BINARIES" + bin_dir, - __TAG__NATIVE__ : "", - __TAG__PREINSTALL__ : ""} + if parser.config.platforms: + bin_dir += "/%s"%parser.config.platforms + subdir = { __BINARIES__ : "BINARIES" + bin_dir, + __BUILDSRC__ : "SOURCES", + __PREINSTALL__ : ""} # check scripts directory ----------- scripts_dir = "%s/%s"%(cur_dir, "config_files") @@ -1109,14 +1118,14 @@ if __name__ == "__main__": check_dir(source_dir) if has_src: - check_dir("%s/%s"%(source_dir,subdir[__TAG__SOURCES__])) + check_dir("%s/%s"%(source_dir,subdir[__BUILDSRC__])) if has_bin: - check_dir("%s/%s"%(source_dir,subdir[__TAG__BINARIES__])) + check_dir("%s/%s"%(source_dir,subdir[__BINARIES__])) # check/create target dir ----------- if target_dir is None: - target_dir = parser.path.targetdir + target_dir = parser.config.targetdir target_dir = substituteVars(target_dir) message("Creating target directory: " + target_dir) @@ -1130,7 +1139,7 @@ if __name__ == "__main__": # check/create temporary dir ----------- if tmp_dir is None: - tmp_dir = parser.path.tmpdir + tmp_dir = parser.config.tmpdir if not tmp_dir: tmp_dir = "/tmp" tmp_dir = substituteVars(tmp_dir) @@ -1154,37 +1163,59 @@ if __name__ == "__main__": # get dependencies list ----------- list_of_dep = get_dependencies(parser.products) + products_string = " ".join(parser.full_prods_list) + + # don't remove sources and tmp files, by default ----------- + rm_src_tmp = "FALSE" # starting ----------- message("Starting ...") # install products ----------- for product in parser.products: + # remove only prerequisites temporary files + if product.type == __CTX__PREREQUISITE__ or \ + (product.type == __CTX__COMPONENT__ and product.whattodo == __BUILDSRC__): + rm_src_tmp = "TRUE" message("... processing %s ..."%product.name) - cmd = '%s/%s %s %s %s/%s %s "%s" %s'%(scripts_dir, - product.script, - what_to_do[product.whattodo], - tmp_dir, - source_dir, - subdir[product.install], - target_dir, - list_of_dep, - product.name) + cmd = '%s/%s %s %s %s/%s %s "%s" %s "%s" %s/%s %s %s/%s' % ( + scripts_dir, product.script, + product.whattodo, + tmp_dir, + source_dir, subdir[product.whattodo], + target_dir, + products_string, + product.name, + products_string, + source_dir, subdir[__BUILDSRC__], + rm_src_tmp, + source_dir, subdir[__BINARIES__] + ) + if product.woguiinst is not None: cmd += ' TRUE' res = os.system(cmd) + rm_src_tmp = "FALSE" + pass # pickup environment ----------- message("Creating environment files") for product in parser.products : if check_bool(product.pickupEnv): - cmd = '%s/%s pickup_env %s %s/%s %s "%s" %s'%(scripts_dir, - product.script, - tmp_dir, - source_dir, - subdir[product.install], - target_dir, - list_of_dep, - product.name) + cmd = '%s/%s pickup_env %s %s/%s %s "%s" %s "%s" %s/%s %s %s/%s' % ( + scripts_dir, product.script, + tmp_dir, + source_dir, subdir[product.whattodo], + target_dir, + products_string, + product.name, + products_string, + source_dir, subdir[__BUILDSRC__], + rm_src_tmp, + source_dir, subdir[__BINARIES__] + ) + if product.woguiinst is not None: cmd += ' TRUE' res = os.system(cmd) + pass + pass # clean temporary directory ----------- message("Cleaning temporary directory") diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 7387aff..349b8d5 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -469,7 +469,8 @@ public: // ================================================================ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, const QString& aTargetDir, - const QString& aTmpDir) + const QString& aTmpDir, + const bool aForceSrc) : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ), helpWindow( NULL ), moreMode( false ), @@ -482,6 +483,7 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, xmlFileName = aXmlFileName; myTargetPath = aTargetDir; myTmpPath = aTmpDir; + forceSrc = aForceSrc; stateChanged = true; binPath = QDir::currentDirPath() + "/Products/BINARIES"; srcPath = QDir::currentDirPath() + "/Products/SOURCES"; @@ -2103,8 +2105,10 @@ void SALOME_InstallWizard::launchScript() if ( oneModDirBtn->isChecked() ) { MapProducts::Iterator mapIter; for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) - if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) + if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) { shellProcess->addArgument( oneModDirName ); + break; + } } // ... single installation directory for prerequisites, if this option was selected if ( oneProdDirBtn->isChecked() ) { @@ -2113,8 +2117,10 @@ void SALOME_InstallWizard::launchScript() else { MapProducts::Iterator mapIter; for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) - if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) + if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) { shellProcess->addArgument( oneProdDirName ); + break; + } } } @@ -2432,7 +2438,8 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( aPage == typePage ) { // installation type page if ( buttonGrp->id( buttonGrp->selected() ) == -1 ) - binBtn->animateClick(); // set default installation type + // set default installation type + forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick(); } else if ( aPage == platformsPage ) { // installation platforms page diff --git a/src/SALOME_InstallWizard.hxx b/src/SALOME_InstallWizard.hxx index 2c77abb..6d12519 100644 --- a/src/SALOME_InstallWizard.hxx +++ b/src/SALOME_InstallWizard.hxx @@ -162,7 +162,8 @@ class SALOME_InstallWizard: public InstallWizard // constructor SALOME_InstallWizard( const QString& aXmlFileName = QString::null, const QString& aTargetDir = QString::null, - const QString& aTmpDir = QString::null ); + const QString& aTmpDir = QString::null, + const bool aForceSrc = false ); // destructor virtual ~SALOME_InstallWizard( ); @@ -386,6 +387,7 @@ class SALOME_InstallWizard: public InstallWizard QRadioButton* srcBtn; // install sources button QRadioButton* srcCompileBtn; // install sources and compile button QCheckBox* removeSrcBtn; // checkbox + bool forceSrc; // Force all products to be compiled from sources // --> installation platform page QWidget* platformsPage; // page itself QButtonGroup* platBtnGrp; // group of platforms for selection diff --git a/src/main.cxx b/src/main.cxx index 1d1b8d6..80a8ba2 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -55,6 +55,7 @@ int main( int argc, char **argv ) bool has_xml = false; bool has_target = false; bool has_tmp = false; + bool force_src = false; for( int i = 1; i < argc; i++ ) { QString a = QString( argv[i] ); if ( a == "--version" || a == "-v" ) { @@ -98,6 +99,9 @@ int main( int argc, char **argv ) xmlFileName = QString::null; } } + else if ( a == "--all-from-sources" || a == "-a" ) { + force_src = true; + } } if ( has_xml && xmlFileName.isEmpty() ) { printf("Please specify the configuration XML file!\n"); @@ -127,7 +131,7 @@ int main( int argc, char **argv ) return -1; } } - SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath); + SALOME_InstallWizard wizard(xmlFileName, targetDirPath, tmpDirPath, force_src); a.setMainWidget( &wizard ); wizard.show(); return a.exec();