[PackageKit-commit] packagekit: Branch 'master' - 18 commits

Richard Hughes hughsient at kemper.freedesktop.org
Wed Jan 14 06:37:03 PST 2009


 RELEASE                                   |   16 ++---
 backends/yum/yumBackend.py                |   13 +++-
 configure.ac                              |    3 -
 contrib/Makefile.am                       |    2 
 contrib/PackageKit.spec.in                |   25 +-------
 contrib/udev/.gitignore                   |    3 -
 contrib/udev/51-packagekit-firmware.rules |    5 -
 contrib/udev/Makefile.am                  |   12 ----
 contrib/udev/README                       |   27 ---------
 contrib/udev/packagekit-firmware.sh       |   20 ------
 docs/api/spec/pk-concepts.xml             |    2 
 etc/PackageKit.conf.in                    |    9 +++
 lib/packagekit-glib/pk-enum.c             |    1 
 lib/packagekit-glib/pk-enum.h             |    1 
 src/pk-backend.c                          |   22 ++++++-
 src/pk-main.c                             |    3 -
 src/pk-network.c                          |   23 ++-----
 src/pk-transaction-list.c                 |    5 +
 src/pk-transaction.c                      |   90 +++++++++++++++---------------
 19 files changed, 114 insertions(+), 168 deletions(-)

New commits:
commit e085026ca44b3e80dce3c4ea63670aa2c5175a8b
Merge: 3a9e7f1... 6d28550...
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jan 14 14:36:07 2009 +0000

    Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit

commit 3a9e7f172ff92181849ab003ff0f7c453851f289
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Jan 14 14:34:46 2009 +0000

    trivial: add the tid to the transaction list debugging ouput to try to chase a bug

diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index ed43baf..2abceef 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -539,8 +539,9 @@ pk_transaction_list_print (PkTransactionList *tlist)
 	for (i=0; i<length; i++) {
 		item = (PkTransactionItem *) g_ptr_array_index (tlist->priv->array, i);
 		role = pk_transaction_priv_get_role (item->transaction);
-		g_print ("%0i\t%s\trunning[%i] committed[%i] finished[%i]\n", i,
-			 pk_role_enum_to_text (role), item->running, item->committed, item->finished);
+		g_print ("%0i\t%s\t%s\trunning[%i] committed[%i] finished[%i]\n", i,
+			 pk_role_enum_to_text (role), item->tid, item->running,
+			 item->committed, item->finished);
 	}
 }
 
commit 6d28550e0d01ad30a531591cab7d218c70a7ebf4
Merge: 7509db2... 98f278d...
Author: Trever Fischer <wm161 at wm161.net>
Date:   Tue Jan 13 11:30:09 2009 -0500

    Merge branch 'master' of git+ssh://tdfischer@git.packagekit.org/srv/git/PackageKit

commit 7509db218c4d51402162d4618440ece14cba0398
Author: Trever Fischer <wm161 at wm161.net>
Date:   Tue Jan 13 11:29:29 2009 -0500

    yum: Fixed a bug that prevents installing a local file that isn't in the repos

diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 787944d..40cb762 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1402,8 +1402,11 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
             self.error(ERROR_PACKAGE_ALREADY_INSTALLED, "The packages failed to be installed")
 
     def _checkForNewer(self, po):
+	pkgs = None
         try:
             pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
+        except yum.Errors.PackageSackError:
+            pass
         except Exception, e:
             self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
         if pkgs:
commit 98f278d4797cf8ff0c502ff209abf6baa8cfd15e
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 14:14:11 2009 +0000

    feature: remove the udev helper from PackageKit now the core functionality is in udev itself

diff --git a/configure.ac b/configure.ac
index acffdd4..15e171e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -645,7 +645,6 @@ contrib/Makefile
 contrib/browser-plugin/Makefile
 contrib/gstreamer-plugin/Makefile
 contrib/gtk-module/Makefile
