* Bug #13108 fixed - Atoms: updates spread and configurable 83/13283/4
Paul Bignier [Fri, 29 Nov 2013 14:39:05 +0000 (15:39 +0100)]
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
scilab/modules/atoms/help/en_US/atomsGetConfig.xml
scilab/modules/atoms/help/en_US/atomsSetConfig.xml
scilab/modules/atoms/macros/atomsGetConfig.sci
scilab/modules/atoms/macros/atomsSetConfig.sci
scilab/modules/atoms/macros/atoms_internals/atomsDESCRIPTIONget.sci
scilab/modules/atoms/tests/nonreg_tests/bug_13108.dia.ref [new file with mode: 0644]
scilab/modules/atoms/tests/nonreg_tests/bug_13108.tst [new file with mode: 0644]

index 934f1d0..e273f93 100644 (file)
@@ -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.
index fcf6414..25c472b 100644 (file)
@@ -51,7 +51,7 @@
                     <td>useProxy</td>
                     <td>Use/Don't use proxies</td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
                 <tr>
@@ -95,7 +95,7 @@
                         called offLine.
                     </td>
                     <td>
-                        True/<emphasis role="strong">False</emphasis>
+                        "True"/<emphasis role="strong">"False"</emphasis>
                     </td>
                 </tr>
             </informaltable>
                     <td>autoload</td>
                     <td>Enable/Disable autoload system</td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
                 <tr>
                         Scilab start
                     </td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
             </informaltable>
                     <td>verbose</td>
                     <td>Display or not extra-information</td>
                     <td>
-                        True/<emphasis role="strong">False</emphasis>
+                        "True"/<emphasis role="strong">"False"</emphasis>
                     </td>
                 </tr>
                 <tr>
                 </tr>
                 <tr>
                     <td>downloadTimeout</td>
-                    <td> Get timeout used for download</td>
+                    <td> Get timeout used for download (seconds)</td>
                     <td> "5" is the default value</td>
                 </tr>
+                <tr>
+                    <td>updateTime</td>
+                    <td> Get time between updates (days)</td>
+                    <td> one month is the default value</td>
+                </tr>
             </informaltable>
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example">// Get value of verbose parameter
-            atomsGetConfig('Verbose')
+            atomsGetConfig("Verbose")
         </programlisting>
     </refsection>
     <refsection>
index b697fd5..768a67f 100644 (file)
@@ -58,7 +58,7 @@
                     <td>useProxy</td>
                     <td>Use/Don't use proxies</td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
                 <tr>
                         called offLine.
                     </td>
                     <td>
-                        True/<emphasis role="strong">False</emphasis>
+                        "True"/<emphasis role="strong">"False"</emphasis>
                     </td>
                 </tr>
             </informaltable>
                     <td>autoload</td>
                     <td>Enable/Disable autoload system</td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
                 <tr>
                         Scilab start
                     </td>
                     <td>
-                        <emphasis role="strong">True</emphasis>/False
+                        <emphasis role="strong">"True"</emphasis>/"False"
                     </td>
                 </tr>
             </informaltable>
                     <td>Verbose</td>
                     <td>Display or not extra-information</td>
                     <td>
-                        True/<emphasis role="strong">False</emphasis>
+                        "True"/<emphasis role="strong">"False"</emphasis>
                     </td>
                 </tr>
                 <tr>
                 </tr>
                 <tr>
                     <td>downloadTimeout</td>
-                    <td>Set timeout for download</td>
+                    <td>Set timeout for download (seconds)</td>
                     <td>"5" by default</td>
                 </tr>
+                <tr>
+                    <td>updateTime</td>
+                    <td>Set time between updates (days)</td>
+                    <td>one month by default</td>
+                </tr>
             </informaltable>
         </para>
     </refsection>
     <refsection>
         <title>Examples</title>
         <programlisting role="example">// Display extra-information
-            atomsSetConfig('Verbose','True')
+            atomsSetConfig("Verbose","True")
             
             // Disable autoload system
-            atomsSetConfig('autoload','False')
+            atomsSetConfig("autoload","False")
         </programlisting>
     </refsection>
     <refsection role="see also">
index 78aefac..6914651 100644 (file)
@@ -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));
index 1e5da5c..a31f190 100644 (file)
@@ -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));
index 7c0def2..8368041 100644 (file)
@@ -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 (file)
index 0000000..67676cf
--- /dev/null
@@ -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 (file)
index 0000000..3c88ac1
--- /dev/null
@@ -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);