Author: locilka Date: Thu Jan 29 19:36:29 2009 New Revision: 55156 URL: http://svn.opensuse.org/viewcvs/yast?rev=55156&view=rev Log: - Fixed displaying i18n characters in summary (bnc #460674). - Save summary to file - huge speedup (bnc #460674). - 2.17.1 Modified: branches/SuSE-Code-11-Branch/restore/VERSION branches/SuSE-Code-11-Branch/restore/package/yast2-restore.changes branches/SuSE-Code-11-Branch/restore/src/Restore.ycp branches/SuSE-Code-11-Branch/restore/src/summary_dialog.ycp Modified: branches/SuSE-Code-11-Branch/restore/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/restore/VE... ============================================================================== --- branches/SuSE-Code-11-Branch/restore/VERSION (original) +++ branches/SuSE-Code-11-Branch/restore/VERSION Thu Jan 29 19:36:29 2009 @@ -1 +1 @@ -2.17.0 +2.17.1 Modified: branches/SuSE-Code-11-Branch/restore/package/yast2-restore.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/restore/pa... ============================================================================== --- branches/SuSE-Code-11-Branch/restore/package/yast2-restore.changes (original) +++ branches/SuSE-Code-11-Branch/restore/package/yast2-restore.changes Thu Jan 29 19:36:29 2009 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Thu Jan 29 19:21:35 CET 2009 - locilka@suse.cz + +- Fixed displaying i18n characters in summary (bnc #460674). +- Save summary to file - huge speedup (bnc #460674). +- 2.17.1 + +------------------------------------------------------------------- Tue Dec 16 15:42:40 CET 2008 - locilka@suse.cz - Fixed alignment of buttons (bnc #447102). Modified: branches/SuSE-Code-11-Branch/restore/src/Restore.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/restore/sr... ============================================================================== --- branches/SuSE-Code-11-Branch/restore/src/Restore.ycp (original) +++ branches/SuSE-Code-11-Branch/restore/src/Restore.ycp Thu Jan 29 19:36:29 2009 @@ -972,7 +972,7 @@ infofiles = infofiles + (compressed_packages_info ? "info/packages_info.gz" : "info/packages_info"); // unpack info files - result = (map) SCR::Execute(.target.bash_output, "/bin/tar -C " + tempdir + " -x -f " + filename + " " + infofiles + " 2> /dev/null"); + result = (map) SCR::Execute(.target.bash_output, "/bin/tar -C '" + String::Quote (tempdir) + "' -x -f " + filename + " " + infofiles + " 2> /dev/null"); date = (string) SCR::Read(.target.string, tempdir + "/info/date"); comment = (string) SCR::Read(.target.string, tempdir + "/info/comment"); @@ -1460,6 +1460,10 @@ } ); + // BNC #460674, Do not change the system locale + // It can change I18N characters in output + string locale_modifications = "export LANG=C; "; + if (fileinarchive == "") { y2error("Can't find subarchive for package %1", package); @@ -1478,14 +1482,14 @@ } ); - string command = "export LC_ALL=C; echo q | /bin/tar -C " + tempdir + " -x -M " + param + fileinarchive + " 2> /dev/null"; + string command = locale_modifications + "echo q | /bin/tar -C " + tempdir + " -x -M " + param + fileinarchive + " 2> /dev/null"; y2debug("Running command: %1", command); started = (boolean) SCR::Execute(.background.run, command); } else { - started = (boolean) SCR::Execute(.background.run, "export LC_ALL=C; /bin/tar -C " + tempdir + " -x -f " + filename + " " + fileinarchive); + started = (boolean) SCR::Execute(.background.run, locale_modifications + "/bin/tar -C " + tempdir + " -x -f " + filename + " " + fileinarchive); } // abort test cycle @@ -1563,11 +1567,11 @@ // for tar: --files-from=filename // create (s)tar command - string tarcommand = (star == false) ? ("export LC_ALL=C; /bin/tar -C " + targetdir + " " + string tarcommand = (star == false) ? (locale_modifications + "/bin/tar -C " + targetdir + " " + compress + " -x -v -f " + tempdir + "/" + fileinarchive + " " + RPMdb + " " + unpackfiles + " 2> " + tempdir + "/tar.stderr > " + tempdir + "/tar.stdout") - : ("export LC_ALL=C; /usr/bin/star -C " + targetdir + " " + : (locale_modifications + "/usr/bin/star -C " + targetdir + " " + compress + " -x -v -U -f " + tempdir + "/" + fileinarchive + " " + RPMdb + " " + unpackfiles + " 2> " + tempdir + "/tar.stderr > " + tempdir + "/tar.stdout"); Modified: branches/SuSE-Code-11-Branch/restore/src/summary_dialog.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-Code-11-Branch/restore/sr... ============================================================================== --- branches/SuSE-Code-11-Branch/restore/src/summary_dialog.ycp (original) +++ branches/SuSE-Code-11-Branch/restore/src/summary_dialog.ycp Thu Jan 29 19:36:29 2009 @@ -25,6 +25,8 @@ import "Popup"; import "Label"; +import "Directory"; +import "String"; /** * This function removes HTML tags from input string @@ -32,8 +34,7 @@ * @return string String without tags */ -define string RemoveTags(string input) ``{ - string ret = input; +define string RemoveTags(string & ret) ``{ map<string,string> tagmapping = $[ "BR" : "\n", "/P" : "\n", "P" : "", "B" : "", "/B" : "", "EM" : "", "/EM" : "", "I" : "", "/I" : "", "TT" : "", "/TT" : "", @@ -42,17 +43,22 @@ "H3" : "", "/H3" : "" ]; + string tag = nil; + string taglower = nil; + foreach(string t, string repl, tagmapping, ``{ - string tag = "<" + t + ">"; + tag = "<" + t + ">"; while (issubstring(ret, tag)) { ret = regexpsub(ret, "(.*)" + tag + "(.*)", "\1" + repl + "\2"); } - while (issubstring(ret, tolower(tag))) + taglower = tolower(tag); + + while (issubstring(ret, taglower)) { - ret = regexpsub(ret, "(.*)" + tag + "(.*)", "\1" + repl + "\2"); + ret = regexpsub(ret, "(.*)" + taglower + "(.*)", "\1" + repl + "\2"); } } ); @@ -120,7 +126,35 @@ if (savefile != "" && savefile != nil) { - SCR::Write(.target.string, savefile, RemoveTags(detail_text)); + // Create or empty the file + SCR::Write(.target.string, savefile, ""); + + // BNC #460674 + // Due to the very ineffective all-in-one-run function, removing HTML + // and writing thw whole file at once takes just too much time + // + // Fixed by going through the summary line by line (by <BR>s) + + string tmpfile = Directory::tmpdir + "/restore_tmpfile"; + + y2milestone ("Using tmpfile: %1", tmpfile); + // Using tmpfile - there are more powerful tools for parsing text + if (SCR::Write (.target.string, tmpfile, detail_text)) { + if ((integer) SCR::Execute ( + .target.bash, + sformat ("perl -pi -e "s/<BR>/\n/g;" '%1'", String::Quote (tmpfile)) == 0 + ) { + detail_text = (string) SCR::Read (.target.string, tmpfile); + } + } + + foreach (string one_line, splitstring (detail_text, "\n"), { + // <BR> == newline + one_line = one_line + "\n"; + // Appending lines one by one + SCR::Write (.backup.file_append, [savefile, RemoveTags (one_line)]); + }); + y2milestone("Summary saved to file: %1", savefile); } } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org