Mailinglist Archive: yast-commit (819 mails)

< Previous Next >
[yast-commit] r54938 - in /trunk/yast2: ./ data/ library/packages/src/ library/types/src/ package/
  • From: lslezak@xxxxxxxxxxxxxxxx
  • Date: Fri, 23 Jan 2009 12:34:35 -0000
  • Message-id: <E1LQLF5-0001Bs-WE@xxxxxxxxxxxxxxxx>
Author: lslezak
Date: Fri Jan 23 13:34:35 2009
New Revision: 54938

URL: http://svn.opensuse.org/viewcvs/yast?rev=54938&view=rev
Log:
- added String::FormatTime() for formatting time in seconds to
a printable string (HH:MM:SS or MM:SS format)
- PackagesUI - added installation summary dialog (bnc#431854)
- added PKGMGR_ACTION_AT_EXIT sysconfig variable for configuring
the default package manager behavior at exit
- 2.18.1

Modified:
trunk/yast2/VERSION
trunk/yast2/data/sysconfig.yast2
trunk/yast2/library/packages/src/PackageCallbacks.ycp
trunk/yast2/library/packages/src/PackagesUI.ycp
trunk/yast2/library/packages/src/SlideShow.ycp
trunk/yast2/library/types/src/String.ycp
trunk/yast2/package/yast2.changes

Modified: trunk/yast2/VERSION
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/VERSION?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/VERSION (original)
+++ trunk/yast2/VERSION Fri Jan 23 13:34:35 2009
@@ -1 +1 @@
-2.18.0
+2.18.1

Modified: trunk/yast2/data/sysconfig.yast2
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/data/sysconfig.yast2?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/data/sysconfig.yast2 (original)
+++ trunk/yast2/data/sysconfig.yast2 Fri Jan 23 13:34:35 2009
@@ -52,3 +52,13 @@
# This option is experimental and not all YaST modules do support
# configuration tracking via subversion
SUBVERSION_ADD_DIRS_RECURSIVE="no"
+
+## Type: list(close,restart,summary)
+## Default: "close"
+# Set the default behavior of the package manager when package installation
has finished.
+# Possible actions are:
+# close - just finish the package manager
+# restart - go back to the package manager, install/remove more packages
+# summary - display an installation summary dialog, there user can decide
whether to finish or restart
+# The summary dialog is always displayed when an installation error has
occured.
+PKGMGR_ACTION_AT_EXIT="close"

Modified: trunk/yast2/library/packages/src/PackageCallbacks.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackageCallbacks.ycp?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/library/packages/src/PackageCallbacks.ycp (original)
+++ trunk/yast2/library/packages/src/PackageCallbacks.ycp Fri Jan 23 13:34:35
2009
@@ -1846,7 +1846,8 @@
might be missing or out of date.")),
`ButtonBox (
`PushButton (`id(`continue), `opt (`default,
`okButton), Label::ContinueButton()),
- `PushButton (`id(`skip), `opt (`cancelButton), _("Skip
Refresh"))
+ // push button label
+ `PushButton (`id(`skip), `opt (`cancelButton), _("&Skip
Refresh"))
)
)
)

Modified: trunk/yast2/library/packages/src/PackagesUI.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackagesUI.ycp?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/library/packages/src/PackagesUI.ycp (original)
+++ trunk/yast2/library/packages/src/PackagesUI.ycp Fri Jan 23 13:34:35 2009
@@ -17,6 +17,47 @@

import "Label";
import "Wizard";
+ import "HTML";
+ import "String";
+ import "Popup";
+
+ map<string, any> package_summary = $[];
+
+ global map<string, any> GetPackageSummary()
+ {
+ return package_summary;
+ }
+
+ global void SetPackageSummary(map<string, any> summary)
+ {
+ if (summary == nil)
+ {
+ y2error("Cannot set nil package summary!");
+ return;
+ }
+
+ y2debug("Setting package summary: %1", summary);
+ package_summary = summary;
+ }
+
+ global void ResetPackageSummary()
+ {
+ y2debug("Resetting package summary");
+ package_summary = $[];
+ }
+
+ global void SetPackageSummaryItem(string name, any value)
+ {
+ if (name == nil || name == "")
+ {
+ y2error("Invalid item name: '%1'", name);
+ return;
+ }
+
+ y2debug("Package summary '%1': %2", name, value);
+
+ package_summary[name] = value;
+ }


//
@@ -341,4 +382,239 @@
return result;
}

+ string FormatPackageList(list<string> pkgs, string link)
+ {
+ string ret = "";
+
+ if (size(pkgs) > 8)
+ {
+ list<string> head = sublist(pkgs, 0, 8);
+ ret = sformat("%1... %2", mergestring(head, ", "),
HTML::Link(_("(more)"), link));
+ }
+ else
+ {
+ ret = mergestring(pkgs, ", ");
+ }
+
+ return ret;
+ }
+
+ global string InstallationSummary(map<string,any> summary)
+ {
+ string ret = "";
+
+ if (haskey(summary, "success"))
+ {
+ ret = HTML::Para(HTML::Heading(summary["success"]:true ?
_("Installation Successfully Finished")
+ : _("Package Installation Failed")));
+ }
+
+ if (haskey(summary, "error"))
+ {
+ ret = ret + HTML::List([sformat(_("Error Message: %1"),
HTML::Colorize(summary["error"]:"", "red"))]);
+ }
+
+ list<string> items = [];
+
+ integer failed_packs = size(summary["failed"]:[]);
+ if (failed_packs > 0)
+ {
+ items = add(items, HTML::Colorize(sformat(_("Failed Packages: %1"),
failed_packs), "red")
+ + "<BR>" +
FormatPackageList(lsort((list<string>)summary["failed"]:[]),
"failed_packages"));
+ }
+
+ if (summary["installed"]:0 > 0)
+ {
+ items = add(items, sformat(_("Installed Packages: %1"),
summary["installed"]:0)
+ + "<BR>" +
FormatPackageList(lsort((list<string>)summary["installed_list"]:[]),
"installed_packages"));
+ }
+
+ if (summary["updated"]:0 > 0)
+ {
+ items = add(items, sformat(_("Updated Packages: %1"),
summary["updated"]:0)
+ + "<BR>" +
FormatPackageList(lsort((list<string>)summary["updated_list"]:[]),
"updated_packages"));
+ }
+
+ if (summary["removed"]:0 > 0)
+ {
+ items = add(items, sformat(_("Removed Packages: %1"),
summary["removed"]:0)
+ + "<BR>" +
FormatPackageList(lsort((list<string>)summary["removed_list"]:[]),
"removed_packages"));
+ }
+
+ if (size(summary["remaining"]:[]) > 0)
+ {
+ items = add(items, sformat(_("Not Installed Packages: %1"),
size(summary["remaining"]:[]))
+ + "<BR>" +
FormatPackageList(lsort((list<string>)summary["remaining"]:[]),
"remaining_packages"));
+ }
+
+ if (size(items) > 0)
+ {
+ ret = ret + HTML::Para(
+ HTML::Heading(_("Packages"))
+ + HTML::List(items)
+ );
+ }
+
+ // reset the items list
+ items = [];
+
+ if (summary["time_seconds"]:0 > 0)
+ {
+ items = add(items, sformat(_("Elapsed Time: %1"),
String::FormatTime(summary["time_seconds"]:0)));
+ }
+
+ if (summary["installed_bytes"]:0 > 0)
+ {
+ items = add(items, sformat(_("Total Installed Size: %1"),
+ String::FormatSize(summary["installed_bytes"]:0)));
+ }
+
+ if (summary["downloaded_bytes"]:0 > 0)
+ {
+ items = add(items, sformat(_("Total Downloaded Size: %1"),
+ String::FormatSize(summary["downloaded_bytes"]:0)));
+ }
+
+ if (size(items) > 0)
+ {
+ ret = ret + HTML::Para(
+ HTML::Heading(_("Statistics"))
+ + HTML::List(items)
+ );
+ }
+
+ items = [];
+
+ if (haskey(summary, "install_log") && size(summary["install_log"]:"") >
0)
+ {
+ items = add(items, HTML::Link(_("Installation log"),
"install_log"));
+ }
+
+ if (haskey(summary, "postinstall_log"))
+ {
+ items = add(items, HTML::Link(_("Post-Installation log
(SUSEconfig)"), "postinstall_log"));
+ }
+
+ if (size(items) > 0)
+ {
+ ret = ret + HTML::Para(
+ HTML::Heading(_("Details"))
+ + HTML::List(items)
+ );
+ }
+
+ y2milestone("Installation summary: %1", ret);
+
+ return ret;
+ }
+
+ void ShowDetailsString(string heading, string text)
+ {
+ Popup::LongText(heading, `RichText(`opt(`plainText), text), 70, 20);
+ }
+
+ void ShowDetailsList(string heading, list<string> pkgs)
+ {
+ ShowDetailsString(heading, mergestring(lsort(pkgs), "\n"));
+ }
+
+
+ global symbol ShowInstallationSummaryMap(map<string,any> summary)
+ {
+ string summary_str = InstallationSummary(summary);
+
+ if (summary_str == nil || summary_str == "")
+ {
+ y2warning("No summary, skipping summary dialog");
+ return `next;
+ }
+
+ boolean wizard_opened = false;
+
+ // open a new wizard dialog if needed
+ if (!Wizard::IsWizardDialog())
+ {
+ Wizard::OpenNextBackDialog();
+ wizard_opened = true;
+ }
+
+ term dialog = `RichText(`id(`rtext), summary_str);
+
+ string help_text = _("<P><BIG><B>Installation Summary</B></BIG><BR>Here
is a summary of installed packages.</P>");
+
+ Wizard::SetNextButton(`next, Label::FinishButton());
+
+ Wizard::SetContents(_("Installation Summary"),
+ dialog, help_text, true /*has_back*/, true /*has_next*/);
+
+ any result = nil;
+
+ do
+ {
+ result = UI::UserInput();
+ y2milestone("input: %1", result);
+
+ // handle detail requests (clicking a link in the summary)
+ if (is(result, string))
+ {
+ // display installation log
+ if (result == "install_log")
+ {
+ ShowDetailsString(_("Installation log"),
summary["install_log"]:"");
+ }
+ // display post-installation log (suseconfig)
+ else if (result == "postinstall_log")
+ {
+ ShowDetailsString(_("Post-Installation log (SUSEconfig)"),
summary["postinstall_log"]:"");
+ }
+ else if (result == "installed_packages")
+ {
+ ShowDetailsList(_("Installed Packages"),
summary["installed_list"]:[]);
+ }
+ else if (result == "updated_packages")
+ {
+ ShowDetailsList(_("Updated Packages"),
summary["updated_list"]:[]);
+ }
+ else if (result == "removed_packages")
+ {
+ ShowDetailsList(_("Removed Packages"),
summary["removed_list"]:[]);
+ }
+ else if (result == "remaining_packages")
+ {
+ ShowDetailsList(_("Remaining Packages"),
summary["remaining"]:[]);
+ }
+ else
+ {
+ y2error("Unknown input: %1", result);
+ }
+ }
+ else if (is(result, symbol))
+ {
+ // close by WM
+ if (result == `cancel)
+ {
+ result = `abort;
+ }
+ }
+ }
+ while(is(result, string) || !contains([`next, `abort, `back],
(symbol)result));
+
+ y2milestone("Installation Summary result: %1", result);
+
+ Wizard::RestoreNextButton();
+
+ if (wizard_opened)
+ {
+ // close the opened window
+ Wizard::CloseDialog();
+ }
+
+ return (symbol)result;
+ }
+
+ global symbol ShowInstallationSummary()
+ {
+ return ShowInstallationSummaryMap(package_summary);
+ }
+
}

