Author: locilka
Date: Thu Oct 11 15:37:27 2007
New Revision: 41385
URL: http://svn.opensuse.org/viewcvs/yast?rev=41385&view=rev
Log:
Merging control-file texts in WorkflowManager as well (#271608).
Modified:
trunk/yast2/library/control/src/ProductControl.ycp
trunk/yast2/library/control/src/WorkflowManager.ycp
trunk/yast2/package/yast2.changes
Modified: trunk/yast2/library/control/src/ProductControl.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/control/src/ProductControl.ycp?rev=41385&r1=41384&r2=41385&view=diff
==============================================================================
--- trunk/yast2/library/control/src/ProductControl.ycp (original)
+++ trunk/yast2/library/control/src/ProductControl.ycp Thu Oct 11 15:37:27 2007
@@ -39,9 +39,6 @@
// modules to be offered to clone configuration at the end of installation
global list<string> clone_modules = [];
-// texts which are product specific
-map > texts = $[];
-
// Location of a custom control file
global string custom_control_file = "";
@@ -146,7 +143,7 @@
clone_modules = productControl["clone_modules"]:[];
foreach (string section,
- ["software", "globals", "network", "partitioning"],
+ ["software", "globals", "network", "partitioning", "texts"],
{
if (haskey (productControl, section))
{
@@ -164,16 +161,7 @@
ProductFeatures::SetFeature ("partitioning", "FlexiblePartitioning",
partitioning);
}
- string textdom = productControl["textdomain"]:"control";
- texts = mapmap (string key, map text,
- productControl["texts"]:$[],
- {
- string label = text["label"]:"";
- return $[ key : $[
- "label" : label,
- "textdomain" : textdom,
- ] ];
- });
+
return true;
}
@@ -744,14 +732,16 @@
}
global string GetTranslatedText (string key) {
- map text = texts[key]:$[];
+ map controlfile_texts = ProductFeatures::GetSection ("texts");
+ map text = (map ) controlfile_texts[key]:$[];
+
string label = text["label"]:"";
if (label == "")
{
y2error ("The requested label %1 does not exist", key);
return "";
}
- string domain = text["textdomain"]:"";
+ string domain = text["textdomain"]:productControl["textdomain"]:"control";
if (domain == "")
{
y2error ("The text domain for label %1 not set", key);
Modified: trunk/yast2/library/control/src/WorkflowManager.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/control/src/WorkflowManager.ycp?rev=41385&r1=41384&r2=41385&view=diff
==============================================================================
--- trunk/yast2/library/control/src/WorkflowManager.ycp (original)
+++ trunk/yast2/library/control/src/WorkflowManager.ycp Thu Oct 11 15:37:27 2007
@@ -957,18 +957,49 @@
* @return boolean true on success
*/
boolean UpdateProductInfo (map update_file) {
+ // merging all 'map ' type
foreach (string section, ["globals", "software", "partitioning", "network"], {
map sect = ProductFeatures::GetSection (section);
map addon = update_file[section]:$[];
- sect = (map)union (sect, addon);
+ sect = (map ) union (sect, addon);
ProductFeatures::SetSection (section, sect);
});
+ // merging 'clone_modules'
list <string> addon_clone = update_file["clone_modules"]:[];
-
ProductControl::clone_modules = (list <string>) merge (ProductControl::clone_modules, addon_clone);
+ // merging texts
+
+ /**
+ * @struct $[
+ * "congratulate" : $[
+ * "label" : "some text",
+ * ],
+ * "congratulate2" : $[
+ * "label" : "some other text",
+ * "textdomain" : "control-2", // (optionally)
+ * ],
+ * ];
+ */
+ map controlfile_texts = ProductFeatures::GetSection ("texts");
+ map > update_file_texts = update_file["texts"]:$[];
+ string update_file_textdomain = update_file["textdomain"]:"";
+
+ // if textdomain is different to the base one
+ // we have to put it into the map
+ if (update_file_textdomain != nil && update_file_textdomain != "") {
+ update_file_texts = mapmap (string text_ident, map text_def, update_file_texts, {
+ text_def["textdomain"] = update_file_textdomain;
+
+ return $[ text_ident : text_def ];
+ });
+ }
+
+ controlfile_texts = (map ) union (controlfile_texts, update_file_texts);
+ ProductFeatures::SetSection ("texts", controlfile_texts);
+
return true;
}
@@ -1007,7 +1038,7 @@
name,
update_file["textdomain"]:"control"
)) {
- y2error ("Failed to udpate installation workflow");
+ y2error ("Failed to update installation workflow");
return false;
}
@@ -1044,13 +1075,17 @@
string GenerateWorkflowIdent (string workflow_filename) {
string file_md5sum = FileUtils::MD5sum (workflow_filename);
- if (file_md5sum == nil || file_md5sum == "")
+ if (file_md5sum == nil || file_md5sum == "") {
+ y2error ("MD5 sum of file %1 is %2", workflow_filename, file_md5sum);
return nil;
+ }
integer file_size = FileUtils::GetSize (workflow_filename);
- if (file_size < 0)
+ if (file_size < 0) {
+ y2error ("File size %1 is %2", workflow_filename, file_size);
return nil;
+ }
return sformat ("%1-%2", file_md5sum, file_size);
}
@@ -1080,8 +1115,10 @@
if (workflow_ident != nil && contains (already_merged_workflows, workflow_ident)) {
y2milestone ("The very same workflow has been already merged, skipping...");
return;
- } else {
+ } else if (workflow_ident != nil) {
already_merged_workflows = add (already_merged_workflows, workflow_ident);
+ } else {
+ y2error ("Workflow ident is: %1", workflow_ident);
}
if (! IntegrateWorkflow (one_workflow)) {
Modified: trunk/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=41385&r1=41384&r2=41385&view=diff
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Thu Oct 11 15:37:27 2007
@@ -5,6 +5,7 @@
- Merging every single workflow only once, skipping duplicate
additional workflows even if provided by a different file name
(#332436).
+- Merging control-file texts in WorkflowManager as well (#271608).
-------------------------------------------------------------------
Thu Oct 4 16:29:01 CEST 2007 - jsrain@suse.cz
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org