-contrib/udev/Makefile
 contrib/yum-packagekit/Makefile
 contrib/command-not-found/Makefile
 contrib/ruck/Makefile
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 7561851..4e47d70 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = udev
+SUBDIRS =
 
 if BACKEND_TYPE_YUM
 SUBDIRS += yum-packagekit
diff --git a/contrib/PackageKit.spec.in b/contrib/PackageKit.spec.in
index 1dcfa8e..f9f9b8c 100644
--- a/contrib/PackageKit.spec.in
+++ b/contrib/PackageKit.spec.in
@@ -19,7 +19,6 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires: dbus >= %{dbus_version}
 Requires: dbus-glib >= %{dbus_glib_version}
 Requires: PackageKit-glib = %{version}-%{release}
-Requires: PackageKit-udev-helper = %{version}-%{release}
 Requires: PackageKit-gtk-module = %{version}-%{release}
 Requires: PackageKit-yum-plugin = %{version}-%{release}
 Requires: PackageKit-yum = %{version}-%{release}
@@ -54,6 +53,10 @@ BuildRequires: cppunit-devel
 BuildRequires: pango-devel
 BuildRequires: fontconfig-devel
 
+# functionality moved to udev itself
+Obsoletes: PackageKit-udev-helper < %{version}-%{release}
+Obsoletes: udev-packagekit < %{version}-%{release}
+
 %description
 PackageKit is a D-Bus abstraction layer that allows the session user
 to manage packages in a secure way using a cross-distro,
@@ -85,18 +88,6 @@ Requires: %{name} = %{version}-%{release}
 %description docs
 API docs for PackageKit.
 
-%package udev-helper
-Summary: Tell PackageKit to install firmware that udev requires
-Group: System Environment/Base
-Requires: udev
-Requires: PackageKit
-Obsoletes: udev-packagekit < %{version}-%{release}
-
-%description udev-helper
-PackageKit-udev-helper tells PackageKit that firmware was not available and was
-needed. This allows PackageKit to do the right thing and prompt for
-the firmware to be installed.
-
 %package yum-plugin
 Summary: Tell PackageKit to check for updates when yum exits
 Group: System Environment/Base
@@ -346,14 +337,6 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
 %config(noreplace) %{_sysconfdir}/yum/pluginconf.d/refresh-packagekit.conf
 /usr/lib/yum-plugins/refresh-packagekit.*
 
