From: crouzet Date: Thu, 5 Apr 2018 12:58:13 +0000 (+0200) Subject: Implementation de sat #11056 : Gestion des launcher mesa: X-Git-Tag: 5.1.0~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fnct%2Fmesa;p=tools%2Fsat.git Implementation de sat #11056 : Gestion des launcher mesa: - ajout de l'option --use_mesa à sat application et sat launcher - génération si mesa est embarqué qu'un launcher mesa_salome - environment : on saute les produits mesa par défaut - sauf quand c'est activé --- diff --git a/commands/application.py b/commands/application.py index 4a0d9b9..46cf96c 100644 --- a/commands/application.py +++ b/commands/application.py @@ -42,6 +42,9 @@ parser.add_option('', 'gencat', 'string', 'gencat', parser.add_option('m', 'module', 'list2', 'modules', _("Optional: the restricted list of module(s) to include in the " "application")) +parser.add_option('', 'use_mesa', 'boolean', 'use_mesa', + _("Optional: Create a launcher that will use mesa products\n\t" + "It can be usefull whan salome is used on a remote machine through ssh")) ## # Creates an alias for runAppli. @@ -416,6 +419,10 @@ def run(args, runner, logger): if options.modules: runner.cfg.APPLICATION.virtual_app['modules'] = options.modules + # activate mesa use in the generated application + if options.use_mesa: + src.activate_mesa_property(runner.cfg) + # set name and application_name if options.name: runner.cfg.APPLICATION.virtual_app['name'] = options.name diff --git a/commands/launcher.py b/commands/launcher.py index 213845a..f0e0ece 100644 --- a/commands/launcher.py +++ b/commands/launcher.py @@ -24,6 +24,7 @@ import subprocess import stat import src +import src.debug as DBG parser = src.options.Options() @@ -36,6 +37,9 @@ parser.add_option('', 'gencat', 'string', 'gencat', _("Optional: Create a resources catalog for the specified machines " "(separated with ',') \n\tNOTICE: this command will ssh to retrieve" " information to each machine in the list")) +parser.add_option('', 'use_mesa', 'boolean', 'use_mesa', + _("Optional: Create a launcher that will use mesa products\n\t" + "It can be usefull whan salome is used on a remote machine through ssh")) def generate_launch_file(config, logger, @@ -256,6 +260,10 @@ def run(args, runner, logger): logger) additional_environ = copy_catalog(runner.cfg, catalog_path) + # activate mesa use in the generated launcher + if options.use_mesa: + src.activate_mesa_property(runner.cfg) + # Generate the launcher launcherPath = generate_launch_file( runner.cfg, logger, diff --git a/commands/package.py b/commands/package.py index 5a2c493..9e1d423 100644 --- a/commands/package.py +++ b/commands/package.py @@ -465,6 +465,7 @@ def binary_package(config, logger, options, tmp_working_dir): l_source_dir = [] l_not_installed = [] l_sources_not_present = [] + generate_mesa_launcher = False # a flag to know if we generate a mesa launcher for prod_name, prod_info in l_product_info: # Add the sources of the products that have the property @@ -476,6 +477,10 @@ def binary_package(config, logger, options, tmp_working_dir): else: l_sources_not_present.append(prod_name) + # if at least one of the application products has the "is_mesa" property + if src.get_property_in_product_cfg(prod_info, "is_mesa") == "yes": + generate_mesa_launcher = True # we will generate a mesa launcher + # ignore the native and fixed products for install directories if (src.product.product_is_native(prod_info) or src.product.product_is_fixed(prod_info) @@ -574,8 +579,36 @@ WARNING: existing binaries directory from previous detar installation: launcher_name, binaries_dir_name, not(options.without_commercial)) - d_products["launcher"] = (launcher_package, launcher_name) + + # if the application contains mesa products, we generate in addition to the + # classical salome launcher a launcher using mesa and called mesa_salome + # (the mesa launcher will be used for remote usage through ssh). + if generate_mesa_launcher: + #if there is one : store the use_mesa property + restore_use_mesa_option=None + if ('properties' in config.APPLICATION and + 'use_mesa' in config.APPLICATION.properties): + restore_use_mesa_option = config.APPLICATION.properties.use_mesa + + # activate mesa property, and generate a mesa launcher + src.activate_mesa_property(config) #activate use_mesa property + launcher_mesa_name="mesa_"+launcher_name + launcher_package_mesa = produce_relative_launcher(config, + logger, + tmp_working_dir, + launcher_mesa_name, + binaries_dir_name, + not(options.without_commercial)) + d_products["launcher (mesa)"] = (launcher_package_mesa, launcher_mesa_name) + + # if there was a use_mesa value, we restore it + # else we set it to the default value "no" + if restore_use_mesa_option != None: + config.APPLICATION.properties.use_mesa=restore_use_mesa_option + else: + config.APPLICATION.properties.use_mesa="no" + if options.sources: # if we mix binaries and sources, we add a copy of the launcher, # prefixed with "bin",in order to avoid clashes diff --git a/src/__init__.py b/src/__init__.py index 13e8a18..7f3d789 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -420,3 +420,14 @@ def get_property_in_product_cfg(product_cfg, pprty): if not pprty in product_cfg.properties: return None return product_cfg.properties[pprty] + +def activate_mesa_property(config): + """Add mesa property into application properties + + :param config Config: The global configuration. It must have an application! + """ + # Verify the existence of the file + if not 'properties' in config.APPLICATION: + config.APPLICATION.addMapping( 'properties', src.pyconf.Mapping(), None ) + config.APPLICATION.properties.use_mesa="yes" + diff --git a/src/environment.py b/src/environment.py index 650efe5..56ba0b8 100644 --- a/src/environment.py +++ b/src/environment.py @@ -521,6 +521,19 @@ class SalomeEnviron: # Get the informations corresponding to the product pi = src.product.get_product_config(self.cfg, product) + + # skip mesa product, unless use_mesa property was activated + + if not ("APPLICATION" in self.cfg and + "properties" in self.cfg.APPLICATION and + "use_mesa" in self.cfg.APPLICATION.properties and + self.cfg.APPLICATION.properties.use_mesa == "yes") : + if ("properties" in pi and + "is_mesa" in pi.properties and + pi.properties.is_mesa == "yes") : + logger.write(_("Skip mesa product %s\n") % pi.name, 4) + return + if self.for_package: pi.install_dir = os.path.join("out_dir_Path", diff --git a/src/internal_config/README_BIN.template b/src/internal_config/README_BIN.template index 5307eb2..2f0154d 100644 --- a/src/internal_config/README_BIN.template +++ b/src/internal_config/README_BIN.template @@ -5,9 +5,8 @@ Binaries This package includes a binary installation of the application ¤{application}. The binaries are stored in BINARIES directory. -Warning : This binary installation depends upon some native packages. +Warning : This binary installation depends upon some native linux packages. If some of these packages are missing on your system, the execution may fail. -If this is the case, please check if the file *_dep_sys_rpms.txt is present (it contains the known dependencies), -and install the missing ones. +If this is the case, please install the missing ones with your linux package manager. diff --git a/src/internal_config/README_LAUNCHER.template b/src/internal_config/README_LAUNCHER.template index 966b615..984c4cd 100644 --- a/src/internal_config/README_LAUNCHER.template +++ b/src/internal_config/README_LAUNCHER.template @@ -2,3 +2,11 @@ To run the application, launch the following command: > $ROOT/¤{launcher} +Note for the use of Salome on a remote computer through ssh: + When salome is used on a remote machine, the use of openGL 3 is not compatible with X11 forwarding (ssh -X). + This cause segmentation faults when the 3D viewers are used. + For people who have no other choice and need to use ssh, we provide a mesa laucher called $ROOT/mesa_¤{launcher}. + It will avoid the segmentation faults, at the price of poor performance : it should only be used in this case! + If performance is required, a solution based on the use of VirtualGL and TurboVNC/x2go would be recommended. + But this requires some configuration of the tools to be done as root. +