From ef19995aed5b4a9a9f2776f3bc5e3155dfb95fd9 Mon Sep 17 00:00:00 2001 From: Paul Bignier Date: Fri, 29 Nov 2013 15:39:05 +0100 Subject: [PATCH] * Bug #13108 fixed - Atoms: updates spread and configurable By default, set time between ATOMS updates from a day to a month. This value is now configurable through atomsSetConfig("updateTime", value) and accessible thanks to atomsGetConfig("updateTime"). Change-Id: Ib0c4a3b25f157f91b8f78f4a0540525d276cbfdf --- scilab/CHANGES_5.5.X | 2 ++ scilab/modules/atoms/help/en_US/atomsGetConfig.xml | 19 +++++++++------ scilab/modules/atoms/help/en_US/atomsSetConfig.xml | 21 +++++++++------- scilab/modules/atoms/macros/atomsGetConfig.sci | 2 +- scilab/modules/atoms/macros/atomsSetConfig.sci | 1 + .../macros/atoms_internals/atomsDESCRIPTIONget.sci | 5 +++- .../atoms/tests/nonreg_tests/bug_13108.dia.ref | 21 ++++++++++++++++ .../modules/atoms/tests/nonreg_tests/bug_13108.tst | 25 ++++++++++++++++++++ 8 files changed, 79 insertions(+), 17 deletions(-) create mode 100644 scilab/modules/atoms/tests/nonreg_tests/bug_13108.dia.ref create mode 100644 scilab/modules/atoms/tests/nonreg_tests/bug_13108.tst diff --git a/scilab/CHANGES_5.5.X b/scilab/CHANGES_5.5.X index 934f1d0..e273f93 100644 --- a/scilab/CHANGES_5.5.X +++ b/scilab/CHANGES_5.5.X @@ -288,6 +288,8 @@ Scilab Bug Fixes * Bug #13101 fixed - When x-axis was in reverse position x_location='origin' failed. +* Bug #13108 fixed - Time between ATOMS database updates is now a month (was a day) and is configurable. + * Bug #13109 fixed - pll2str now supports polynomials with complex coefficients and hypermatrices. * Bug #13111 fixed - sqrt returned different results when imaginary part was -0 versus 0. diff --git a/scilab/modules/atoms/help/en_US/atomsGetConfig.xml b/scilab/modules/atoms/help/en_US/atomsGetConfig.xml index fcf6414..25c472b 100644 --- a/scilab/modules/atoms/help/en_US/atomsGetConfig.xml +++ b/scilab/modules/atoms/help/en_US/atomsGetConfig.xml @@ -51,7 +51,7 @@ useProxy Use/Don't use proxies - True/False + "True"/"False" @@ -95,7 +95,7 @@ called offLine. - True/False + "True"/"False" @@ -114,7 +114,7 @@ autoload Enable/Disable autoload system - True/False + "True"/"False" @@ -123,7 +123,7 @@ Scilab start - True/False + "True"/"False" @@ -142,7 +142,7 @@ verbose Display or not extra-information - True/False + "True"/"False" @@ -152,9 +152,14 @@ downloadTimeout - Get timeout used for download + Get timeout used for download (seconds) "5" is the default value + + updateTime + Get time between updates (days) + one month is the default value + @@ -176,7 +181,7 @@ Examples // Get value of verbose parameter - atomsGetConfig('Verbose') + atomsGetConfig("Verbose") diff --git a/scilab/modules/atoms/help/en_US/atomsSetConfig.xml b/scilab/modules/atoms/help/en_US/atomsSetConfig.xml index b697fd5..768a67f 100644 --- a/scilab/modules/atoms/help/en_US/atomsSetConfig.xml +++ b/scilab/modules/atoms/help/en_US/atomsSetConfig.xml @@ -58,7 +58,7 @@ useProxy Use/Don't use proxies - True/False + "True"/"False" @@ -102,7 +102,7 @@ called offLine. - True/False + "True"/"False" @@ -121,7 +121,7 @@ autoload Enable/Disable autoload system - True/False + "True"/"False" @@ -130,7 +130,7 @@ Scilab start - True/False + "True"/"False" @@ -149,7 +149,7 @@ Verbose Display or not extra-information - True/False + "True"/"False" @@ -159,9 +159,14 @@ downloadTimeout - Set timeout for download + Set timeout for download (seconds) "5" by default + + updateTime + Set time between updates (days) + one month by default + @@ -175,10 +180,10 @@ Examples // Display extra-information - atomsSetConfig('Verbose','True') + atomsSetConfig("Verbose","True") // Disable autoload system - atomsSetConfig('autoload','False') + atomsSetConfig("autoload","False") diff --git a/scilab/modules/atoms/macros/atomsGetConfig.sci b/scilab/modules/atoms/macros/atomsGetConfig.sci index 78aefac..6914651 100644 --- a/scilab/modules/atoms/macros/atomsGetConfig.sci +++ b/scilab/modules/atoms/macros/atomsGetConfig.sci @@ -37,7 +37,7 @@ function result = atomsGetConfig(field) supported_field = ["useProxy", "proxyHost", "proxyPort", .. "proxyUser", "proxyPassword", "offline", .. "autoload", "autoloadAddAfterInstall", .. - "verbose", "downloadTool", "downloadTimeout"]; + "verbose", "downloadTool", "downloadTimeout", "updateTime"]; if ~or(convstr(supported_field) == convstr(field)) then error(msprintf(gettext("%s: Wrong value for input argument #%d.\n"),"atomsGetConfig", 1)); diff --git a/scilab/modules/atoms/macros/atomsSetConfig.sci b/scilab/modules/atoms/macros/atomsSetConfig.sci index 1e5da5c..a31f190 100644 --- a/scilab/modules/atoms/macros/atomsSetConfig.sci +++ b/scilab/modules/atoms/macros/atomsSetConfig.sci @@ -79,6 +79,7 @@ function nbChanges = atomsSetConfig(field, value) | element == "proxyPassword" .. | element == "downloadTool" .. | element == "downloadTimeout" .. + | element == "updateTime" .. then continue; else error(msprintf(gettext("%s: Wrong key for input configuration argument.\n"), element)); diff --git a/scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONget.sci b/scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONget.sci index 7c0def2..8368041 100644 --- a/scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONget.sci +++ b/scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONget.sci @@ -117,7 +117,10 @@ function [packages,categories_flat,categories] = atomsDESCRIPTIONget(update) // If necessary, rebuild the struct // ========================================================================= - TIME_BEFORE_NEW_UPDATE = 86400; + TIME_BEFORE_NEW_UPDATE = strtod(atomsGetConfig("updateTime"))*86400; + if isnan(TIME_BEFORE_NEW_UPDATE) then // Value not found in config file, give the default one + TIME_BEFORE_NEW_UPDATE = 86400*30; // One month, in seconds + end if (packages_path_info == []) .. | (getdate("s") - packages_path_info(6) > TIME_BEFORE_NEW_UPDATE) .. | (rhs == 1 & update) then diff --git a/scilab/modules/atoms/tests/nonreg_tests/bug_13108.dia.ref b/scilab/modules/atoms/tests/nonreg_tests/bug_13108.dia.ref new file mode 100644 index 0000000..67676cf --- /dev/null +++ b/scilab/modules/atoms/tests/nonreg_tests/bug_13108.dia.ref @@ -0,0 +1,21 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- TEST WITH ATOMS --> +// +// <-- Non-regression test for bug 13108 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=13108 +// +// <-- Short Description --> +// The time between two updates can now be configured thanks to atomsSetConfig("updateTime", time) +atomsSaveConfig(); +// Set Atoms update time to the default value +atomsSetConfig("updateTime", "30"); +assert_checkequal(strtod(atomsGetConfig("updateTime")), 30); +atomsRestoreConfig(%T); diff --git a/scilab/modules/atoms/tests/nonreg_tests/bug_13108.tst b/scilab/modules/atoms/tests/nonreg_tests/bug_13108.tst new file mode 100644 index 0000000..3c88ac1 --- /dev/null +++ b/scilab/modules/atoms/tests/nonreg_tests/bug_13108.tst @@ -0,0 +1,25 @@ +// ============================================================================= +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2012 - DIGITEO - Allan CORNET +// +// This file is distributed under the same license as the Scilab package. +// ============================================================================= +// +// <-- TEST WITH ATOMS --> +// +// <-- Non-regression test for bug 13108 --> +// +// <-- Bugzilla URL --> +// http://bugzilla.scilab.org/show_bug.cgi?id=13108 +// +// <-- Short Description --> +// The time between two updates can now be configured thanks to atomsSetConfig("updateTime", time) + +atomsSaveConfig(); + +// Set Atoms update time to the default value +atomsSetConfig("updateTime", "30"); + +assert_checkequal(strtod(atomsGetConfig("updateTime")), 30); + +atomsRestoreConfig(%T); -- 1.7.9.5