-%files udev-helper
-%defattr(-, root, root)
-%dir %{_localstatedir}/run/PackageKit
-%dir %{_localstatedir}/run/PackageKit/udev
-%doc README AUTHORS NEWS COPYING
-%{_sysconfdir}/udev/rules.d/*.rules
-/lib/udev/*.sh
-
 %files glib
 %defattr(-,root,root,-)
 %doc README AUTHORS NEWS COPYING
diff --git a/contrib/udev/.gitignore b/contrib/udev/.gitignore
deleted file mode 100644
index 22a4e72..0000000
--- a/contrib/udev/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-Makefile
-Makefile.in
-
diff --git a/contrib/udev/51-packagekit-firmware.rules b/contrib/udev/51-packagekit-firmware.rules
deleted file mode 100644
index d14badb..0000000
--- a/contrib/udev/51-packagekit-firmware.rules
+++ /dev/null
@@ -1,5 +0,0 @@
-# do not edit this file, it will be overwritten on update
-
-# firmware class requests
-SUBSYSTEM=="firmware", ACTION=="add", RUN+="packagekit-firmware.sh"
-
diff --git a/contrib/udev/Makefile.am b/contrib/udev/Makefile.am
deleted file mode 100644
index 3bf7632..0000000
--- a/contrib/udev/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-udevrulesdir = ${SYSCONFDIR}/udev/rules.d
-dist_udevrules_DATA = 51-packagekit-firmware.rules
-
-install-data-hook:
-	if test -w $(DESTDIR)/; then \
-		mkdir -p $(DESTDIR)/var/run/PackageKit/udev; \
-		mkdir -p $(DESTDIR)/lib/udev; \
-		cp $(top_srcdir)/contrib/udev/packagekit-firmware.sh $(DESTDIR)/lib/udev; \
-	fi
-
-EXTRA_DIST = packagekit-firmware.sh
-
diff --git a/contrib/udev/README b/contrib/udev/README
deleted file mode 100644
index 766ecbd..0000000
--- a/contrib/udev/README
+++ /dev/null
@@ -1,27 +0,0 @@
-README:
-
-PackageKit installs missing firmware as it requested by udev: this is how
-the whole system is designed to work.
-
-Introduction:
-
- 1. user plugs in hardware / boots computer
- 2. udev gets the firmware request uevent
- 3. 51-packagekit-firmware.rules udev rule gets matched, this executes
-    packagekit-firmware.sh
- 4. This script searches for the firmware file, and if not found, creates a
-    file in /var/run/PackageKit/udev with a random name (e.g. firmware-a1abc1de3),
-    and echos the filename of the firmware into it
- 5. Either the session tools are started by the user logging in, or there is an
-    inotify watch on this directory -- this prompts the session software to try
-    and find an installable package, and if so install it.
-    The session tools ignore any duplicate entries or files they searched for before.
- 6. Every time a RefreshCache() method is called, the contents of
-    /var/run/PackageKit/udev are deleted -- this can also be cleared on shutdown
-    by editing the distro scripts if desired
-
-Notes:
-
- * We create the random file name so that we do not overwrite an existing
-   firmware request as these rules could be run in parallel.
-
diff --git a/contrib/udev/packagekit-firmware.sh b/contrib/udev/packagekit-firmware.sh
deleted file mode 100755
index 14c3001..0000000
--- a/contrib/udev/packagekit-firmware.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh -e
-#
-# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
-#
-# Licensed under the GNU General Public License Version 2
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-
-FIRMWARE_DIR="/lib/firmware"
-
-if [ ! -e "$FIRMWARE_DIR/$FIRMWARE" ]; then
-	# we've need firmware that doesn't exist
-	fn=`mktemp -u -p /var/run/PackageKit/udev firmware-XXXXXXXX`
-	echo "$FIRMWARE_DIR/$FIRMWARE" > $fn
-fi
-
-exit 0
-
commit 5d5d2864812dd115880d17f6cc34577999af3869
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 13:07:54 2009 +0000

    feature: add an entry to the config file to turn on time estimation, and enable it by default

diff --git a/etc/PackageKit.conf.in b/etc/PackageKit.conf.in
index 56c8836..bc0bea2 100644
--- a/etc/PackageKit.conf.in
+++ b/etc/PackageKit.conf.in
@@ -20,6 +20,15 @@ UseNetworkManager=true
 # default=true
 UseNetworkHeuristic=true
 
+# If we should use the estimated time value.
+# This will be inaccurate where backends do not send proportional percentage
+# changed signals, or when updates are not frequent enough.
+# Estimated time will then only be used when the prediction accuracy is high
+# enough and will not be set at the very start or end of a transaction.
+#
+# default=true
+UseRemainingTimeEstimation=true
+
 # Shut down the daemon after this many seconds idle. 0 means don't shutdown.
 #
 # default=300
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 2f86439..36e5a06 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -36,6 +36,7 @@
 #include "egg-debug.h"
 #include "egg-string.h"
 
+#include "pk-conf.h"
 #include "pk-network.h"
 #include "pk-marshal.h"
 #include "pk-backend-internal.h"
@@ -88,6 +89,7 @@ struct _PkBackendPrivate
 	gboolean		 set_signature;
 	gboolean		 set_eula;
 	gboolean		 has_sent_package;
+	gboolean		 use_time;
 	PkNetwork		*network;
 	PkStore			*store;
 	PkPackageObj		*last_package;
@@ -652,10 +654,9 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
 		remaining = pk_time_get_remaining (backend->priv->time);
 		egg_debug ("this will now take ~%i seconds", remaining);
 
-#ifdef PK_IS_DEVELOPER
-		/* Until the predicted time is more sane... */
-		backend->priv->last_remaining = remaining;
-#endif
+		/* value cached from config file */
+		if (backend->priv->use_time)
+			backend->priv->last_remaining = remaining;
 	}
 
 	/* emit the progress changed signal */
