Author: locilka Date: Thu Apr 3 19:40:19 2008 New Revision: 46058 URL: http://svn.opensuse.org/viewcvs/yast?rev=46058&view=rev Log: - Changed instalation from images to count the best image-set from patterns (list of patterns in image-set) in images.xml. Modified: trunk/installation/package/yast2-installation.changes trunk/installation/src/clients/inst_doit.ycp trunk/installation/src/modules/ImageInstallation.ycp Modified: trunk/installation/package/yast2-installation.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/package/yast2-instal... ============================================================================== --- trunk/installation/package/yast2-installation.changes (original) +++ trunk/installation/package/yast2-installation.changes Thu Apr 3 19:40:19 2008 @@ -8,6 +8,8 @@ - Cosmetic changes when initializing the wizard steps according to control file. - Fixed untarring bzip2 or gzip-based images. +- Changed instalation from images to count the best image-set + from patterns (list of patterns in image-set) in images.xml. ------------------------------------------------------------------- Tue Apr 1 13:12:00 CEST 2008 - locilka@suse.cz Modified: trunk/installation/src/clients/inst_doit.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/clients/inst_doi... ============================================================================== --- trunk/installation/src/clients/inst_doit.ycp (original) +++ trunk/installation/src/clients/inst_doit.ycp Thu Apr 3 19:40:19 2008 @@ -31,8 +31,23 @@ // bugzilla #219097 boolean confirmed = confirmInstallation(); - if ( confirmed ) - y2milestone( "User confirmed %1", Mode::update () ? "update" : "installation" ); + if (confirmed) { + y2milestone ("User confirmed %1", + Mode::update () ? "update" : "installation"); + + Wizard::SetContents ( + // TRANSLATORS: dialog caption + _("Installation - Warming Up"), + `VBox ( + // FIXME: invent something better :>>> zzz + `Label (_("Drzte si klobouky, jedeme z kopceeee....")) + ), + // TRANSLATORS: dialog help + _("<p>Installation is just about to start!</p>"), + false, + false + ); + } return confirmed ? `next : `back; } Modified: trunk/installation/src/modules/ImageInstallation.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/installation/src/modules/ImageIns... ============================================================================== --- trunk/installation/src/modules/ImageInstallation.ycp (original) +++ trunk/installation/src/modules/ImageInstallation.ycp Thu Apr 3 19:40:19 2008 @@ -312,40 +312,19 @@ // TODO error checking } -// TODO: extract the weight from control file -list <string> patterns_priority = ["^kde", "^gnome", "^xfce", "^x11", "^base", "^enhanced_base"]; - /** - * Function finds a pattern weight - * The return value is 0 to 9999. The smaller the number the bigger the weight. - * - * @param string pattern - * @return integer pattern weight + * Returns the intersection of both patterns supported by the imageset + * and patterns going to be installed. */ -integer GetPatternWeight (string pattern) { - integer weight = 9999; +integer CountMatchingPatterns (list <string> imageset_patterns, list <string> installed_patterns) { + integer ret = 0; - integer counter = -1; - foreach (string one_pattern_regexp, patterns_priority, { - counter = counter + 1; - if (regexpmatch (pattern, one_pattern_regexp)) { - weight = counter; - break; - } + foreach (string one_installed_pattern, installed_patterns, { + if (contains (imageset_patterns, one_installed_pattern)) + ret = ret + 1; }); - return weight; -} - -/** - * Patterns have an internal weight. It says which one of two is better - * to use for image installation. The size does matter. - */ -boolean DoesPatternFitBetter (string last_pattern, string new_pattern) { - integer last_pattern_weight = GetPatternWeight (last_pattern); - integer new_pattern_weight = GetPatternWeight (new_pattern); - - return (new_pattern_weight < last_pattern_weight); + return ret; } /** @@ -384,41 +363,38 @@ // more patterns could match at once // as we can't merge the meta image, only one can be selected map <string, map <string, any> > possible_patterns = $[]; - map <string, integer> matching_pattern_sizes = $[]; + map <string, integer> matching_patterns = $[]; // trying to find all matching patterns foreach (map<string,any> image, image_sets, { - string pattern = image["pattern"]:""; + string pattern = image["patterns"]:""; + + list <string> imageset_patterns = splitstring (pattern, ", "); // no image-pattern defined, matches all patterns - if (pattern == "" && result == $[]) { + if (size (imageset_patterns) == 0) { possible_patterns[pattern] = image; // image-patterns matches to patterns got as parameter - } else if (contains (patterns, pattern)) { - possible_patterns[pattern] = image; - } + } else { + matching_patterns[pattern] = CountMatchingPatterns (imageset_patterns, patterns); - matching_pattern_sizes[pattern] = size (image["images"]:[]); + if (matching_patterns[pattern]:0 > 0) { + possible_patterns[pattern] = image; + } + } }); - y2milestone ("Matching patterns: %1, sizes: %2", possible_patterns, matching_pattern_sizes); + y2milestone ("Matching patterns: %1, sizes: %2", possible_patterns, matching_patterns); string last_pattern = ""; - // one result - if (size (possible_patterns) == 1) { - foreach (string pattern, map <string, any> image, possible_patterns, { - result = image; - last_pattern = pattern; - }); - // more possible results - } else if (size (possible_patterns) > 1) { - integer last_size = -1; + if (size (possible_patterns) > 0) { + integer last_number_of_matching_patterns = -1; last_pattern = ""; foreach (string pattern, map <string, any> image, possible_patterns, { - if (matching_pattern_sizes[pattern]:0 >= last_size && DoesPatternFitBetter (last_pattern, pattern)) { - last_size = matching_pattern_sizes[pattern]:0; + if (matching_patterns[pattern]:0 > last_number_of_matching_patterns) { + last_number_of_matching_patterns = matching_patterns[pattern]:0; result = image; last_pattern = pattern; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org