_('Optional: products to compile. This option accepts a comma separated list.'))
parser.add_option('f', 'force', 'boolean', 'force',
'Optional: force the compilation of product, even if it is already installed. The BUILD directory is cleaned before compilation.')
+parser.add_option('u', 'update', 'boolean', 'update',
+ 'Optional: update mode, compile only products which sources has changed, including the dependencies.')
parser.add_option('', 'with_fathers', 'boolean', 'fathers',
_("Optional: build all necessary products to the given product (KERNEL is "
"build before building GUI)."), False)
logger.write("%s \n" % src.printcolors.printcError("KO"), 4)
logger.flush()
-def compile_all_products(sat, config, options, products_infos, all_products_dict, logger):
+def compile_all_products(sat, config, options, products_infos, all_products_dict, all_products_graph, logger):
'''Execute the proper configuration commands
in each product build directory.
:param products_info list: List of
(str, Config) => (product_name, product_info)
:param all_products_dict: Dict of all products
+ :param all_products_graph: graph of all products
:param logger Logger: The logger instance to use for the display and logging
:return: the number of failing commands.
:rtype: int
'''
# first loop for the cleaning
check_salome_configuration=False
+ updated_products=[]
for p_name_info in products_infos:
p_name, p_info = p_name_info
+ if src.product.product_is_salome(p_info):
+ check_salome_configuration=True
# nothing to clean for native or fixed products
if (not src.product.product_compiles(p_info)) or\
verbose=0,
logger_add_link = logger)
+ else:
+ # Clean the the install directory
+ # if the corresponding option was called
+ if options.clean_install:
+ sat.clean(config.VARS.application +
+ " --products " + p_name +
+ " --install",
+ batch=True,
+ verbose=0,
+ logger_add_link = logger)
+
+ # Clean the the install directory
+ # if the corresponding option was called
+ if options.force:
+ sat.clean(config.VARS.application +
+ " --products " + p_name +
+ " --build",
+ batch=True,
+ verbose=0,
+ logger_add_link = logger)
- # Clean the the install directory
- # if the corresponding option was called
- if options.clean_install and not options.clean_all:
- sat.clean(config.VARS.application +
- " --products " + p_name +
- " --install",
- batch=True,
- verbose=0,
- logger_add_link = logger)
-
- # Clean the the install directory
- # if the corresponding option was called
- if options.force and not options.clean_all:
- sat.clean(config.VARS.application +
- " --products " + p_name +
- " --build",
- batch=True,
- verbose=0,
- logger_add_link = logger)
- if src.product.product_is_salome(p_info):
- check_salome_configuration=True
+ if options.update:
+ try:
+ do_update=False
+ if len(updated_products)>0:
+ # if other products where updated, check that the current product is a child
+ # in this case it will be also updated
+ if find_path_graph(all_products_graph, p_name, updated_products):
+ logger.write("\nUpdate product %s (child)" % p_name, 5)
+ do_update=True
+ if not do_update:
+ source_time=os.path.getatime(p_info.source_dir)
+ install_time=os.path.getatime(p_info.install_dir)
+ if install_time<source_time:
+ logger.write("\nupdate product %s" % p_name, 5)
+ do_update=True
+ if do_update:
+ updated_products.append(p_name)
+ sat.clean(config.VARS.application +
+ " --products " + p_name +
+ " --build --install",
+ batch=True,
+ verbose=0,
+ logger_add_link = logger)
+ except:
+ pass
if check_salome_configuration:
# For salome applications, we check if the sources of configuration modules are present
if rep.upper() != _("YES").upper():
return 0
+ if options.update and (options.clean_all or options.force or options.clean_install):
+ options.update=False # update is useless in this case
+
# check that the command has been called with an application
src.check_config_has_application( runner.cfg )
# Call the function that will loop over all the products and execute
# the right command(s)
- res = compile_all_products(runner, runner.cfg, options, products_infos, all_products_dict, logger)
+ res = compile_all_products(runner, runner.cfg, options, products_infos, all_products_dict, all_products_graph, logger)
# Print the final state
nb_products = len(products_infos)
DBG.write("git_extract", [from_what, tag, str(where)])
if not where.exists():
where.make()
+ where_git = os.path.join(str(where), ".git")
if tag == "master" or tag == "HEAD":
if src.architecture.is_windows():
cmd = "git clone %(remote)s %(where)s"
cmd = r"""
set -x
git clone %(remote)s %(where)s
+touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s
"""
- cmd = cmd % {'remote': from_what, 'tag': tag, 'where': str(where)}
+#git --git-dir=%(where_git)s log -1 --format=date_format > %(where)s/last_commit_date.txt
+ cmd = cmd % {'remote': from_what, 'tag': tag, 'where': str(where), 'where_git': where_git}
else:
# NOTICE: this command only works with recent version of git
# because --work-tree does not work with an absolute path
- where_git = os.path.join(str(where), ".git")
if src.architecture.is_windows():
cmd = "rmdir %(where)s && git clone %(remote)s %(where)s && git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s"
else:
rmdir %(where)s
git clone %(remote)s %(where)s && \
git --git-dir=%(where_git)s --work-tree=%(where)s checkout %(tag)s
+touch -d "$(git --git-dir=%(where_git)s log -1 --format=date_format)" %(where)s
"""
cmd = cmd % {'remote': from_what,
'tag': tag,
'where_git': where_git}
+ cmd=cmd.replace('date_format','"%ai"')
logger.logTxtFile.write("\n" + cmd + "\n")
logger.logTxtFile.flush()