From: vsr Date: Thu, 16 Oct 2008 07:18:37 +0000 (+0000) Subject: Improve SALOME installation Wizard: uniform the platform definition way for batch... X-Git-Tag: before_merging_with_4X~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cec468058651c88d9b71294977bd115b549e32c5;p=tools%2Finstall.git Improve SALOME installation Wizard: uniform the platform definition way for batch and GUI modes for all supported platforms plus fix bug of platform definition for 64bit platforms --- diff --git a/config.xml b/config.xml index 10e2828..6b3bbc8 100644 --- a/config.xml +++ b/config.xml @@ -4,7 +4,7 @@ caption="SALOME v%1" copyright="<h5>Copyright (C) 2003-2008 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D,<br>LEG, PRINCIPIA R&D, BUREAU VERITAS</h5>" license="<h5>GNU LGPL</h5>" - platforms="Debian4.0,Debian3.1,Mandrake10.1,Mandriva2006.0,Mandriva2007.0,Mandriva2008.0,Mandriva2006.0_64,RedHat8.0,RedHat9,RedHatEnterprise4,Scientific4.2,Scientific4.3" + platforms="Debian 4.0 64bit,Debian 3.1,Mandrake 10.1,Mandriva 2006.0,Mandriva 2006.0 64bit,Mandriva 2007.0,Mandriva 2008.0,Mandriva 2008.0 64bit,Red Hat 8.0,Red Hat 9,Red Hat Enterprise WS 4,Scientific SL 4.2,Scientific SL 4.3" targetdir="${HOME}/salome_4.1.2" tempdir="/tmp"/> @@ -23,83 +23,90 @@ - - - - - - - + - - - - - - - - - - - - - - + - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - - - - - - - - + - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -23,7 +23,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - :" % (0, len(platforms)), + try: + idx = raw_input() + except: + sys.exit(1) + try: + idx = int(idx) + except: + warning("Invalid input!") + pass + if idx == 0: sys.exit(0) + if idx > 0 and idx <= len(platforms): + pltname = platforms[idx-1] + else: + warning("Invalid input!") + pass + return pltname, all_platforms[pltname] + #------------------------------------------------------------------# # # # EXECUTION STARTS HERE # @@ -1047,7 +1101,7 @@ def get_supported_platforms(xml_file=None): if __name__ == "__main__": # parse command line - [xml_file, target_dir, tmp_dir, is_gui, is_force_src, is_single_dir] = parse_parameters() + [xml_file, target_dir, tmp_dir, is_gui, is_force_src, is_single_dir, pltname] = 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) @@ -1069,6 +1123,8 @@ if __name__ == "__main__": cmd = "./bin/SALOME_InstallWizard" if xml_file is not None: cmd += " --file %s"%xml_file + if pltname is not None: + cmd += " --platform %s"%pltname if target_dir is not None: cmd += " --target %s"%target_dir if tmp_dir is not None: @@ -1081,36 +1137,65 @@ if __name__ == "__main__": sys.exit(os.system(cmd)) #----- TUI --------------------- - + # # 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) + # + # get current Linux platform + 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) + # get all supported platforms + all_platforms = get_supported_platforms(xml_file) + if all_platforms: + if pltname: + # platform name is specified in the command line + if pltname in all_platforms: + # if specified platform is supported, choose the corresponding XML file for use + xml_file = all_platforms[pltname] + else: + # if specified platform is NOT supported, print warning message + # and prompt user to choose another platform + msg = "Specified platform is not supported: %s" % (pltname) + warning(msg) + pltname, xml_file = select_platform(all_platforms) + pass + pass + elif full_plt_name in all_platforms: + # if current platform is supported, choose the corresponding XML file for use + pltname = full_plt_name + xml_file = all_platforms[pltname] + else: + if xml_file and len(all_platforms) == 1: + # XML file is specified and contains only one platform definition + xml_file = all_platforms.values()[0] + pltname = all_platforms.keys()[0] + else: + # current Linux platform is not supported, print warning message + # and prompt user to choose platform from the list + warning("Not supported Linux platform: %s."%" ".join(data)) + pltname, xml_file = select_platform(all_platforms) pass - - xml_file= "%s/%s"%(cur_dir, xml_file_name) + pass + else: + # current Linux platform is not supported, exit + if pltname: + msg = "Not supported Linux platform: %s."%pltname + else: + msg = "Not supported Linux platform: %s."%" ".join(data) + error_exit(msg, False) pass - check_xml_file(xml_file) - # parse XML file ----------- message("Parsing XML configuration file: %s"%xml_file) - parser = ConfigParser(is_force_src) + parser = ConfigParser(is_force_src, pltname) parser.parse(xml_file) # source directory map bin_dir = "" if parser.config.platforms: - bin_dir += "/%s"%parser.config.platforms + bin_dir += "/%s"%"_".join( parser.pltname.split() ) subdir = { __BINARIES__ : "BINARIES" + bin_dir, __BUILDSRC__ : "SOURCES", __PREINSTALL__ : ""}