@@ -1874,6 +1875,8 @@ pk_backend_reset (PkBackend *backend)
 static void
 pk_backend_init (PkBackend *backend)
 {
+	PkConf *conf;
+
 	backend->priv = PK_BACKEND_GET_PRIVATE (backend);
 	backend->priv->handle = NULL;
 	backend->priv->name = NULL;
@@ -1898,6 +1901,11 @@ pk_backend_init (PkBackend *backend)
 	g_signal_connect (backend->priv->file_monitor, "file-changed",
 			  G_CALLBACK (pk_backend_file_monitor_changed_cb), backend);
 
+	/* do we use time estimation? */
+	conf = pk_conf_new ();
+	backend->priv->use_time = pk_conf_get_bool (conf, "UseRemainingTimeEstimation");
+	g_object_unref (conf);
+
 	pk_backend_reset (backend);
 }
 
commit 7ce7945244a8897d0cb384b4c3676703fd79bb31
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 12:35:45 2009 +0000

    trivial: update the docs with waiting-for-lock

diff --git a/docs/api/spec/pk-concepts.xml b/docs/api/spec/pk-concepts.xml
index 9c44d61..23e0e94 100644
--- a/docs/api/spec/pk-concepts.xml
+++ b/docs/api/spec/pk-concepts.xml
@@ -937,7 +937,7 @@
     <para>
       If the transaction is waiting for a package lock (when a legacy tool like
       <literal>pirut</literal> is loaded and has the <literal>yum</literal> lock)
-      then the transaction will be stuck at <literal>PK_STATUS_ENUM_SETUP</literal>.
+      then the transaction will be stuck at <literal>PK_STATUS_ENUM_WAITING_FOR_LOCK</literal>.
     </para>
     <para>
       As a backend writer, you do not have to set <literal>PK_STATUS_ENUM_RUNNING</literal>
commit 471e520b93fb707b585502a3639ff2080c36ee9a
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 12:00:58 2009 +0000

    trivial: add a waiting-for-lock status enum and use it in the yum backend

diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index a65bfb3..787944d 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -280,6 +280,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
                 self.allow_cancel(False)
             except yum.Errors.LockError, e:
                 self.allow_cancel(True)
+                self.status(STATUS_WAITING_FOR_LOCK)
                 time.sleep(2)
                 retries += 1
                 if retries > 100:
diff --git a/lib/packagekit-glib/pk-enum.c b/lib/packagekit-glib/pk-enum.c
index 3e99948..717c80f 100644
--- a/lib/packagekit-glib/pk-enum.c
+++ b/lib/packagekit-glib/pk-enum.c
@@ -83,6 +83,7 @@ static const PkEnumMatch enum_status[] = {
 	{PK_STATUS_ENUM_LOADING_CACHE,		"loading-cache"},
 	{PK_STATUS_ENUM_SCAN_APPLICATIONS,	"scan-applications"},
 	{PK_STATUS_ENUM_GENERATE_PACKAGE_LIST,	"generate-package-list"},
+	{PK_STATUS_ENUM_WAITING_FOR_LOCK,	"waiting-for-lock"},
 	{0, NULL}
 };
 
diff --git a/lib/packagekit-glib/pk-enum.h b/lib/packagekit-glib/pk-enum.h
index ac22d07..f42dead 100644
--- a/lib/packagekit-glib/pk-enum.h
+++ b/lib/packagekit-glib/pk-enum.h
@@ -134,6 +134,7 @@ typedef enum {
 	PK_STATUS_ENUM_LOADING_CACHE,
 	PK_STATUS_ENUM_SCAN_APPLICATIONS,
 	PK_STATUS_ENUM_GENERATE_PACKAGE_LIST,
+	PK_STATUS_ENUM_WAITING_FOR_LOCK,
 	PK_STATUS_ENUM_UNKNOWN
 } PkStatusEnum;
 
commit 74b36894d1d07a8174c9c39d46b1e757f5592397
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:49:44 2009 +0000

    bugfix: don't emit allow-cancel over and over if it is the same state as before

