From bc7d63456bc2f5c9f16cef0072f9e0d738b32ee6 Mon Sep 17 00:00:00 2001 From: crouzet Date: Fri, 1 Feb 2019 15:13:23 +0100 Subject: [PATCH] =?utf8?q?sat=20#8597=20:=20impl=C3=A9mentation=20d'un=20m?= =?utf8?q?ode=20completion=20pour=20prepare?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- commands/prepare.py | 23 ++++++++++++++++++++--- complete_sat.sh | 2 +- doc/src/commands/prepare.rst | 6 ++++++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/commands/prepare.py b/commands/prepare.py index b182a1b..2fb8388 100644 --- a/commands/prepare.py +++ b/commands/prepare.py @@ -32,9 +32,12 @@ parser.add_option('f', 'force', 'boolean', 'force', _("Optional: force to prepare the products in development mode.")) parser.add_option('', 'force_patch', 'boolean', 'force_patch', _("Optional: force to apply patch to the products in development mode.")) +parser.add_option('c', 'complete', 'boolean', 'complete', + _("Optional: completion mode, only prepare products not present in SOURCES dir."), + False) -def find_products_already_getted(l_products): +def find_products_already_prepared(l_products): '''function that returns the list of products that have an existing source directory. @@ -94,7 +97,21 @@ def run(args, runner, logger): else: # no product interpeted as all products listProd = [name for name, tmp in products_infos] - DBG.write("prepare products", sorted(listProd)) + if options.complete: + # remove products that are already prepared 'completion mode) + pi_already_prepared=find_products_already_prepared(products_infos) + l_already_prepared = [i for i, tmp in pi_already_prepared] + newList, removedList = removeInList(listProd, l_already_prepared) + listProd = newList + if len(newList) == 0 and len(removedList) > 0 : + msg = "\nAll the products are already installed, do nothing!\n" + logger.write(src.printcolors.printcWarning(msg), 1) + return 0 + if len(removedList) > 0 : + msg = "\nList of already prepared products that are skipped : %s\n" % ",".join(removedList) + logger.write(msg, 3) + + args_product_opt = '--products ' + ",".join(listProd) do_source = (len(listProd) > 0) @@ -102,7 +119,7 @@ def run(args, runner, logger): ldev_products = [p for p in products_infos if src.product.product_is_dev(p[1])] newList = listProd # default if not options.force and len(ldev_products) > 0: - l_products_not_getted = find_products_already_getted(ldev_products) + l_products_not_getted = find_products_already_prepared(ldev_products) listNot = [i for i, tmp in l_products_not_getted] newList, removedList = removeInList(listProd, listNot) if len(removedList) > 0: diff --git a/complete_sat.sh b/complete_sat.sh index 15a0c55..ca3a131 100755 --- a/complete_sat.sh +++ b/complete_sat.sh @@ -182,7 +182,7 @@ _salomeTools_complete() return 0 ;; prepare) - opts="--products --properties --force --force_patch" + opts="--products --properties --force --force_patch --complete" COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) return 0 ;; diff --git a/doc/src/commands/prepare.rst b/doc/src/commands/prepare.rst index a28fdae..f67dec0 100644 --- a/doc/src/commands/prepare.rst +++ b/doc/src/commands/prepare.rst @@ -79,6 +79,12 @@ Usage sat prepare --force_patch +* Prepare only products that are not present in SOURCES. + This completion mode is used to complete the preparation when it was interrupted, + or when the product list was increased: :: + + sat prepare --complete + Some useful configuration pathes ================================= -- 2.39.2