[packagekit] packagekit: Branch 'master' - 6 commits

Richard Hughes hughsient at kemper.freedesktop.org
Thu Nov 22 15:40:48 PST 2007


 TODO                      |   13 +++++++------
 client/pk-console.c       |   19 +++++++++++++++++++
 libpackagekit/pk-common.c |    7 ++++++-
 src/pk-backend.c          |    2 +-
 src/pk-engine.c           |   10 +++++++++-
 5 files changed, 42 insertions(+), 9 deletions(-)

New commits:
commit 6349d59c3f4091af1d13d2f573cd6cf6dd48684f
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:50:40 2007 +0000

    Update TODO

diff --git a/TODO b/TODO
index 9ae3f1b..3f3628d 100644
--- a/TODO
+++ b/TODO
@@ -14,9 +14,13 @@ Have different permissions for signed and unsigned repos.
 
 *** Handle rollbacks for select backends ***
 To do rollbacks sanely in PK we need a few things:
- * allow transaction data to be changed in _db
+ - allow transaction data to be changed in _db
 
 *** Make resolve easier to use ***
 resolve in pkcon has to check for installed package already - and not
 display a cryptic message when already installed
 
+*** Don't display install if something is upgradable
+ - Return update when we search for something that is installed, but an
+   update exists for
+
commit a0aee98390317836b77a9fcb8682f72e7f622ffe
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:49:35 2007 +0000

    Update TODO

diff --git a/TODO b/TODO
index d286490..9ae3f1b 100644
--- a/TODO
+++ b/TODO
@@ -1,13 +1,10 @@
 Order of no particular importance:
 
-*** Make the daemon aware on how long between updates ***
-Requires writing to a database for config stuff
- - Probably should move the job number stuff there too
-Use this in the update icon
+*** write to the database for config stuff
+ - Probably should move the job number too
 
 *** package->status ***
 Convert the backends to send more status calls.
-Add a depsolve status enum.
 
 *** Add a way to import GPG keys ***
 In fedora, if you add a signed repo you have to agree to the GPG key.
commit b917aea9aaf1ff9d2d2535d04fc7c82248620d4c
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:48:21 2007 +0000

    add functionality into pkcon to get the time since something was checked

diff --git a/client/pk-console.c b/client/pk-console.c
index 8bb1694..eff8db2 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -789,6 +789,25 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
 		if (value == NULL) {
 			g_set_error (error, 0, 0, "you need to specify a get type");
 			return FALSE;
+		} else if (strcmp (value, "time") == 0) {
+			PkRoleEnum role;
+			guint time;
+			gboolean ret;
+			if (details == NULL) {
+				g_set_error (error, 0, 0, "you need to specify a search term");
+				return FALSE;
+			}
+			role = pk_role_enum_from_text (details);
+			if (role == PK_ROLE_ENUM_UNKNOWN) {
+				g_set_error (error, 0, 0, "you need to specify a correct role");
+				return FALSE;
+			}
+			ret = pk_client_get_time_since_action (client, role, &time);
+			if (ret == FALSE) {
+				g_set_error (error, 0, 0, "failed to get last time");
+				return FALSE;
+			}
+			g_print ("time since %s is %is\n", details, time);
 		} else if (strcmp (value, "depends") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, "you need to specify a search term");
commit 434a16c7c1b8af0e17514040fa4b1903289e3744
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:47:38 2007 +0000

    plumb in the action time stuff into the daemon

diff --git a/src/pk-engine.c b/src/pk-engine.c
index 91f339f..e94e2ba 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -627,6 +627,11 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
 	pk_debug ("backend was running for %i ms", time);
 	pk_transaction_db_set_finished (engine->priv->transaction_db, item->tid, TRUE, time);
 
+	/* only reset the time if we succeeded */
+	if (exit == PK_EXIT_ENUM_SUCCESS) {
+		pk_transaction_db_action_time_reset (engine->priv->transaction_db, role);
+	}
+
 	exit_text = pk_exit_enum_to_text (exit);
 	pk_debug ("emitting finished transaction:%s, '%s', %i", item->tid, exit_text, time);
 	g_signal_emit (engine, signals [PK_ENGINE_FINISHED], 0, item->tid, exit_text, time);
@@ -2668,10 +2673,13 @@ gboolean
 pk_engine_get_time_since_action	(PkEngine *engine, const gchar *role_text, guint *seconds, GError **error)
 {
 	PkRoleEnum role;
+
 	g_return_val_if_fail (engine != NULL, FALSE);
 	g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
+
 	role = pk_role_enum_from_text (role_text);
-	*seconds = 0;
+	*seconds = pk_transaction_db_action_time_since (engine->priv->transaction_db, role);
+
 	return TRUE;
 }
 
commit 40c03a5b4d115e4d948c65f2eb5a13f3a5a1e25f
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:47:06 2007 +0000

    decrease the verbosity of a client disconnecting

diff --git a/src/pk-backend.c b/src/pk-backend.c
index 1d87787..b700469 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1897,7 +1897,7 @@ pk_backend_is_caller_active (PkBackend *backend, gboolean *is_active)
 static void
 pk_backend_connection_changed_cb (LibGBus *libgbus, gboolean connected, PkBackend *backend)
 {
-	pk_warning ("client disconnected.... %i", connected);
+	pk_debug ("client disconnected.... %i", connected);
 	g_signal_emit (backend, signals [PK_BACKEND_CALLER_ACTIVE_CHANGED], 0, FALSE);
 }
 
commit ea59505532c8a56d6ca5aa092d892c930cfd77f3
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Nov 22 18:46:24 2007 +0000

    check if we can correctly parse the date, and return zero if not

diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 76f9c8c..537658f 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -111,6 +111,7 @@ pk_iso8601_difference (const gchar *isodate)
 {
 	GTimeVal timeval_then;
 	GTimeVal timeval_now;
+	gboolean ret;
 	guint time;
 
 	if (pk_strzero (isodate) == TRUE) {
@@ -118,7 +119,11 @@ pk_iso8601_difference (const gchar *isodate)
 	}
 
 	/* convert date */
-	g_time_val_from_iso8601 (isodate, &timeval_then);
+	ret = g_time_val_from_iso8601 (isodate, &timeval_then);
+	if (ret == FALSE) {
+		pk_warning ("failed to parse '%s'", isodate);
+		return 0;
+	}
 	g_get_current_time (&timeval_now);
 
 	/* work out difference */



More information about the PackageKit mailing list