diff --git a/src/pk-backend.c b/src/pk-backend.c
index 7119428..2f86439 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1337,6 +1337,12 @@ pk_backend_set_allow_cancel (PkBackend *backend, gboolean allow_cancel)
 		return FALSE;
 	}
 
+	/* same as last state? */
+	if (backend->priv->allow_cancel == allow_cancel) {
+		egg_debug ("ignoring same allow-cancel state");
+		return TRUE;
+	}
+
 	/* can we do the action? */
 	if (backend->desc->cancel != NULL) {
 		backend->priv->allow_cancel = allow_cancel;
commit 20adf34268acc6ea97ec86c03115fd22f778fcb4
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:41:51 2009 +0000

    yum: set the allow cancel flags when we are waiting for yum to release its lock

diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 0a7ec1a..a65bfb3 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -277,7 +277,9 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
             try: # Try to lock yum
                 self.yumbase.doLock(YUM_PID_FILE)
                 PackageKitBaseBackend.doLock(self)
+                self.allow_cancel(False)
             except yum.Errors.LockError, e:
+                self.allow_cancel(True)
                 time.sleep(2)
                 retries += 1
                 if retries > 100:
commit 5892607e43e5f2d46a018de0e17ae7378d58c080
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:41:22 2009 +0000

    yum: get the yum lock before we start setting up comps and doing other access that could block

diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 267bbdb..0a7ec1a 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -184,6 +184,11 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
         signal.signal(signal.SIGQUIT, sigquit)
         PackageKitBaseBackend.__init__(self, args)
         self.yumbase = PackageKitYumBase(self)
+
+        # get the lock early
+        if lock:
+            self.doLock()
+
         self.package_summary_cache = {}
         self.percentage_old = 0
         self.sub_percentage_old = 0
@@ -200,8 +205,6 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
         # this is global so we can catch sigquit and closedown
         yumbase = self.yumbase
         self._setup_yum()
-        if lock:
-            self.doLock()
 
     def percentage(self, percent=None):
         '''
commit 6724383b66cf4010e4c2f992c8d2cfdb104df018
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:40:35 2009 +0000

    bugfix: set the setup signal after we've connected the backend to the transaction so it is emitted for clients

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index b2a2301..d99a4d1 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -997,9 +997,6 @@ pk_transaction_set_running (PkTransaction *transaction)
 	/* set the role */
 	pk_backend_set_role (priv->backend, priv->role);
 
-	/* we are no longer waiting, we are setting up */
-	pk_backend_set_status (priv->backend, PK_STATUS_ENUM_SETUP);
-
 	/* connect up the signals */
 	transaction->priv->signal_allow_cancel =
 		g_signal_connect (transaction->priv->backend, "allow-cancel",
@@ -1055,6 +1052,9 @@ pk_transaction_set_running (PkTransaction *transaction)
 	transaction->priv->has_been_run = TRUE;
 	transaction->priv->allow_cancel = FALSE;
 
+	/* we are no longer waiting, we are setting up */
+	pk_backend_set_status (priv->backend, PK_STATUS_ENUM_SETUP);
+
 	/* set all possible arguments for backend */
 	store = pk_backend_get_store (priv->backend);
 	pk_store_set_bool (store, "force", priv->cached_force);
commit 549135dff799818f75e3dd16915e2aea1f0dbc7a
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:31:35 2009 +0000

    bugfix: don't leak directory on commit-failed error path

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 015ef48..b2a2301 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1645,7 +1645,7 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 	gboolean ret;
 	GError *error;
 	gchar *package_ids_temp;
-	gchar *directory;
+	gchar *directory = NULL;
 	gint retval;
 
 	g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -1659,7 +1659,7 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 				     "DownloadPackages not yet supported by backend");
 		pk_transaction_release_tid (transaction);
 		pk_transaction_dbus_return_error (context, error);
-		return;
+		goto out;
 	}
 
 	/* check if the sender is the same */
@@ -1667,7 +1667,7 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 	if (!ret) {
 		/* don't release tid */
 		pk_transaction_dbus_return_error (context, error);
-		return;
+		goto out;
 	}
 
 	/* check package_ids */
@@ -1678,7 +1678,7 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 				     "The package id's '%s' are not valid", package_ids_temp);
 		g_free (package_ids_temp);
 		pk_transaction_dbus_return_error (context, error);
-		return;
+		goto out;
 	}
 
 	/* create cache directory */
@@ -1690,7 +1690,7 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_DENIED,
 				     "cannot create %s", directory);
 		pk_transaction_dbus_return_error (context, error);
-		return;
+		goto out;
 	}
 
 	/* save so we can run later */
@@ -1704,12 +1704,14 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
 				     "Could not commit to a transaction object");
 		pk_transaction_release_tid (transaction);
-		return;
+		pk_transaction_dbus_return_error (context, error);
+		goto out;
 	}
 
-	g_free (directory);
 	/* return from async with success */
 	pk_transaction_dbus_return (context);
+out:
+	g_free (directory);
 }
 
 /**
commit 6094c895fc1ae935680843b4413ce11ae3ce7e77
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 11:29:27 2009 +0000

    trivial: whitespace fixes

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 1cad502..015ef48 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1550,10 +1550,10 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
 
 	/* not implemented yet */
 	if (transaction->priv->backend->desc->cancel == NULL) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
-	                             "Cancel not yet supported by backend");
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+				     "Cancel not yet supported by backend");
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* if it's finished, cancelling will have no action regardless of uid */
@@ -1564,25 +1564,25 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
 
 	/* check to see if we have an action */
 	if (transaction->priv->role == PK_ROLE_ENUM_UNKNOWN) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NO_ROLE, "No role");
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NO_ROLE, "No role");
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* check if it's safe to kill */
 	if (!transaction->priv->allow_cancel) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_CANNOT_CANCEL,
-	                             "Tried to cancel a transaction that is not safe to kill");
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_CANNOT_CANCEL,
+				     "Tried to cancel a transaction that is not safe to kill");
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* check if we saved the uid */
 	if (transaction->priv->uid == PK_SECURITY_UID_INVALID) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_CANNOT_CANCEL,
-	                             "No context from caller to get UID from");
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_CANNOT_CANCEL,
+				     "No context from caller to get UID from");
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* get the UID of the caller */
@@ -1594,9 +1594,9 @@ pk_transaction_cancel (PkTransaction *transaction, DBusGMethodInvocation *contex
 
 	/* check we got a valid value */
 	if (uid == PK_SECURITY_UID_INVALID) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_STATE, "unable to get uid of caller");
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_INVALID_STATE, "unable to get uid of caller");
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* check the caller uid with the originator uid */
@@ -1655,11 +1655,11 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 
 	/* not implemented yet */
 	if (transaction->priv->backend->desc->download_packages == NULL) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
-	                             "DownloadPackages not yet supported by backend");
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_NOT_SUPPORTED,
+				     "DownloadPackages not yet supported by backend");
 		pk_transaction_release_tid (transaction);
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* check if the sender is the same */
@@ -1673,12 +1673,12 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 	/* check package_ids */
 	ret = pk_package_ids_check (package_ids);
 	if (!ret) {
-	        package_ids_temp = pk_package_ids_to_text (package_ids);
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
-	                             "The package id's '%s' are not valid", package_ids_temp);
-	        g_free (package_ids_temp);
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		package_ids_temp = pk_package_ids_to_text (package_ids);
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID,
+				     "The package id's '%s' are not valid", package_ids_temp);
+		g_free (package_ids_temp);
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* create cache directory */
@@ -1687,10 +1687,10 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 	/* rwxrwxr-x */
 	retval = g_mkdir (directory, 0775);
 	if (retval != 0) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_DENIED,
-	                             "cannot create %s", directory);
-	        pk_transaction_dbus_return_error (context, error);
-	        return;
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_DENIED,
+				     "cannot create %s", directory);
+		pk_transaction_dbus_return_error (context, error);
+		return;
 	}
 
 	/* save so we can run later */
@@ -1701,10 +1701,10 @@ pk_transaction_download_packages (PkTransaction *transaction, gchar **package_id
 	/* try to commit this */
 	ret = pk_transaction_commit (transaction);
 	if (!ret) {
-	        error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
-	                             "Could not commit to a transaction object");
+		error = g_error_new (PK_TRANSACTION_ERROR, PK_TRANSACTION_ERROR_COMMIT_FAILED,
+				     "Could not commit to a transaction object");
 		pk_transaction_release_tid (transaction);
-	        return;
+		return;
 	}
 
 	g_free (directory);
@@ -2864,8 +2864,8 @@ pk_transaction_refresh_cache (PkTransaction *transaction, gboolean force, DBusGM
  **/
 void
 pk_transaction_remove_packages (PkTransaction *transaction, gchar **package_ids,
-			        gboolean allow_deps, gboolean autoremove,
-			        DBusGMethodInvocation *context)
+				gboolean allow_deps, gboolean autoremove,
+				DBusGMethodInvocation *context)
 {
 	gboolean ret;
 	GError *error;
@@ -3009,7 +3009,7 @@ pk_transaction_repo_enable (PkTransaction *transaction, const gchar *repo_id, gb
 void
 pk_transaction_repo_set_data (PkTransaction *transaction, const gchar *repo_id,
 			      const gchar *parameter, const gchar *value,
-		              DBusGMethodInvocation *context)
+			      DBusGMethodInvocation *context)
 {
 	gboolean ret;
 	GError *error;
commit 68a7a7428bfeface8e222cbe24734db826d9449f
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 10:10:54 2009 +0000

    trivial: don't re-timeout if we are in the process of quitting

diff --git a/src/pk-main.c b/src/pk-main.c
index 9212a23..b6a3a5b 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -136,6 +136,7 @@ pk_main_timeout_check_cb (PkEngine *engine)
 	if (idle > exit_idle_time) {
 		egg_warning ("exit!!");
 		g_main_loop_quit (loop);
+		return FALSE;
 	}
 	return TRUE;
 }
commit b057eff7688d030cda86be989054b0ba29f6c069
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 10:09:10 2009 +0000

    bugfix: ensure we send the correct network state with the new changed codepath

diff --git a/src/pk-network.c b/src/pk-network.c
index 7a1caf5..fc1771f 100644
--- a/src/pk-network.c
+++ b/src/pk-network.c
@@ -91,12 +91,10 @@ pk_network_get_network_state (PkNetwork *network)
 {
 	g_return_val_if_fail (PK_IS_NETWORK (network), PK_NETWORK_ENUM_UNKNOWN);
 	/* use the correct backend */
-	if (network->priv->use_nm) {
+	if (network->priv->use_nm)
 		return pk_network_nm_get_network_state (network->priv->net_nm);
-	}
-	if (network->priv->use_unix) {
+	if (network->priv->use_unix)
 		return pk_network_unix_get_network_state (network->priv->net_unix);
-	}
 	return PK_NETWORK_ENUM_ONLINE;
 }
 
@@ -106,16 +104,12 @@ pk_network_get_network_state (PkNetwork *network)
 static void
 pk_network_nm_network_changed_cb (PkNetworkNm *net_nm, gboolean online, PkNetwork *network)
 {
-	PkNetworkEnum ret;
+	PkNetworkEnum state;
+
 	g_return_if_fail (PK_IS_NETWORK (network));
-	if (network->priv->use_nm) {
-		if (online) {
-			ret = PK_NETWORK_ENUM_ONLINE;
-		} else {
-			ret = PK_NETWORK_ENUM_OFFLINE;
-		}
-		g_signal_emit (network, signals [PK_NETWORK_STATE_CHANGED], 0, ret);
-	}
+
+	state = pk_network_get_network_state (network);
+	g_signal_emit (network, signals [PK_NETWORK_STATE_CHANGED], 0, state);
 }
 
 /**
@@ -125,9 +119,8 @@ static void
 pk_network_unix_network_changed_cb (PkNetworkUnix *net_unix, gboolean online, PkNetwork *network)
 {
 	g_return_if_fail (PK_IS_NETWORK (network));
-	if (network->priv->use_unix) {
+	if (network->priv->use_unix)
 		g_signal_emit (network, signals [PK_NETWORK_STATE_CHANGED], 0, online);
-	}
 }
 
 /**
commit 0974d29e7b29c088006798d91be63ef384f10911
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Jan 13 10:06:29 2009 +0000

    bugfix: ensure we call the backend finalise method when the daemon times out

diff --git a/src/pk-main.c b/src/pk-main.c
index 68a1e3d..9212a23 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -135,7 +135,7 @@ pk_main_timeout_check_cb (PkEngine *engine)
 	egg_debug ("idle is %i", idle);
 	if (idle > exit_idle_time) {
 		egg_warning ("exit!!");
-		exit (0);
+		g_main_loop_quit (loop);
 	}
 	return TRUE;
 }
commit 96727db42f4f5ed6929b5e7fa25d66625819c7da
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Jan 8 17:07:58 2009 +0000

    trivial: post release version bump

diff --git a/RELEASE b/RELEASE
index 6e8e5d0..36f6f13 100644
--- a/RELEASE
+++ b/RELEASE
@@ -3,8 +3,8 @@ PackageKit Release Notes
 1. Write NEWS entries for PackageKit and gnome-packagekit in the same
    format as usual. Ignore any trivial commits.
 
-git-shortlog PACKAGEKIT_0_4_0.. | grep -v trivial | grep -v Merge > NEWS.new
-git-shortlog GNOME_PACKAGEKIT_0_4_0.. | grep -v trivial | grep -v Merge > NEWS.new
+git-shortlog PACKAGEKIT_0_4_1.. | grep -v trivial | grep -v Merge > NEWS.new
+git-shortlog GNOME_PACKAGEKIT_0_4_1.. | grep -v trivial | grep -v Merge > NEWS.new
 
 2. Add download date to docs/html/pk-download.html, save file.
 
@@ -12,8 +12,8 @@ git-shortlog GNOME_PACKAGEKIT_0_4_0.. | grep -v trivial | grep -v Merge > NEWS.n
 
 4. Commit changes in PackageKit git:
 
-git commit -a -m "Release version 0.4.1"
-git tag -a -f -m "Release 0.4.1" PACKAGEKIT_0_4_1
+git commit -a -m "Release version 0.4.2"
+git tag -a -f -m "Release 0.4.2" PACKAGEKIT_0_4_2
 git push --tags
 git push
 git push git+ssh://hughsient@git.freedesktop.org/git/packagekit
@@ -21,8 +21,8 @@ git push --tags git+ssh://hughsient@git.freedesktop.org/git/packagekit
 
 5. Commit changes in gnome-packagekit git:
 
-git commit -a -m "Release version 0.4.1"
-git-tag GNOME_PACKAGEKIT_0_4_1
+git commit -a -m "Release version 0.4.2"
+git-tag GNOME_PACKAGEKIT_0_4_2
 git push --tags
 git push
 
@@ -44,9 +44,9 @@ git push
 11. Send an email to packagekit at lists.freedesktop.org
 
 =================================================
-Subject: PackageKit and gnome-packagekit 0.4.1 released!
+Subject: PackageKit and gnome-packagekit 0.4.2 released!
 
-Today I released PackageKit and gnome-packagekit 0.4.1.
+Today I released PackageKit and gnome-packagekit 0.4.2.
 
 PackageKit release notes: http://cgit.freedesktop.org/packagekit/tree/NEWS
 
diff --git a/configure.ac b/configure.ac
index 84a95c3..acffdd4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,6 @@
 AC_PREREQ(2.52)
 
-AC_INIT(PackageKit, 0.4.1)
+AC_INIT(PackageKit, 0.4.2)
 AC_CONFIG_SRCDIR(src)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 AM_CONFIG_HEADER(config.h)


More information about the PackageKit-commit mailing list