# particular win case
if src.architecture.is_windows() :
var['tmp_root'] = os.path.expanduser('~') + os.sep + 'tmp'
- repositories_cfg = src.pyconf.Config( osJoin(var['srcDir'], 'internal_config', 'git_repo_servers.pyconf'))
- var['repositories_servers'] = []
- var['opensource_repositories_servers'] =[]
- for repo_server in repositories_cfg.REPOSITORIES_SERVERS:
- var['repositories_servers']+=[repo_server]
- if repositories_cfg.REPOSITORIES_SERVERS[repo_server] == 'opensource':
- var['opensource_repositories_servers']+=[repo_server]
+
return var
def get_command_line_overrides(self, options, sections):
for rule in self.get_command_line_overrides(options, ["PATHS"]):
exec('cfg.' + rule) # this cannot be factorized because of the exec
+ # add git servers if any
+ cfg.addMapping("git_info", src.pyconf.Mapping(cfg), "The repositories\n")
+ cfg.VARS['git_servers'] = []
+ cfg.VARS['opensource_git_servers'] =[]
+
+ for project in cfg.PROJECTS.projects:
+ if 'git_info' not in cfg.PROJECTS.projects[project]:
+ logger.warning("Project: {} does not have any git_info section! Please define one!")
+ continue
+ if 'git_server' in cfg.PROJECTS.projects[project]['git_info']:
+ git_servers=cfg.PROJECTS.projects[project]['git_info']['git_server']
+ for git_server in git_servers:
+ cfg.VARS['git_servers']+=[git_server]
+ if git_servers[git_server]['opensource_only'] == 'yes' :
+ cfg.VARS['opensource_git_servers']+=[git_server]
+ if 'default_git_server_dev' in cfg.PROJECTS.projects[project]['git_info'].keys():
+ cfg.VARS['git_servers']+=['tuleap']
+ cfg.VARS['default_git_server_dev'] = cfg.PROJECTS.projects[project]['git_info']['default_git_server_dev']
+ if 'default_git_server' in cfg.PROJECTS.projects[project]['git_info'].keys():
+ cfg.VARS['git_servers']+=['gitpub']
+ cfg.VARS['opensource_git_servers']+=['gitpub']
+ cfg.VARS['default_git_server'] = cfg.PROJECTS.projects[project]['git_info']['default_git_server']
+
# AT END append APPLI_TEST directory in APPLICATIONPATH, for unittest
appli_test_dir = osJoin(satdir, "test", "APPLI_TEST")
if appli_test_dir not in cfg.PATHS.APPLICATIONPATH:
cfg.PATHS.APPLICATIONPATH.append(appli_test_dir, "unittest APPLI_TEST path")
-
# =====================================================================
# Load APPLICATION config file
if application is not None:
has_git_server_non_opensource = src.check_git_server_has_non_opensource( config, git_server)
if has_git_server_non_opensource and is_not_prod_opensource:
logger.warning("%s is a closed-source software and is not available on %s" % (product, git_server))
+ logger.flush()
continue
if p_info.get_source == "archive":
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
+ # check if application configuration file was migrated to newer repository approach
+ src.check_application_syntax_deprecated(runner.cfg, logger)
+
# write warning if platform is not declared as supported
src.check_platform_is_supported( runner.cfg, logger )
if src.check_git_server_has_non_opensource( runner.cfg, git_server):
not_opensource_products = [p for p in products_infos if src.product.product_is_not_opensource(p[1])]
listProd = [p for p in listProd if p not in [name for name, tmp in not_opensource_products]]
-
+ logger.flush()
+ if len(not_opensource_products) > 0:
+ lp = ','.join([ name for name, tmp in not_opensource_products])
+ msg = "WARNING: Following products are not available, since these are closed-source products: %s !" % lp
+ logger.write("\n%s\n\n" % src.printcolors.printcWarning(msg), 1)
if options.complete:
# remove products that are already prepared 'completion mode)
pi_already_prepared=find_products_already_prepared(products_infos)
git_server = src.get_git_server(config,logger)
product_file = product_info.from_file.split('/').pop()
if 'git_info' in product_info and 'repositories' in product_info.git_info:
- if git_server in product_info.git_info.repositories.keys():
+ if git_server in product_info.git_info.repositories.keys(): # keys are git servers
repo_git = product_info.git_info.repositories[git_server]
elif 'properties' in product_info and 'is_opensource' in product_info.properties and product_info.properties.is_opensource == 'yes' :
for git_server in product_info.git_info.repositories.keys():
- if git_server in config.VARS.opensource_repositories_servers:
+ if git_server in config.VARS.opensource_git_servers:
repo_git = product_info.git_info.repositories[git_server]
break
elif 'properties' in product_info and not 'is_opensource' in product_info.properties:
for git_server in product_info.git_info.repositories.keys():
- if git_server in config.VARS.opensource_repositories_servers:
+ if git_server in config.VARS.opensource_git_servers:
repo_git = product_info.git_info.repositories[git_server]
logger.warning("Using opensource repository ({}) for product {}".format(git_server, product_info.name))
+ logger.flush()
break
else:
logger.error("Error in configuration file: define git repository for product: {} in file {}".format(product_info.name, product_file))
sat prepare <application> --complete
+* Use GitHub repositories.
+ To prepare SALOME sources which are available on GitHub, run::
+
+ sat -o 'APPLICATION.properties.git_server="github"' prepare <application>
+
Some useful configuration paths
=================================
* **name** : the name of the application (mandatory)
* **workdir** : the directory in which the application is produced (mandatory)
* **tag** : the default tag to use for the git bases
- * **dev** : activate the dev mode. In dev mode git bases are checked out only one time, to avoid risks of removing developments.
+.
* **verbose** : activate verbosity in the compilation
* **debug** : activate debug mode in the compilation, i.e -g option
* **python3** : 'yes/no' tell sat that the application uses python3
In the following example, we suppose that the application SALOME-9.4.0 has set both flags debug and verbose to "no", and that we want to recompile MEDCOUPLING in debug mode, with cmake verbosity activated. The command to use is:
.. code-block:: bash
-
# recompile MEDCOUPLING in debug mode (-g) and with verbosity
./sat -t -o "APPLICATION.verbose='yes'" -o "APPLICATION.debug='yes'" compile\
SALOME-9.4.0 -p MEDCOUPLING --clean_all
NA_STATUS = "NA"
KNOWNFAILURE_STATUS = "KF"
TIMEOUT_STATUS = "TIMEOUT"
-
class SatException(Exception):
"""sat exception class"""
def message(self, arg):
details.append(message)
raise SatException( message )
+def check_application_syntax_deprecated(config, logger):
+ """\
+ check that the application has the key git_server.
+ else, raise a warning
+
+ :param config class 'common.pyconf.Config': The config.
+ :param logger Logger: The logging instance to use for the prints.
+ """
+ if 'APPLICATION' in config and 'properties' in config.APPLICATION and not 'git_server' in config.APPLICATION.properties :
+ msg = 'WARNING: Your application is using repo_dev key which is deprecated and will be removed from future SAT releases!\n'
+ msg+= ' Please upgrade your application configuration file and add a valid git_server key.\n'
+ msg+= ' git_server key values need to be defined in the project file (e.g. salome.pyconf)!'
+ logger.write("\n%s\n\n" % printcolors.printcWarning(msg), 1)
+
def appli_test_property(config,property_name, property_value):
"""Generic function to test if an application has a property set to a value
:param config class 'common.pyconf.Config': The config.
result = eval(eval_expression)
return result
-
def config_has_application( config ):
return 'APPLICATION' in config
config.APPLICATION.properties.use_mesa="yes"
def check_git_server_has_non_opensource( config, the_git_server):
- """check that the git repositories server contains non public repositories
+ """check that the git server contains non public repositories
:param config class 'common.pyconf.Config': The config.
:param logger Logger: The logging instance to use for the prints.
"""
- if 'opensource_repositories_servers' in config.VARS:
- for git_server in config.VARS.opensource_repositories_servers:
+ if 'opensource_git_servers' in config.VARS:
+ for git_server in config.VARS['opensource_git_servers']:
if git_server == the_git_server:
return True
return False
return
def get_git_server(config, logger):
- git_server= None
+ the_git_server= None
has_properties = 'properties' in config.APPLICATION
if has_properties and "git_server" in config.APPLICATION.properties:
- git_server = config.APPLICATION.properties.git_server
+ the_git_server = config.APPLICATION.properties.git_server
elif has_properties and "repo_dev" in config.APPLICATION.properties:
# Fall back to deprecated approach but issue a warning that this approach is deprecated
- logger.warning("repo_dev is deprecated and will be removed from future SAT releases!")
- logger.warning("Please upgrade your application configuration file and the product description file!")
if config.APPLICATION.properties.repo_dev == 'yes':
- git_server = [ repositories_server for repositories_server in config.VARS.repositories_servers if repositories_server not in config.VARS.opensource_repositories_servers][0]
+ the_git_server = [ git_server for git_server in config.VARS.git_servers if git_server not in config.VARS.opensource_git_servers][0]
else:
- git_server = [ repositories_server for repositories_server in config.VARS.repositories_servers if repositories_server in config.VARS.opensource_repositories_servers][0]
- return git_server
+ the_git_server = [ git_server for git_server in config.VARS.git_servers if git_server in config.VARS.opensource_git_servers][0]
+ return the_git_server
# skip product if git server misses non opensource products
is_not_prod_opensource = src.product.product_is_not_opensource(pi)
- git_server= get_git_server(self.cfg, logger)
+ git_server= src.get_git_server(self.cfg, logger)
has_git_server_non_opensource = src.check_git_server_has_non_opensource( self.cfg, git_server)
if has_git_server_non_opensource and is_not_prod_opensource:
logger.warning("%s is a closed-source software and is not available on %s" % (pi.name, git_server))
+++ /dev/null
-#!/usr/bin/env python
-#-*- coding:utf-8 -*-
-
-REPOSITORIES_SERVERS :
-{
- "tuleap" : "all"
- "github" : "opensource"
- "gitpub" : "opensource"
-}
-
continue
if 'get_source' in prod_info and prod_info.get_source == 'git':
is_prod_opensource = not src.product.product_is_not_opensource(prod_info)
- git_server= None
- if not 'git_server' in cfg.APPLICATION.properties:
- if 'repo_dev' in cfg.APPLICATION.properties:
- # Fall back to deprecated approach but issue a warning that this approach is deprecated
- warning_msg ="repo_dev is deprecated and will be removed from future SAT releases!\n"
- warning_msg+="Please upgrade your application configuration file and the product description file!"
- if cfg.APPLICATION.properties.repo_dev == 'yes':
- git_server = [ repositories_server for repositories_server in cfg.VARS.repositories_servers if repositories_server not in cfg.VARS.opensource_repositories_servers][0]
- else:
- git_server = [ repositories_server for repositories_server in cfg.VARS.repositories_servers if repositories_server in cfg.VARS.opensource_repositories_servers][0]
- else:
- git_server = cfg.APPLICATION.properties.git_server
-
- has_git_server_non_opensource = src.check_git_server_has_non_opensource( cfg, git_server)
- if has_git_server_non_opensource and not is_prod_opensource:
- logger.warning("%s is a closed-source software and is not available on %s" % (product, git_server))
- continue
+ git_server = src.get_git_server(cfg,logger)
+ else:
+ git_server = cfg.VARS['default_git_server_dev']
+
+ has_git_server_non_opensource = src.check_git_server_has_non_opensource( cfg, git_server)
+ if has_git_server_non_opensource and not is_prod_opensource:
+ logger.warning("%s is a closed-source software and is not available on %s" % (product, git_server))
+ logger.flush()
+ continue
products+=[product]
products = src.getProductNames(cfg, products, logger)
else:
:param product_info Config: The configuration specific to
the product
- :return: True if the product is an closed-source, False otherwise
+ :return: True if the product is a closed-source, False otherwise
:rtype: boolean
"""
return ("properties" in product_info and