# Define all possible option for the check command : sat check <options>
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
- _('Optional: products to configure. This option can be'
- ' passed several time to configure several products.'))
+ _('Optional: products to check. This option can be'
+ ' passed several time to check several products.'))
CHECK_PROPERTY = "has_unit_tests"
'valid_result': nb_products - res,
'nb_products': nb_products }, 1)
- return res
\ No newline at end of file
+ return res
import os
import src
+import src.debug as DBG
# Compatibility python 2/3 for input function
# input stays input for python 3 and input = raw_input for python 2
# Define all possible option for the compile command : sat compile <options>
parser = src.options.Options()
parser.add_option('p', 'products', 'list2', 'products',
- _('Optional: products to configure. This option can be'
- ' passed several time to configure several products.'))
+ _('Optional: products to compile. This option can be'
+ ' passed several time to compile several products.'))
parser.add_option('', 'with_fathers', 'boolean', 'fathers',
_("Optional: build all necessary products to the given product (KERNEL is "
"build before building GUI)."), False)
# Clean the build and the install directories
# if the corresponding options was called
if options.clean_all:
- log_step(logger, header, "CLEAN BUILD AND INSTALL")
+ log_step(logger, header, "CLEAN BUILD AND INSTALL ")
sat.clean(config.VARS.application +
" --products " + p_name +
" --build --install",
# Clean the the install directory
# if the corresponding option was called
if options.clean_install and not options.clean_all:
- log_step(logger, header, "CLEAN INSTALL")
+ log_step(logger, header, "CLEAN INSTALL ")
sat.clean(config.VARS.application +
" --products " + p_name +
" --install",
# (it could change if there is a clean of the install directory)
p_info = src.product.get_product_config(config, p_name)
+ # Check if sources was already successfully installed
+ check_source = src.product.check_source(p_info)
+ if not check_source:
+ logger.write(_("Sources of product not found (try 'sat -h prepare')\n"))
+ res += 1 #BUG
+ continue
+
# Check if it was already successfully installed
if src.product.check_installation(p_info):
logger.write(_("Already installed\n"))
continue
# Call the function to compile the product
- res_prod, len_end_line, error_step = compile_product(sat,
- p_name_info,
- config,
- options,
- logger,
- header,
- len_end_line)
+ res_prod, len_end_line, error_step = compile_product(
+ sat, p_name_info, config, options, logger, header, len_end_line)
if res_prod != 0:
res += 1
def run(args, runner, logger):
'''method that is called when salomeTools is called with compile parameter.
'''
-
+ # DBG.write("compile runner.cfg", runner.cfg, True)
# Parse the options
(options, args) = parser.parse_args(args)
import sys
import src
+import src.debug as DBG
# internationalization
satdir = os.path.dirname(os.path.realpath(__file__))
cfg.PATHS["ARCHIVEPATH"].append(cfg.LOCAL.archive_dir, "")
# Loop over the projects in order to complete the PATHS variables
+ # as /data/tmpsalome/salome/prerequis/archives for example ARCHIVEPATH
for project in cfg.PROJECTS.projects:
for PATH in ["APPLICATIONPATH",
"PRODUCTPATH",
- "ARCHIVEPATH",
+ "ARCHIVEPATH", #comment this for default archive #8646
"JOBPATH",
"MACHINEPATH"]:
if PATH not in cfg.PROJECTS.projects[project]:
# clean the source directory of all the vcs products, then use the source
# command and thus construct an archive that will not contain the patches
l_prod_names = [pn for pn, __ in l_pinfo_vcs]
- if False:
- # clean
+ if False: # clean is dangerous in user/SOURCES, fixed in tmp_working_dir
logger.write(_("\nclean sources\n"))
args_clean = config.VARS.application
args_clean += " --sources --products "
svgDir = sat.cfg.APPLICATION.workdir
sat.cfg.APPLICATION.workdir = tmp_working_dir
# DBG.write("SSS sat config.APPLICATION.workdir", sat.cfg.APPLICATION, True)
- DBG.write("sat config id", id(sat.cfg), True)
+ # DBG.write("sat config id", id(sat.cfg), True)
# shit as config is not same id() as for sat.source()
# sat.source(args_source, batch=True, verbose=5, logger_add_link = logger)
import source
'''
# check archive exists
if not os.path.exists(product_info.archive_info.archive_name):
- raise src.SatException(_("Archive not found: '%s'") %
+ raise src.SatException(_("Archive not found in config.PATHS.ARCHIVEPATH: '%s'") %
product_info.archive_info.archive_name)
logger.write('arc:%s ... ' %
# The loop on all the products from which to get the sources
# DBG.write("source.get_all_product_sources config id", id(config), True)
for product_name, product_info in products:
- print "get_all_product_sources", product_name #, product_info
# get product name, product informations and the directory where to put
# the sources
if (not (src.product.product_is_fixed(product_info) or
def run(args, runner, logger):
'''method that is called when salomeTools is called with source parameter.
'''
- DBG.write("source.run()", args, True)
+ DBG.write("source.run()", args)
# Parse the options
(options, args) = parser.parse_args(args)
import re
import src
+import src.debug as DBG
AVAILABLE_VCS = ['git', 'svn', 'cvs']
config_expression = "^config-\d+$"
arch_path = src.find_file_in_lpath(arch_name,
config.PATHS.ARCHIVEPATH)
if not arch_path:
- msg = _("Archive %(1)s for %(2)s not found.\n") % \
+ msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \
{"1" : arch_name, "2" : prod_info.name}
- raise src.SatException(msg)
- prod_info.archive_info.archive_name = arch_path
+ DBG.tofix(msg, config.PATHS.ARCHIVEPATH)
+ prod_info.archive_info.archive_name = arch_name #without path
+ # raise src.SatException(msg) #may be a warning, continue #8646
+ else:
+ prod_info.archive_info.archive_name = arch_path
else:
if (os.path.basename(prod_info.archive_info.archive_name) ==
prod_info.archive_info.archive_name):
arch_name,
config.PATHS.ARCHIVEPATH)
if not arch_path:
- msg = _("Archive %(1)s for %(2)s not found:\n") % \
+ msg = _("Archive %(1)s for %(2)s not found in config.PATHS.ARCHIVEPATH") % \
{"1" : arch_name, "2" : prod_info.name}
- raise src.SatException(msg)
+ DBG.tofix(msg, config.PATHS.ARCHIVEPATH) #avoid 2 messages in compile
+ prod_info.archive_info.archive_name = arch_name #without path
+ # raise src.SatException(msg) #may be a warning, continue #8646
prod_info.archive_info.archive_name = arch_path
# If the product compiles with a script, check the script existence
#raise src.SatException(
# _("Compilation script cannot be executed: %s") %
# prod_info.compil_script)
- print("WARNING: Compilation script cannot be executed:\n %s" % prod_info.compil_script)
+ DBG.tofix("Compilation script cannot be executed:", prod_info.compil_script)
# Get the full paths of all the patches
if product_has_patches(prod_info):
return False
return True
+def check_source(product_info):
+ '''Verify if a sources of product is preset. Checks source directory presence
+
+ :param product_info Config: The configuration specific to
+ the product
+ :return: True if it is well installed
+ :rtype: boolean
+ '''
+ DBG.write("check_source product_info", product_info)
+ source_dir = product_info.source_dir
+ if not os.path.exists(source_dir):
+ return False
+ if ("present_files" in product_info and
+ "source" in product_info.present_files):
+ for file_relative_path in product_info.present_files.source:
+ file_path = os.path.join(source_dir, file_relative_path)
+ if not os.path.exists(file_path):
+ return False
+ return True
+
def product_is_sample(product_info):
'''Know if a product has the sample type