[yast-commit] r42914 - in /branches/SuSE-SLE-10-SP2-Branch/installation: VERSION package/yast2-installation.changes src/include/add-on-workflow.ycp src/modules/AddOnProduct.ycp
![](https://seccdn.libravatar.org/avatar/2e1a2d7374f0eeb790839676bdd1123a.jpg?s=120&d=mm&r=g)
Author: locilka Date: Mon Dec 10 17:10:04 2007 New Revision: 42914 URL: http://svn.opensuse.org/viewcvs/yast?rev=42914&view=rev Log: - PATTERNS tag in Add-On control file can contain list of patterns that are automatically pre-selected by adding the Add-On source (FATE #302398). - 2.13.201 Modified: branches/SuSE-SLE-10-SP2-Branch/installation/VERSION branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes branches/SuSE-SLE-10-SP2-Branch/installation/src/include/add-on-workflow.ycp branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp Modified: branches/SuSE-SLE-10-SP2-Branch/installation/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/installation/VERSION?rev=42914&r1=42913&r2=42914&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/installation/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/installation/VERSION Mon Dec 10 17:10:04 2007 @@ -1 +1 @@ -2.13.200 +2.13.201 Modified: branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes?rev=42914&r1=42913&r2=42914&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/installation/package/yast2-installation.changes Mon Dec 10 17:10:04 2007 @@ -1,4 +1,12 @@ ------------------------------------------------------------------- +Mon Dec 10 17:03:52 CET 2007 - locilka@suse.cz + +- PATTERNS tag in Add-On control file can contain list of patterns + that are automatically pre-selected by adding the Add-On source + (FATE #302398). +- 2.13.201 + +------------------------------------------------------------------- Fri Nov 23 13:16:22 CET 2007 - locilka@suse.cz - Using translations for inst_finish steps (#343783). Modified: branches/SuSE-SLE-10-SP2-Branch/installation/src/include/add-on-workflow.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/installation/src/include/add-on-workflow.ycp?rev=42914&r1=42913&r2=42914&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/installation/src/include/add-on-workflow.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/installation/src/include/add-on-workflow.ycp Mon Dec 10 17:10:04 2007 @@ -942,6 +942,8 @@ some_addon_changed = true; // remove product from list of product to register (FATE #301312) AddOnProduct::RemoveRegistrationFlag (media); + + AddOnProduct::Disintegrate (media); Redraw (enable_back, enable_next, back_button, next_button); Modified: branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp?rev=42914&r1=42913&r2=42914&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/installation/src/modules/AddOnProduct.ycp Mon Dec 10 17:10:04 2007 @@ -1162,6 +1162,9 @@ } } +// function content defined later +void HandleProductPATTERNS (integer srcid); + /** * Do installation of the add-on product within an installed system * srcid is got via AddOnProduct::src_id @@ -1185,6 +1188,9 @@ // FATE #301312 PrepareForRegistration (src_id); + // FATE #302398: PATTERNS keyword in content file + HandleProductPATTERNS (src_id); + symbol ret = nil; string control = Pkg::SourceProvideOptionalFile (src_id, 1, "/installation.xml"); @@ -1262,6 +1268,116 @@ } /** + * Every Add-On can preselect some patterns. + * Only patterns that are not selected/installed yet will be used. + * + * @struct $[ + * src_id : [ + * "pattern_1", "pattern_2", "pattern_6" + * ] + * ] + */ +map <integer, list <string> > patterns_preselected_by_addon = $[]; + +boolean SelectProductPatterns (string content_file, integer src_id) { + string cmd = sformat ( + "grep '^PATTERNS[\t ]\+' '%1' | sed 's/^PATTERNS[\t ]\+//'", + String::Quote (content_file) + ); + + map cmd_out = (map) SCR::Execute (.target.bash_output, cmd); + + if (cmd_out["exit"]:-1 != 0) { + y2error ("Command: >%1< returned: %2", cmd, cmd_out); + + return false; + } + + list <string> patterns_to_select = splitstring (cmd_out["stdout"]:"", "\t "); + patterns_to_select = filter (string one_pattern, patterns_to_select, { + return (one_pattern != nil && one_pattern != ""); + }); + + if (size (patterns_to_select) == 0) { + y2milestone ("Add-On doesn't have any required patterns (PATTERNS in content)"); + return true; + } + + y2milestone ("Add-On requires these PATTERNS: %1", patterns_to_select); + // clear/set + patterns_preselected_by_addon[src_id] = []; + + boolean ret = true; + + foreach (string one_pattern, patterns_to_select, { + list <map <string,any> > pattern_properties = Pkg::ResolvableProperties (one_pattern, `pattern, ""); + + boolean already_selected = false; + + foreach (map <string,any> one_pattern_found, pattern_properties, { + symbol patt_status = one_pattern_found["status"]:`unknown; + // patern is already selected + if (patt_status == `installed || patt_status == `selected) { + already_selected = true; + break; + } + }); + + if (already_selected) { + y2milestone ("Pattern %1 is already installed/selected", one_pattern); + return; + } + + if (! Pkg::ResolvableInstall (one_pattern, `pattern)) { + y2error ("Cannot select pattern: %1, reason: %2", one_pattern, Pkg::LastError()); + ret = false; + } else { + patterns_preselected_by_addon[src_id] = add (patterns_preselected_by_addon[src_id]:[], one_pattern); + } + }); + + return ret; +} + + +boolean DeselectProductPatterns (integer src_id) { + list <string> patterns_to_deselect = patterns_preselected_by_addon[src_id]:[]; + + if (size (patterns_to_deselect) == 0) { + y2milestone ("There's no pattern to be deselected"); + return true; + } + + boolean ret = true; + + foreach (string one_pattern, patterns_to_deselect, { + if (! Pkg::ResolvableNeutral (one_pattern, `pattern, true)) { + y2error ("Cannot deselect pattern: %1, reason: %2", one_pattern, Pkg::LastError()); + ret = false; + } + }); + + return ret; +} + +/** + * Function checks whether the product content file contains + * PATTERNS tag and pre-selects patterns listed there. + * + * @param integer source ID + */ +void HandleProductPATTERNS (integer srcid) { + // FATE #302398: PATTERNS keyword in content file + string content_file = Pkg::SourceProvideOptionalFile (srcid, 1, "/content"); + + if (content_file == nil) { + y2warning ("Add-On %1 doesn't have a content file", srcid); + } else { + SelectProductPatterns (content_file, srcid); + } +} + +/** * Integrate the add-on product to the installation workflow, including * preparations for 2nd stage and inst-sys update * @param srcid integer the source ID of the installation source @@ -1281,6 +1397,9 @@ UpdateInstSys (y2update); } + // FATE #302398: PATTERNS keyword in content file + HandleProductPATTERNS (srcid); + // Updating workflow or proposals // Trying to use a cached file, bugzilla #221377 @@ -1587,4 +1706,8 @@ } } +global void Disintegrate (integer srcid) { + DeselectProductPatterns (srcid); +} + } // module end -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
locilka@svn.opensuse.org