From 42a53a27473fd83936d0853407b59072e960e964 Mon Sep 17 00:00:00 2001 From: crouzet Date: Thu, 13 Oct 2022 09:54:43 +0200 Subject: [PATCH] sat #32534 : warning if the application is used on a not supported platform, and save git repositories in archives Save git repositories for vcs products, even if archive is not in VCS mode The user of the archive will be able to switch to VCS mode by changing the get_source flag --- commands/compile.py | 3 +++ commands/package.py | 4 +++- commands/prepare.py | 3 +++ src/__init__.py | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/commands/compile.py b/commands/compile.py index 043706b..af2d274 100644 --- a/commands/compile.py +++ b/commands/compile.py @@ -720,6 +720,9 @@ def run(args, runner, logger): # check that the command has been called with an application src.check_config_has_application( runner.cfg ) + # write warning if platform is not declared as supported + src.check_platform_is_supported( runner.cfg, logger ) + # Print some informations logger.write(_('Executing the compile commands in the build ' 'directories of the products of ' diff --git a/commands/package.py b/commands/package.py index b619ec1..fd5bba7 100644 --- a/commands/package.py +++ b/commands/package.py @@ -1318,7 +1318,9 @@ def find_product_scripts_and_pyconf(p_name, product_pyconf_cfg[section].archive_info.archive_name =\ p_info.name + ".tgz" - if (with_vcs) and src.product.product_is_vcs(p_info): + # save git repositories for vcs products, even if archive is not in VCS mode + # in this case the user will be able to change get_source flag and work with git + if src.product.product_is_vcs(p_info): # in vcs mode we must replace explicitely the git server url # (or it will not be found later because project files are not exported in archives) for section in product_pyconf_cfg: diff --git a/commands/prepare.py b/commands/prepare.py index 66f77e0..71a44a8 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -88,6 +88,9 @@ def run(args, runner, logger): # check that the command has been called with an application src.check_config_has_application( runner.cfg ) + # write warning if platform is not declared as supported + src.check_platform_is_supported( runner.cfg, logger ) + products_infos = src.product.get_products_list(options, runner.cfg, logger) # Construct the arguments to pass to the clean, source and patch commands diff --git a/src/__init__.py b/src/__init__.py index 9a4a846..2a1f8f0 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -82,6 +82,17 @@ def check_config_has_application( config, details = None ): details.append(message) raise SatException( message ) +def check_platform_is_supported( config, logger ): + """check that the platform is supported, write warning if not. + + :param config class 'common.pyconf.Config': The config. + """ + if 'platform' in config.APPLICATION and config.VARS.dist not in config.APPLICATION.platform: + msg = "WARNING: Your application configuration is not supported on this platform (%s)\n"\ + " Please consider using the native application!" % config.VARS.dist + logger.write("\n%s\n\n" % printcolors.printcWarning(msg), 1) + return + def check_config_has_profile( config, details = None ): """\ check that the config has the key APPLICATION.profile. -- 2.39.2