Author: lslezak
Date: Tue Jan 4 14:47:24 2011
New Revision: 63074
URL: http://svn.opensuse.org/viewcvs/yast?rev=63074&view=rev
Log:
- check PackageKit status, suggest to quit the daemon if it is
running (bnc#659522)
- 2.20.10
Added:
trunk/yast2/library/packages/src/PackageKit.ycp
Modified:
trunk/yast2/VERSION
trunk/yast2/library/packages/src/PackageLock.ycp
trunk/yast2/package/yast2.changes
Modified: trunk/yast2/VERSION
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/VERSION?rev=63074&r1=63073&r2=63074&view=diff
==============================================================================
--- trunk/yast2/VERSION (original)
+++ trunk/yast2/VERSION Tue Jan 4 14:47:24 2011
@@ -1 +1 @@
-2.20.9
+2.20.10
Added: trunk/yast2/library/packages/src/PackageKit.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackageKit.ycp?rev=63074&view=auto
==============================================================================
--- trunk/yast2/library/packages/src/PackageKit.ycp (added)
+++ trunk/yast2/library/packages/src/PackageKit.ycp Tue Jan 4 14:47:24 2011
@@ -0,0 +1,63 @@
+/**
+ * File: modules/PackageKit.ycp
+ * Package: yast2
+ * Summary: PackageKit access functions
+ * Authors: Ladislav Slezak
+ *
+ * $Id:$
+ *
+ * This is a wrrapper around PackageKit DBus interface.
+ */
+
+{
+ module "PackageKit";
+
+ /**
+ * Check whether PackageKit daemon is running
+ * @return boolean return true if PackageKit is currently running
+ */
+ global boolean IsRunning()
+ {
+ string cmd = "dbus-send --system --dest=org.freedesktop.DBus --type=method_call --print-reply "
+ + "--reply-timeout=200 / org.freedesktop.DBus.NameHasOwner string:org.freedesktop.PackageKit";
+ y2milestone("Checking PackageKit status: %1", cmd);
+
+ map out = (map)SCR::Execute(.target.bash_output, cmd);
+
+ boolean ret = false;
+ list<string> lines = splitstring(out["stdout"]:"", "\n");
+
+ foreach(string line, lines,
+ {
+ if (regexpmatch(line, "boolean.*true"))
+ {
+ ret = true;
+ }
+ }
+ );
+
+ y2milestone("PackageKit is running: %1", ret);
+
+ return ret;
+ }
+
+ /**
+ * Ask the PackageKit daemon to quit
+ * If a transaction is in progress the daemon will not quit,
+ * you have to check the current status using isRunning() function.
+ */
+ global void SuggestQuit()
+ {
+ string cmd = "dbus-send --system --dest=org.freedesktop.PackageKit --type=method_call "
+ + "/org/freedesktop/PackageKit org.freedesktop.PackageKit.SuggestDaemonQuit";
+ y2milestone("Asking PackageKit to quit: %1", cmd);
+
+ integer ret = (integer)SCR::Execute(.target.bash, cmd);
+
+ if (ret != 0)
+ {
+ y2error("dbus-send failed!");
+ }
+ }
+
+}
Modified: trunk/yast2/library/packages/src/PackageLock.ycp
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/library/packages/src/PackageLock.ycp?rev=63074&r1=63073&r2=63074&view=diff
==============================================================================
--- trunk/yast2/library/packages/src/PackageLock.ycp (original)
+++ trunk/yast2/library/packages/src/PackageLock.ycp Tue Jan 4 14:47:24 2011
@@ -16,9 +16,45 @@
import "Popup";
import "Label";
+import "PackageKit";
boolean have_lock = nil;
boolean aborted = false;
+// display a different message in the first PackageKit quit confirmation
+boolean packagekit_asked = false;
+
+/**
+ * Ask whether to quit PackageKit if it is running
+ * @return boolean true if PackageKit was asked to quit
+ */
+boolean AskPackageKit()
+{
+ boolean ret = false;
+
+ if (PackageKit::IsRunning())
+ {
+ // ask to send quit signal to PackageKit
+ string msg = packagekit_asked ?
+ _("PackageKit is still running (probably busy).
+Ask PackageKit to quit again?")
+ :
+ _("PackageKit is blocking software management.
+This happens when the updater applet or another software management
+application is running.
+
+Ask PackageKit to quit?");
+
+ packagekit_asked = true;
+
+ if (Popup::YesNo(msg))
+ {
+ PackageKit::SuggestQuit();
+ ret = true;
+ }
+ }
+
+ return ret;
+}
/**
* Tries to acquire the packager (zypp) lock.
@@ -40,6 +76,13 @@
if (have_lock == true) break;
if (have_lock != true) {
+ if (AskPackageKit())
+ {
+ // let the PackageKit quit before retrying
+ sleep(2000);
+ continue;
+ }
+
try_again = (Popup::AnyQuestion (
// TRANSLATORS: a popup headline
_("Accessing the Software Management Failed"),
@@ -83,6 +126,13 @@
if (have_lock == true) break;
if (have_lock != true) {
+ if (AskPackageKit())
+ {
+ // let the PackageKit quit before retrying
+ sleep(2000);
+ continue;
+ }
+
if (show_continue_button)
{
symbol ret = Popup::AnyQuestion3(
Modified: trunk/yast2/package/yast2.changes
URL: http://svn.opensuse.org/viewcvs/yast/trunk/yast2/package/yast2.changes?rev=63074&r1=63073&r2=63074&view=diff
==============================================================================
--- trunk/yast2/package/yast2.changes (original)
+++ trunk/yast2/package/yast2.changes Tue Jan 4 14:47:24 2011
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Tue Jan 4 13:42:54 UTC 2011 - lslezak@suse.cz
+
+- check PackageKit status, suggest to quit the daemon if it is
+ running (bnc#659522)
+- 2.20.10
+
+-------------------------------------------------------------------
Mon Jan 3 17:25:36 UTC 2011 - lslezak@suse.cz
- fixed VLAN config type detection (wrong regexp)
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org