Modified: trunk/yast2/library/packages/src/SlideShow.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/SlideShow.ycp?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/library/packages/src/SlideShow.ycp (original)
+++ trunk/yast2/library/packages/src/SlideShow.ycp Fri Jan 23 13:34:35 2009
@@ -89,12 +89,9 @@

textdomain "base";

- import "Installation";
import "Label";
import "Stage";
- import "String";
import "Wizard";
- import "FileUtils";
import "Mode";
import "Popup";
import "Slides";

Modified: trunk/yast2/library/types/src/String.ycp
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/types/src/String.ycp?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/library/types/src/String.ycp (original)
+++ trunk/yast2/library/types/src/String.ycp Fri Jan 23 13:34:35 2009
@@ -196,6 +196,42 @@
}

/**
+ * Format an integer number as (at least) two digits; use leading zeroes if
+ * necessary.
+ * @param x input
+ * @return string number as two-digit string
+ **/
+string FormatTwoDigits( integer x )
+{
+ return x < 10 && x >= 0 ?
+ sformat( "0%1", x ) :
+ sformat( "%1", x );
+}
+
+
+/**
+ * Format an integer seconds value with min:sec or hours:min:sec
+ * @param seconds time (in seconds)
+ * @return string formatted string (empty for negative values)
+ **/
+global string FormatTime( integer seconds )
+{
+ if ( seconds < 0 )
+ return "";
+
+ if ( seconds < 3600 ) // Less than one hour
+ {
+ return sformat( "%1:%2", FormatTwoDigits( seconds / 60 ),
FormatTwoDigits( seconds % 60 ) );
+ }
+ else // More than one hour - we don't hope this will ever happen,
but who knows?
+ {
+ integer hours = seconds / 3600;
+ seconds = seconds % 3600;
+ return sformat( "%1:%2:%3", hours, FormatTwoDigits( seconds / 60 ),
FormatTwoDigits( seconds % 60 ) );
+ }
+}
+
+/**
* Remove blanks at begin and end of input string.
* @param input string to be stripped
* @return stripped string

Modified: trunk/yast2/package/yast2.changes
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=54938&r1=54937&r2=54938&view=diff
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Fri Jan 23 13:34:35 2009
@@ -1,4 +1,14 @@
-------------------------------------------------------------------
+Thu Jan 22 18:41:41 CET 2009 - lslezak@xxxxxxx
+
+- added String::FormatTime() for formatting time in seconds to
+ a printable string (HH:MM:SS or MM:SS format)
+- PackagesUI - added installation summary dialog (bnc#431854)
+- added PKGMGR_ACTION_AT_EXIT sysconfig variable for configuring
+ the default package manager behavior at exit
+- 2.18.1
+
+-------------------------------------------------------------------
Mon Jan 19 17:38:12 CET 2009 - lslezak@xxxxxxx

- URL.ycp - fixed parsing and building IPv6 URLs, testsuite update

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages