From dec4eb17d51783a40e109c111d851e9177678917 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Wed, 1 Feb 2017 08:58:33 +0100 Subject: [PATCH] sat source: add the dir as a possible source for products --- commands/source.py | 35 ++++++++++++++++++++++++++++-- src/internal_config/distrib.pyconf | 1 + 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/commands/source.py b/commands/source.py index b40a6b4..55b23a1 100644 --- a/commands/source.py +++ b/commands/source.py @@ -145,6 +145,36 @@ def get_source_from_archive(product_info, source_dir, logger): return retcode +def get_source_from_dir(product_info, source_dir, logger): + + if "dir_info" not in product_info: + msg = _("Error: you must put a dir_info section" + " in the file %s.pyconf" % product_info.name) + logger.write("\n%s\n" % src.printcolors.printcError(msg), 1) + return False + + if "dir" not in product_info.dir_info: + msg = _("Error: you must put a dir in the dir_info section" + " in the file %s.pyconf" % product_info.name) + logger.write("\n%s\n" % src.printcolors.printcError(msg), 1) + return False + + # check that source exists + if not os.path.exists(product_info.dir_info.dir): + msg = _("Error: the dir %s defined in the file" + " %s.pyconf does not exists" % (product_info.dir_info.dir, + product_info.name)) + logger.write("\n%s\n" % src.printcolors.printcError(msg), 1) + return False + + logger.write('DIR: %s ... ' % src.printcolors.printcInfo( + product_info.dir_info.dir), 3) + logger.flush() + + retcode = src.Path(product_info.dir_info.dir).copy(source_dir) + + return retcode + def get_source_from_cvs(user, product_info, source_dir, @@ -296,6 +326,9 @@ def get_product_sources(config, if product_info.get_source == "archive": return get_source_from_archive(product_info, source_dir, logger) + + if product_info.get_source == "dir": + return get_source_from_dir(product_info, source_dir, logger) if product_info.get_source == "cvs": cvs_user = config.USER.cvs_user @@ -418,8 +451,6 @@ def get_all_product_sources(config, products, logger): results[product_name] = retcode if retcode: # The case where it succeed - - res = src.OK_STATUS good_result = good_result + 1 else: diff --git a/src/internal_config/distrib.pyconf b/src/internal_config/distrib.pyconf index 12d5067..9490511 100644 --- a/src/internal_config/distrib.pyconf +++ b/src/internal_config/distrib.pyconf @@ -55,5 +55,6 @@ VERSIONS : { "7.1.1503": "7.1" "7.2.1511": "7.2" + "7.3.1611": "7.3" } } -- 2.39.2