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

Richard Hughes hughsient at kemper.freedesktop.org
Wed Apr 9 14:35:13 PDT 2008


 backends/zypp/pk-backend-zypp.cpp |   40 +--
 backends/zypp/zypp-utils.cpp      |    2 
 client/pk-console.c               |  427 ++++++++++++++++++++++----------------
 configure.ac                      |    2 
 contrib/pk-completion.bash        |    4 
 docs/api/Makefile.am              |    2 
 libpackagekit/pk-client.c         |    2 
 libpackagekit/pk-debug.c          |    9 
 libpackagekit/pk-enum.c           |    1 
 libpackagekit/pk-enum.h           |    1 
 libpackagekit/pk-task-list.c      |   33 ++
 src/pk-transaction-list.c         |    7 
 src/pk-transaction.c              |   36 +--
 13 files changed, 333 insertions(+), 233 deletions(-)

New commits:
commit 0c3c76691cfc6450347d993bb6608c0c2f90578f
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 22:31:08 2008 +0100

    fix 'make check' to work even when running the yum backend

diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 8466274..6d63ba4 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -3622,7 +3622,7 @@ libst_client (LibSelfTest *test)
 	}
 
 	libst_loopwait (test, 5000);
-	if (clone_packages != 4) {
+	if (clone_packages != size_new) {
 		libst_failed (test, "failed to get correct number of packages: %i", clone_packages);
 	}
 	libst_success (test, "cloned in %i", libst_elapsed (test));
commit e9ca133e37249dac31c4dbc37ea25dc32edd281a
Merge: ebed061... 18e296d...
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 22:23:45 2008 +0100

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

commit ebed0613d9c5b325970dba6eb74dbbc078005103
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 22:23:23 2008 +0100

    make pkcon be cleverer when doing the moving bars - hopefully it's more sane now

diff --git a/client/pk-console.c b/client/pk-console.c
index f5d1733..45d9b4a 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -39,17 +39,17 @@
 #include <pk-common.h>
 #include <pk-connection.h>
 
-#define PROGRESS_BAR_PADDING 22
-#define MINIMUM_COLUMNS (PROGRESS_BAR_PADDING + 5)
+#define PROGRESS_BAR_SIZE 15
 
 static GMainLoop *loop = NULL;
 static PkEnumList *role_list = NULL;
 static gboolean is_console = FALSE;
-static gboolean has_output = FALSE;
-static gboolean printed_bar = FALSE;
+static gboolean has_output_bar = FALSE;
 static gboolean need_requeue = FALSE;
 static gboolean nowait = FALSE;
+static gboolean awaiting_space = FALSE;
 static guint timer_id = 0;
+static guint percentage_last = 0;
 static PkControl *control = NULL;
 static PkClient *client = NULL;
 static PkClient *client_task = NULL;
@@ -61,23 +61,52 @@ typedef struct {
 } PulseState;
 
 /**
- * pk_console_package_cb:
+ * pk_console_bar:
  **/
 static void
-pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id, const gchar *summary, gpointer data)
+pk_console_bar (guint subpercentage)
 {
-	PkPackageId *ident;
-	PkPackageId *spacing;
-	gchar *info_text;
-	guint extra = 0;
+	guint section;
+	guint i;
 
-	/* if on console, clear the progress bar line */
-	if (is_console && printed_bar && has_output == FALSE) {
-		g_print ("\r");
+	/* don't pretty print */
+	if (!is_console) {
+		return;
+	}
+	if (!has_output_bar) {
+		return;
 	}
+	/* restore cursor */
+	g_print ("%c8", 0x1B);
 
-	/* pass this out */
-	info_text = pk_strpad (pk_info_enum_to_text (info), 12);
+	section = (guint) ((gfloat) PROGRESS_BAR_SIZE / (gfloat) 100.0 * (gfloat) subpercentage);
+	g_print ("[");
+	for (i=0; i<section; i++) {
+		g_print ("=");
+	}
+	for (i=0; i<PROGRESS_BAR_SIZE-section; i++) {
+		g_print (" ");
+	}
+	g_print ("] ");
+	if (percentage_last != PK_CLIENT_PERCENTAGE_INVALID) {
+		g_print ("(%i%%)", percentage_last);
+	} else {
+		g_print ("       ");
+	}
+	awaiting_space = TRUE;
+}
+
+/**
+ * pk_console_package_cb:
+ **/
+static void
+pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_id, const gchar *summary, gpointer data)
+{
+	PkPackageId *ident;
+	PkRoleEnum role;
+	gchar *package = NULL;
+	gchar *info_pad = NULL;
+	gchar *package_pad = NULL;
 
 	/* split */
 	ident = pk_package_id_new_from_string (package_id);
@@ -86,25 +115,60 @@ pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
 		return;
 	}
 
-	/* these numbers are guesses */
-	extra = 0;
-	spacing = pk_package_id_new ();
-	spacing->name = pk_strpad_extra (ident->name, 20, &extra);
-	spacing->arch = pk_strpad_extra (ident->arch, 7, &extra);
-	spacing->version = pk_strpad_extra (ident->version, 15, &extra);
-	spacing->data = pk_strpad_extra (ident->data, 12, &extra);
+	/* make these all the same lenght */
+	info_pad = pk_strpad (pk_info_enum_to_text (info), 12);
+
+	/* don't pretty print */
+	if (!is_console) {
+		g_print ("%s %s-%s.%s\n", info_pad, ident->name, ident->version, ident->arch);
+		goto out;
+	}
+
+	/* pad the name-version */
+	if (pk_strzero (ident->version)) {
+		package = g_strdup (ident->name);
+	} else {
+		package = g_strdup_printf ("%s-%s", ident->name, ident->version);
+	}
+	package_pad = pk_strpad (package, 40);
+
+	/* mark previous complete */
+	if (has_output_bar) {
+		pk_console_bar (100);
+	}
+
+	if (awaiting_space) {
+		g_print ("\n");
+	}
+
+	pk_client_get_role (client, &role, NULL, NULL);
+	if (role == PK_ROLE_ENUM_SEARCH_NAME ||
+	    role == PK_ROLE_ENUM_SEARCH_GROUP ||
+	    role == PK_ROLE_ENUM_SEARCH_FILE ||
+	    role == PK_ROLE_ENUM_SEARCH_DETAILS ||
+	    role == PK_ROLE_ENUM_GET_DEPENDS ||
+	    role == PK_ROLE_ENUM_GET_REQUIRES ||
+	    role == PK_ROLE_ENUM_GET_UPDATES) {
+		/* don't do the bar */
+		g_print ("%s %s\n", info_pad, package_pad);
+		goto out;
+	}
+
+	has_output_bar = TRUE;
+	/* do we need to new line? */
 
 	/* pretty print */
-	g_print ("%s %s %s %s %s %s\n", info_text, spacing->name,
-		 spacing->arch, spacing->version, spacing->data, summary);
+	g_print ("%s %s ", info_pad, package_pad);
 
+	/* save cursor in new position */
+	g_print ("%c7", 0x1B);
+	pk_console_bar (0);
+out:
 	/* free all the data */
-	g_free (info_text);
 	pk_package_id_free (ident);
-	pk_package_id_free (spacing);
-
-	/* don't do the percentage bar from now on */
-	has_output = TRUE;
+	g_free (package);
+	g_free (info_pad);
+	g_free (package_pad);
 }
 
 /**
@@ -117,6 +181,9 @@ pk_console_transaction_cb (PkClient *client, const gchar *tid, const gchar *time
 {
 	const gchar *role_text;
 	role_text = pk_role_enum_to_text (role);
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print ("Transaction  : %s\n", tid);
 	g_print (" timespec    : %s\n", timespec);
 	g_print (" succeeded   : %i\n", succeeded);
@@ -135,6 +202,9 @@ pk_console_update_detail_cb (PkClient *client, const gchar *package_id,
 			     const gchar *cve_url, PkRestartEnum restart,
 			     const gchar *update_text, gpointer data)
 {
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print (_("Update detail\n"));
 	g_print ("  package:    '%s'\n", package_id);
 	if (pk_strzero (updates) == FALSE) {
@@ -169,6 +239,9 @@ pk_console_repo_detail_cb (PkClient *client, const gchar *repo_id,
 {
 	gchar *repo;
 	repo = pk_strpad (repo_id, 28);
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	if (enabled) {
 		g_print ("  enabled   %s %s\n", repo, description);
 	} else {
@@ -178,124 +251,54 @@ pk_console_repo_detail_cb (PkClient *client, const gchar *repo_id,
 }
 
 /**
- * pk_console_get_terminal_columns:
- **/
-static guint
-pk_console_get_terminal_columns (void)
-{
-	struct winsize ws;
-
-	ioctl (1, TIOCGWINSZ, &ws);
-	if (ws.ws_col < MINIMUM_COLUMNS) {
-		return MINIMUM_COLUMNS;
-	}
-
-	return ws.ws_col;
-}
-
-/**
- * pk_console_draw_progress_bar:
- **/
-static void
-pk_console_draw_progress_bar (guint percentage, guint remaining_time)
-{
-	guint i;
-	guint progress_bar_size = pk_console_get_terminal_columns () - PROGRESS_BAR_PADDING;
-	guint progress = (gint) (progress_bar_size * (gfloat) (percentage) / 100);
-	guint remaining = progress_bar_size - progress;
-
-	/* have we already been spinning? */
-	if (timer_id != 0) {
-		g_source_remove (timer_id);
-		timer_id = 0;
-	}
-
-	/* we need to do an extra line */
-	printed_bar = TRUE;
-
-	g_print ("\r    [");
-	for (i = 0; i < progress; i++) {
-		g_print ("=");
-	}
-	for (i = 0; i < remaining; i++) {
-		g_print (".");
-	}
-	g_print ("]  %3i%%", percentage);
-	if (remaining_time != 0) {
-		if (remaining_time > 60) {
-			guint remaining_minutes = remaining_time / 60;
-			if (remaining_minutes > 60) {
-				guint remaining_hours = remaining_time / 3600;
-				g_print (" (%2ih eta)", remaining_hours);
-			} else {
-				g_print (" (%2im eta)", remaining_minutes);
-			}
-		} else {
-			g_print (" (%2is eta)", remaining_time);
-		}
-	} else {
-		g_print ("          ");
-	}
-	if (percentage == 100) {
-		g_print ("\n");
-	}
-}
-
-/**
  * pk_console_pulse_bar:
  **/
 static gboolean
 pk_console_pulse_bar (PulseState *pulse_state)
 {
 	guint i;
-	guint progress_bar_size = pk_console_get_terminal_columns () - PROGRESS_BAR_PADDING;
-	gchar *padding;
 
-	/* don't spin if we have had output */
-	if (has_output) {
-		return FALSE;
+	if (!has_output_bar) {
+		return TRUE;
 	}
 
-	/* we need to do an extra line */
-	printed_bar = TRUE;
-
-	/* the clever pulse code */
-	printf("\r    [");
-	for (i = 0; i < pulse_state->position - 1; i++) {
-		g_print (".");
-	}
-	printf("===");
-	for (i = pulse_state->position; i < progress_bar_size - 2; i++) {
-		g_print (".");
-	}
-	g_print ("]");
+	/* restore cursor */
+	g_print ("%c8", 0x1B);
 
 	if (pulse_state->move_forward) {
-		if (pulse_state->position == progress_bar_size - 2) {
+		if (pulse_state->position == PROGRESS_BAR_SIZE - 1) {
 			pulse_state->move_forward = FALSE;
-			pulse_state->position--;
 		} else {
 			pulse_state->position++;
 		}
 	} else if (pulse_state->move_forward == FALSE) {
 		if (pulse_state->position == 1) {
 			pulse_state->move_forward = TRUE;
-			pulse_state->position++;
 		} else {
 			pulse_state->position--;
 		}
 	}
 
-	/* Move the cursor off the screen. */
-	padding = g_strnfill (PROGRESS_BAR_PADDING - 6, ' ');
-	g_print ("%s", padding);
-	g_free (padding);
+	g_print ("[");
+	for (i=0; i<pulse_state->position-1; i++) {
+		g_print (" ");
+	}
+	printf("==");
+	for (i=0; i<PROGRESS_BAR_SIZE-pulse_state->position-1; i++) {
+		g_print (" ");
+	}
+	g_print ("] ");
+	if (percentage_last != PK_CLIENT_PERCENTAGE_INVALID) {
+		g_print ("(%i%%)", percentage_last);
+	} else {
+		g_print ("        ");
+	}
 
 	return TRUE;
 }
 
 /**
- * pk_console_draw_progress_bar:
+ * pk_console_draw_pulse_bar:
  **/
 static void
 pk_console_draw_pulse_bar (void)
@@ -306,7 +309,6 @@ pk_console_draw_pulse_bar (void)
 	if (timer_id != 0) {
 		return;
 	}
-	has_output = FALSE;
 	if (is_console) {
 		pulse_state.position = 1;
 		pulse_state.move_forward = TRUE;
@@ -321,14 +323,24 @@ static void
 pk_console_progress_changed_cb (PkClient *client, guint percentage, guint subpercentage,
 				guint elapsed, guint remaining, gpointer data)
 {
-	if (is_console) {
-		if (percentage == PK_CLIENT_PERCENTAGE_INVALID) {
-			pk_console_draw_pulse_bar ();
+	if (!is_console) {
+		if (percentage != PK_CLIENT_PERCENTAGE_INVALID) {
+			g_print ("percentage: %i%%\n", percentage);
 		} else {
-			pk_console_draw_progress_bar (percentage, remaining);
+			g_print ("percentage: unknown\n");
 		}
+		return;
+	}
+	percentage_last = percentage;
+	if (subpercentage == PK_CLIENT_PERCENTAGE_INVALID) {
+		pk_console_bar (0);
+		pk_console_draw_pulse_bar ();
 	} else {
-		g_print ("%i%%\n", percentage);
+		if (timer_id != 0) {
+			g_source_remove (timer_id);
+			timer_id = 0;
+		}
+		pk_console_bar (subpercentage);
 	}
 }
 
@@ -337,22 +349,21 @@ static const gchar *summary =
 	"\n"
 	"Subcommands:\n"
 	"  search name|details|group|file data\n"
-	"  install <package_id>\n"
+	"  install <package>\n"
 	"  install-file <file>\n"
 	"  install-signature <type> <key_id> <package_id>\n"
-	"  remove <package_id>\n"
-	"  update <package_id>\n"
+	"  remove <package>\n"
+	"  update <package>\n"
 	"  refresh\n"
 	"  resolve\n"
-	"  force-refresh\n"
 	"  update-system\n"
 	"  get updates\n"
-	"  get depends <package_id>\n"
-	"  get requires <package_id>\n"
-	"  what-provides <search>\n"
-	"  get description <package_id>\n"
-	"  get files <package_id>\n"
-	"  get updatedetail <package_id>\n"
+	"  get depends <package>\n"
+	"  get requires <package>\n"
+	"  provides <search>\n"
+	"  get description <package>\n"
+	"  get files <package>\n"
+	"  get updatedetail <package>\n"
 	"  get actions\n"
 	"  get groups\n"
 	"  get filters\n"
@@ -360,9 +371,7 @@ static const gchar *summary =
 	"  get repos\n"
 	"  enable-repo <repo_id>\n"
 	"  disable-repo <repo_id>\n"
-	"  set-repo-data <repo_id> <parameter> <value>\n"
-	"\n"
-	"  package_id is typically gimp;2:2.4.0-0.rc1.1.fc8;i386;development";
+	"  set-repo-data <repo_id> <parameter> <value>\n";
 
 /**
  * pk_console_signature_finished_cb:
@@ -389,29 +398,29 @@ static void
 pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpointer data)
 {
 	PkRoleEnum role;
-	gchar *blanking;
 	const gchar *role_text;
 	gfloat time;
 	PkRestartEnum restart;
 
 	pk_client_get_role (client, &role, NULL, NULL);
 
+	/* mark previous complete */
+	if (has_output_bar) {
+		pk_console_bar (100);
+	}
+
 	/* cancel the spinning */
 	if (timer_id != 0) {
 		g_source_remove (timer_id);
 	}
 
-	/* if on console, clear the progress bar line */
-	if (is_console && printed_bar && has_output == FALSE) {
-		g_print ("\r");
-		blanking = g_strnfill (pk_console_get_terminal_columns (), ' ');
-		g_print ("%s", blanking);
-		g_free (blanking);
-		g_print ("\r");
-	}
-
 	role_text = pk_role_enum_to_text (role);
 	time = (gfloat) runtime / 1000.0;
+
+	/* do we need to new line? */
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print ("%s runtime was %.1f seconds\n", role_text, time);
 
 	/* is there any restart to notify the user? */
@@ -512,6 +521,9 @@ pk_console_perhaps_resolve (PkClient *client, PkFilterEnum filter, const gchar *
 	}
 
 	/* else list the options if multiple matches found */
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print (_("There are multiple matches\n"));
 	for (i=0; i<length; i++) {
 		item = pk_client_package_buffer_get_item (client_task, i);
@@ -556,7 +568,6 @@ pk_console_remove_only (PkClient *client, const gchar *package_id, gboolean forc
 	if (!ret) {
 		return ret;
 	}
-	pk_client_set_synchronous (client, TRUE, NULL);
 	return pk_client_remove_package (client, package_id, force, autoremove, error);
 }
 
@@ -655,6 +666,9 @@ pk_console_remove_package (PkClient *client, const gchar *package, GError **erro
 	}
 
 	/* present this to the user */
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print (_("The following packages have to be removed:\n"));
 	for (i=0; i<length; i++) {
 		item = pk_client_package_buffer_get_item (client_task, i);
@@ -878,8 +892,8 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 		}
 	} else if (strcmp (mode, "update") == 0) {
 		if (value == NULL) {
-			g_set_error (error, 0, 0, _("specify a package to update"));
-			return FALSE;
+			/* do the system update */
+			ret = pk_client_update_system (client, error);
 		} else {
 			ret = pk_console_update_package (client, value, error);
 		}
@@ -956,7 +970,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 			} else {
 				ret = pk_console_get_requires (client, details, error);
 			}
-		} else if (strcmp (value, "what-provides") == 0) {
+		} else if (strcmp (value, "provides") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, _("specify a search term"));
 				return FALSE;
@@ -1001,12 +1015,8 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 		} else {
 			g_set_error (error, 0, 0, _("invalid get type"));
 		}
-	} else if (strcmp (mode, "update-system") == 0) {
-		ret = pk_client_update_system (client, error);
 	} else if (strcmp (mode, "refresh") == 0) {
 		ret = pk_client_refresh_cache (client, FALSE, error);
-	} else if (strcmp (mode, "force-refresh") == 0) {
-		ret = pk_client_refresh_cache (client, TRUE, error);
 	} else {
 		g_set_error (error, 0, 0, _("option not yet supported"));
 	}
@@ -1030,9 +1040,7 @@ pk_console_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gc
 		pk_debug ("ignoring GPG error as handled");
 		return;
 	}
-
-	/* if on console, clear the progress bar line */
-	if (is_console && printed_bar) {
+	if (awaiting_space) {
 		g_print ("\n");
 	}
 	g_print ("Error: %s : %s\n", pk_error_enum_to_text (error_code), details);
@@ -1048,7 +1056,7 @@ pk_console_description_cb (PkClient *client, const gchar *package_id,
 			   gulong size, gpointer data)
 {
 	/* if on console, clear the progress bar line */
-	if (is_console && printed_bar) {
+	if (awaiting_space) {
 		g_print ("\n");
 	}
 	g_print (_("Package description\n"));
@@ -1069,11 +1077,9 @@ pk_console_files_cb (PkClient *client, const gchar *package_id,
 {
 	gchar **filevector = g_strsplit (filelist, ";", 0);
 
-	/* if on console, clear the progress bar line */
-	if (is_console && printed_bar) {
+	if (awaiting_space) {
 		g_print ("\n");
 	}
-
 	g_print ("Package files\n");
 
 	if (*filevector != NULL) {
@@ -1103,6 +1109,9 @@ pk_console_repo_signature_required_cb (PkClient *client, const gchar *package_id
 	gboolean ret;
 	GError *error = NULL;
 
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	g_print ("Repository Signature Required\n");
 	g_print ("Package:     %s\n", package_id);
 	g_print ("Name:        %s\n", repository_name);
@@ -1141,6 +1150,9 @@ static void
 pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointer data)
 {
 	/* if the daemon crashed, don't hang around */
+	if (awaiting_space) {
+		g_print ("\n");
+	}
 	if (connected == FALSE) {
 		g_print (_("The daemon crashed mid transaction. This is bad\n"));
 		exit (2);
diff --git a/contrib/pk-completion.bash b/contrib/pk-completion.bash
index a962a62..b12298f 100755
--- a/contrib/pk-completion.bash
+++ b/contrib/pk-completion.bash
@@ -24,7 +24,6 @@ __pkcon_commandlist="
     refresh
     resolve
     force-refresh
-    update-system
     get
     enable-repo
     disable-repo
@@ -74,7 +73,7 @@ _pkcon_get ()
 	while [ $c -lt $COMP_CWORD ]; do
 		i="${COMP_WORDS[c]}"
 		case "$i" in
-            updates|depends|requires|description|updatedetail|actions|groups|filters|transactions|repos)
+            updates|depends|requires|provides|description|updatedetail|actions|groups|filters|transactions|repos)
 			command="$i"
 			break
 			;;
@@ -87,6 +86,7 @@ _pkcon_get ()
             updates
             depends
             requires
+            provides
             description
             files
             updatedetail
commit 18e296d59ad2be56ba1a9793fc0a46a92b6f2c6f
Author: Scott Reeves <sreeves at novell.com>
Date:   Wed Apr 9 15:00:08 2008 -0600

    emit error on bad option to set repo data. rip redundant code

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index b696468..163c5e7 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1612,9 +1612,9 @@ backend_update_packages(PkBackend *backend, gchar **package_ids)
 }
 
 static gboolean
-backend_repo_set_data_thread (PkBackendThread *thread, gpointer data) {
-
-        PkBackend *backend;
+backend_repo_set_data_thread (PkBackendThread *thread, gpointer data)
+{
+	PkBackend *backend;
 
         /* get current backend */
         backend = pk_backend_thread_get_backend (thread);
@@ -1690,9 +1690,9 @@ backend_repo_set_data_thread (PkBackendThread *thread, gpointer data) {
 			}
 
                 }else{
-                        pk_backend_message (backend, PK_MESSAGE_ENUM_NOTICE, "Valid parameters for set_repo_data are remove/add/refresh/prio");
-                        bReturn = FALSE;
-                }
+			pk_backend_error_code (backend, PK_ERROR_ENUM_NOT_SUPPORTED, "Valid parameters for set_repo_data are remove/add/refresh/prio");
+			bReturn = FALSE;
+		}
 
         } catch (const zypp::repo::RepoNotFoundException &ex) {
 		pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't find the specified repository");
@@ -1708,13 +1708,7 @@ backend_repo_set_data_thread (PkBackendThread *thread, gpointer data) {
                 bReturn = FALSE;
 	} catch (const zypp::Exception &ex) {
 		pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, ex.asString ().c_str ());
-                g_free (d->repo_id);
-                g_free (d->parameter);
-                g_free (d->value);
-                g_free (d);
-                pk_backend_finished (backend);
-
-                return FALSE;
+		bReturn = FALSE;
 	}
 
         g_free (d->repo_id);
@@ -1723,7 +1717,7 @@ backend_repo_set_data_thread (PkBackendThread *thread, gpointer data) {
         g_free (d);
 	pk_backend_finished (backend);
 
-        return bReturn;
+	return bReturn;
 }
 
 /**
commit f44638f7759d3e676e21d20aede88613ec3800ac
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Wed Apr 9 14:39:43 2008 -0400

    Add 'zlib with acknowledgement' license tag.

diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 99b0bfe..e2cc562 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -363,6 +363,7 @@ static PkEnumMatch enum_free_licenses[] = {
 	{PK_LICENSE_ENUM_ZPLV2_DOT_0,          "ZPLv2.0"},
 	{PK_LICENSE_ENUM_ZPLV2_DOT_1,          "ZPLv2.1"},
 	{PK_LICENSE_ENUM_ZLIB,                 "zlib"},
+	{PK_LICENSE_ENUM_ZLIB_WITH_ACK,        "zlib with acknowledgement"},
 	{PK_LICENSE_ENUM_CDL,                  "CDL"},
 	{PK_LICENSE_ENUM_FBSDDL,               "FBSDDL"},
 	{PK_LICENSE_ENUM_GFDL,                 "GFDL"},
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index c9c170c..d44e8c5 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -432,6 +432,7 @@ typedef enum {
 	PK_LICENSE_ENUM_ZPLV2_DOT_0,
 	PK_LICENSE_ENUM_ZPLV2_DOT_1,
 	PK_LICENSE_ENUM_ZLIB,
+	PK_LICENSE_ENUM_ZLIB_WITH_ACK,
 	PK_LICENSE_ENUM_CDL,
 	PK_LICENSE_ENUM_FBSDDL,
 	PK_LICENSE_ENUM_GFDL,
commit 89fd88379c7bfe2ec451136b099616cc543c4619
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Wed Apr 9 12:49:02 2008 -0400

    Add generated files to make clean target.

diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am
index 62049da..01bed51 100644
--- a/docs/api/Makefile.am
+++ b/docs/api/Makefile.am
@@ -81,5 +81,5 @@ include $(top_srcdir)/gtk-doc.make
 EXTRA_DIST += version.xml.in
 
 clean-local :
-	rm -f *~ *.txt xml/* tmpl/* html/* *.bak *.out *.gcno
+	rm -f *~ *.txt xml/* tmpl/* html/* *.bak *.out *.gcno PackageKit-scan.* PackageKit.types version.xml
 
commit 9def0d502828df1d5d3ed2465d6cbded3a19e9e7
Merge: f47fa4c... 07bab13...
Author: Stefan Haas <shaas at suse.de>
Date:   Wed Apr 9 12:59:00 2008 +0200

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

commit f47fa4c0f4116e71a34e70357092fc1cb58cf034
Author: Stefan Haas <shaas at suse.de>
Date:   Wed Apr 9 12:58:33 2008 +0200

    make search group faster

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 2b5bfca..b696468 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1366,10 +1366,14 @@ backend_search_group_thread (PkBackendThread *thread, gpointer data)
 
         std::vector<zypp::sat::Solvable> *v = new std::vector<zypp::sat::Solvable> ();
 
-        for (zypp::ResPool::byKind_iterator it = pool.byKindBegin (zypp::ResKind::package); it != pool.byKindEnd (zypp::ResKind::package); it++) {
-                  if (g_strrstr (zypp_get_group ((*it)->satSolvable ()), d->pkGroup))
-                          v->push_back((*it)->satSolvable ());
-        }
+	zypp::sat::LookupAttr look (zypp::sat::SolvAttr::group);
+
+	for (zypp::sat::LookupAttr::iterator it = look.begin (); it != look.end (); it++) {
+		std::string group = it.asString ();
+		std::transform (group.begin (), group.end (), group.begin (), tolower);
+		if (g_strrstr (group.c_str (), d->pkGroup))
+			v->push_back (it.inSolvable ());
+	}
 
 	pk_backend_set_percentage (backend, 70);
 
commit 07bab13bfd307ee88233f3d77637d36145974373
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 10:18:02 2008 +0100

    remove an unneeded command

diff --git a/client/pk-console.c b/client/pk-console.c
index 78d24a2..f5d1733 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -1287,7 +1287,6 @@ main (int argc, char *argv[])
 			  G_CALLBACK (pk_console_finished_cb), NULL);
 
 	client_signature = pk_client_new ();
-	pk_client_set_synchronous (client_signature, FALSE, NULL);
 	g_signal_connect (client_signature, "finished",
 			  G_CALLBACK (pk_console_signature_finished_cb), NULL);
 
commit 17862e25b43df41e22859b814a0d09eda1abbfb8
Author: Stefan Haas <shaas at suse.de>
Date:   Wed Apr 9 11:07:59 2008 +0200

    changes for zypp 4.10.0

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 77b0748..2b5bfca 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -889,8 +889,8 @@ backend_install_package_thread (PkBackendThread *thread, gpointer data)
 
                 // Choose the PoolItem with the right architecture and version
                 zypp::PoolItem item;
-                for (zypp::ui::Selectable::availablePoolItem_iterator it = selectable->availablePoolItemBegin ();
-                                it != selectable->availablePoolItemEnd (); it++) {
+                for (zypp::ui::Selectable::available_iterator it = selectable->availableBegin ();
+                                it != selectable->availableEnd (); it++) {
                         if (strcmp ((*it)->edition ().asString ().c_str (), pi->version) == 0
                                         && strcmp ((*it)->arch ().c_str (), pi->arch) == 0 ) {
                                 hit = true;
@@ -1073,7 +1073,7 @@ backend_remove_package_thread (PkBackendThread *thread, gpointer data)
 			zypp::ui::Selectable::Ptr selectable = *it;
 			if (strcmp (selectable->name().c_str(), pi->name) == 0) {
 				if (selectable->status () == zypp::ui::S_KeepInstalled) {
-					selectable->set_status (zypp::ui::S_Del);
+					selectable->setStatus (zypp::ui::S_Del);
 					break;
 				}
 			}
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 93b61d3..6c79fbc 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -477,7 +477,7 @@ zypp_get_patches ()
         for (zypp::ResPoolProxy::const_iterator it = zypp->poolProxy ().byKindBegin<zypp::Patch>();
                         it != zypp->poolProxy ().byKindEnd<zypp::Patch>(); it ++) {
                 // check if patch is needed 
-                if((*it)->candidatePoolItem ().isBroken())
+                if((*it)->candidateObj ().isBroken())
                         patches->insert (*it);
 
         }
diff --git a/client/pk-console.c b/client/pk-console.c
index 31abd3d..78d24a2 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -47,10 +47,13 @@ static PkEnumList *role_list = NULL;
 static gboolean is_console = FALSE;
 static gboolean has_output = FALSE;
 static gboolean printed_bar = FALSE;
+static gboolean need_requeue = FALSE;
+static gboolean nowait = FALSE;
 static guint timer_id = 0;
 static PkControl *control = NULL;
 static PkClient *client = NULL;
 static PkClient *client_task = NULL;
+static PkClient *client_signature = NULL;
 
 typedef struct {
 	gint position;
@@ -336,6 +339,7 @@ static const gchar *summary =
 	"  search name|details|group|file data\n"
 	"  install <package_id>\n"
 	"  install-file <file>\n"
+	"  install-signature <type> <key_id> <package_id>\n"
 	"  remove <package_id>\n"
 	"  update <package_id>\n"
 	"  refresh\n"
@@ -361,6 +365,24 @@ static const gchar *summary =
 	"  package_id is typically gimp;2:2.4.0-0.rc1.1.fc8;i386;development";
 
 /**
+ * pk_console_signature_finished_cb:
+ **/
+static void
+pk_console_signature_finished_cb (PkClient *client_signature, PkExitEnum exit, guint runtime, gpointer data)
+{
+	gboolean ret;
+	GError *error = NULL;
+
+	pk_debug ("trying to requeue");
+	ret = pk_client_requeue (client, &error);
+	if (!ret) {
+		pk_warning ("failed to requeue action: %s", error->message);
+		g_error_free (error);
+		g_main_loop_quit (loop);
+	}
+}
+
+/**
  * pk_console_finished_cb:
  **/
 static void
@@ -372,6 +394,8 @@ pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
 	gfloat time;
 	PkRestartEnum restart;
 
+	pk_client_get_role (client, &role, NULL, NULL);
+
 	/* cancel the spinning */
 	if (timer_id != 0) {
 		g_source_remove (timer_id);
@@ -386,7 +410,6 @@ pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
 		g_print ("\r");
 	}
 
-	pk_client_get_role (client, &role, NULL, NULL);
 	role_text = pk_role_enum_to_text (role);
 	time = (gfloat) runtime / 1000.0;
 	g_print ("%s runtime was %.1f seconds\n", role_text, time);
@@ -396,6 +419,14 @@ pk_console_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
 	if (restart != PK_RESTART_ENUM_NONE) {
 		g_print (_("Requires restart: %s\n"), pk_restart_enum_to_text (restart));
 	}
+
+	/* have we failed to install, and the gpg key is now installed */
+	if (exit == PK_EXIT_ENUM_KEY_REQUIRED && need_requeue) {
+		return;
+	}
+
+	/* close the loop */
+	g_main_loop_quit (loop);
 }
 
 /**
@@ -416,13 +447,11 @@ pk_console_get_number (const gchar *question, guint maxnum)
 
 		/* positive */
 		if (retval == 1 && answer > 0 && answer <= maxnum) {
-			return answer;
+			break;
 		}
 		g_print (_("Please enter a number from 1 to %i: "), maxnum);
 	} while (TRUE);
-
-	/* keep GCC happy */
-	return 0;
+	return answer;
 }
 
 /**
@@ -771,6 +800,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 	const gchar *parameter = NULL;
 	PkEnumList *elist;
 	gboolean ret = FALSE;
+	gboolean maybe_sync = TRUE;
 
 	mode = argv[1];
 	if (argc > 2) {
@@ -825,6 +855,13 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 		} else {
 			ret = pk_console_install_package (client, value, error);
 		}
+	} else if (strcmp (mode, "install-signature") == 0) {
+		if (value == NULL || details == NULL || parameter == NULL) {
+			g_set_error (error, 0, 0, _("specify a type, key_id and package_id"));
+			return FALSE;
+		} else {
+			ret = pk_client_install_signature (client, PK_SIGTYPE_ENUM_GPG, details, parameter, error);
+		}
 	} else if (strcmp (mode, "install-file") == 0) {
 		if (value == NULL) {
 			g_set_error (error, 0, 0, _("specify a package to install"));
@@ -897,6 +934,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 				return FALSE;
 			}
 			g_print ("time since %s is %is\n", details, time);
+			maybe_sync = FALSE;
 		} else if (strcmp (value, "depends") == 0) {
 			if (details == NULL) {
 				g_set_error (error, 0, 0, _("specify a search term"));
@@ -945,16 +983,19 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 			elist = pk_control_get_actions (control);
 			pk_enum_list_print (elist);
 			g_object_unref (elist);
+			maybe_sync = FALSE;
 		} else if (strcmp (value, "filters") == 0) {
 			elist = pk_control_get_filters (control);
 			pk_enum_list_print (elist);
 			g_object_unref (elist);
+			maybe_sync = FALSE;
 		} else if (strcmp (value, "repos") == 0) {
 			ret = pk_client_get_repo_list (client, "none", error);
 		} else if (strcmp (value, "groups") == 0) {
 			elist = pk_control_get_groups (control);
 			pk_enum_list_print (elist);
 			g_object_unref (elist);
+			maybe_sync = FALSE;
 		} else if (strcmp (value, "transactions") == 0) {
 			ret = pk_client_get_old_transactions (client, 10, error);
 		} else {
@@ -969,6 +1010,12 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 	} else {
 		g_set_error (error, 0, 0, _("option not yet supported"));
 	}
+
+	/* do we wait for the method? */
+	if (maybe_sync && !nowait && ret) {
+		g_main_loop_run (loop);
+	}
+
 	return ret;
 }
 
@@ -978,6 +1025,12 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
 static void
 pk_console_error_code_cb (PkClient *client, PkErrorCodeEnum error_code, const gchar *details, gpointer data)
 {
+	/* handled */
+	if (need_requeue && error_code == PK_ERROR_ENUM_GPG_FAILURE) {
+		pk_debug ("ignoring GPG error as handled");
+		return;
+	}
+
 	/* if on console, clear the progress bar line */
 	if (is_console && printed_bar) {
 		g_print ("\n");
@@ -1047,6 +1100,8 @@ pk_console_repo_signature_required_cb (PkClient *client, const gchar *package_id
 				       PkSigTypeEnum type, gpointer data)
 {
 	gboolean import;
+	gboolean ret;
+	GError *error = NULL;
 
 	g_print ("Repository Signature Required\n");
 	g_print ("Package:     %s\n", package_id);
@@ -1057,17 +1112,26 @@ pk_console_repo_signature_required_cb (PkClient *client, const gchar *package_id
 	g_print ("Fingerprint: %s\n", key_fingerprint);
 	g_print ("Timestamp:   %s\n", key_timestamp);
 
-	/* it didn't quite cut it for the release */
-	g_debug ("Importing keys is not supported yet. We're working on it!");
-	return;
-
 	/* get user input */
 	import = pk_console_get_prompt (_("Okay to import key?"), FALSE);
 	if (!import) {
 		g_print ("%s\n", _("Did not import key, task will fail"));
 		return;
 	}
-	g_print ("TODO: import key\n");
+
+	/* install signature */
+	pk_debug ("install signature %s", key_id);
+	ret = pk_client_install_signature (client_signature, PK_SIGTYPE_ENUM_GPG,
+					   key_id, package_id, &error);
+	/* we succeeded, so wait for the requeue */
+	if (!ret) {
+		pk_warning ("failed to install signature: %s", error->message);
+		g_error_free (error);
+		return;
+	}
+
+	/* we imported a signature */
+	need_requeue = TRUE;
 }
 
 /**
@@ -1132,7 +1196,6 @@ main (int argc, char *argv[])
 	PkConnection *pconnection;
 	gboolean verbose = FALSE;
 	gboolean program_version = FALSE;
-	gboolean nowait = FALSE;
 	GOptionContext *context;
 	gchar *options_help;
 	gboolean ret;
@@ -1196,7 +1259,6 @@ main (int argc, char *argv[])
 
 	client = pk_client_new ();
 	pk_client_set_use_buffer (client, TRUE, NULL);
-	pk_client_set_synchronous (client, !nowait, NULL);
 	g_signal_connect (client, "package",
 			  G_CALLBACK (pk_console_package_cb), NULL);
 	g_signal_connect (client, "transaction",
@@ -1224,6 +1286,11 @@ main (int argc, char *argv[])
 	g_signal_connect (client_task, "finished",
 			  G_CALLBACK (pk_console_finished_cb), NULL);
 
+	client_signature = pk_client_new ();
+	pk_client_set_synchronous (client_signature, FALSE, NULL);
+	g_signal_connect (client_signature, "finished",
+			  G_CALLBACK (pk_console_signature_finished_cb), NULL);
+
 	control = pk_control_new ();
 	role_list = pk_control_get_actions (control);
 	pk_debug ("actions=%s", pk_enum_list_to_string (role_list));
@@ -1248,6 +1315,7 @@ main (int argc, char *argv[])
 	g_object_unref (control);
 	g_object_unref (client);
 	g_object_unref (client_task);
+	g_object_unref (client_signature);
 
 	return 0;
 }
diff --git a/configure.ac b/configure.ac
index 8bd9026..c3bcd0a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -554,7 +554,7 @@ if test x$enable_poldek = xyes; then
 fi
 
 if test x$enable_zypp = xyes; then
-	PKG_CHECK_MODULES(ZYPP, libzypp >= 4.7.0)
+	PKG_CHECK_MODULES(ZYPP, libzypp >= 4.10.0)
 	AC_SUBST(ZYPP_CFLAGS)
 	AC_SUBST(ZYPP_LIBS)
 fi
commit 3752414b172e11de2d22a543ba3743ace04fb91b
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 02:34:53 2008 +0100

    disconnect the backend connections straight away, as the PkTransaction object takes time to timeout and we don't want to warn when we try to process on multiple fast objects. Performance increase when lots of transactions happen soon after one another

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index a20f270..d1b5a24 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -581,6 +581,21 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
 	exit_text = pk_exit_enum_to_text (exit);
 	pk_debug ("emitting finished '%s', %i", exit_text, time);
 	g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, time);
+
+	/* disconnect these straight away, as the PkTransaction object takes time to timeout */
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_description);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_error_code);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_files);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_finished);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_message);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_package);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_progress_changed);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_detail);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_signature_required);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_require_restart);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_status_changed);
+	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_update_detail);
 }
 
 /**
@@ -2859,21 +2874,6 @@ pk_transaction_finalize (GObject *object)
 	transaction = PK_TRANSACTION (object);
 	g_return_if_fail (transaction->priv != NULL);
 
-	/* housekeeping */
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_allow_cancel);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_description);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_error_code);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_files);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_finished);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_message);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_package);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_progress_changed);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_detail);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_repo_signature_required);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_require_restart);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_status_changed);
-	g_signal_handler_disconnect (transaction->priv->backend, transaction->priv->signal_update_detail);
-
 	g_free (transaction->priv->last_package);
 	g_free (transaction->priv->dbus_name);
 	g_free (transaction->priv->cached_package_id);
commit c2f4e6f670d43c614fb1d432df388efc65580231
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 02:32:06 2008 +0100

    move the backend reset out of the transaction list and into the transaction object

diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index e7db7b6..0921c7c 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -40,7 +40,6 @@
 
 #include <pk-debug.h>
 #include <pk-common.h>
-#include "pk-backend-internal.h"
 #include "pk-transaction-id.h"
 #include "pk-transaction-list.h"
 #include "pk-interface-transaction.h"
@@ -55,7 +54,6 @@ struct PkTransactionListPrivate
 {
 	GPtrArray		*array;
 	gchar			*current_tid;
-	PkBackend		*backend;
 };
 
 typedef struct {
@@ -226,9 +224,6 @@ pk_transaction_list_transaction_finished_cb (PkTransaction *transaction, const g
 	finished->item = item;
 	g_timeout_add_seconds (5, pk_transaction_list_remove_item_timeout, finished);
 
-	/* reset the backend  -- is this the correct place to do this? */
-	pk_backend_reset (tlist->priv->backend);
-
 	/* do the next transaction now if we have another queued */
 	length = tlist->priv->array->len;
 	for (i=0; i<length; i++) {
@@ -421,7 +416,6 @@ pk_transaction_list_init (PkTransactionList *tlist)
 {
 	tlist->priv = PK_TRANSACTION_LIST_GET_PRIVATE (tlist);
 	tlist->priv->array = g_ptr_array_new ();
-	tlist->priv->backend = pk_backend_new ();
 }
 
 /**
@@ -440,7 +434,6 @@ pk_transaction_list_finalize (GObject *object)
 	g_return_if_fail (tlist->priv != NULL);
 
 	g_ptr_array_free (tlist->priv->array, TRUE);
-	g_object_unref (tlist->priv->backend);
 
 	G_OBJECT_CLASS (pk_transaction_list_parent_class)->finalize (object);
 }
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 52c52ac..a20f270 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -286,6 +286,9 @@ pk_transaction_run (PkTransaction *transaction)
 	g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
 	g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
 
+	/* prepare for use; the transaction list ensures this is safe */
+	pk_backend_reset (transaction->priv->backend);
+
 	ret = pk_transaction_set_running (transaction);
 	if (ret) {
 		/* we start inhibited, it's up to the backed to
@@ -730,7 +733,7 @@ pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTra
 
 	/* have we already been marked as finished? */
 	if (transaction->priv->finished) {
-		pk_warning ("Already finished");
+		pk_warning ("Already finished, so can't proxy status %s", pk_status_enum_to_text (status));
 		return;
 	}
 
commit 039fa145020c8a75dd9fd822b8aac53c94e2db3b
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 02:23:49 2008 +0100

    don't finish twice, as we are listening for Pktransaction finished now

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index ac5e83b..52c52ac 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1239,7 +1239,6 @@ pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, G
 	pk_debug ("emitting finished transaction '%s', %i", exit_text, 0);
 	g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
 
-	pk_transaction_list_remove (transaction->priv->transaction_list, transaction);
 	return TRUE;
 }
 
commit 51981774d4e6ed70b0226c612f1e0fa622ee5c52
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 02:10:30 2008 +0100

    refresh the task-list when the daemon comes back up

diff --git a/libpackagekit/pk-task-list.c b/libpackagekit/pk-task-list.c
index a81b692..5a84738 100644
--- a/libpackagekit/pk-task-list.c
+++ b/libpackagekit/pk-task-list.c
@@ -41,12 +41,13 @@
 #include <glib/gi18n.h>
 #include <dbus/dbus-glib.h>
 
-#include "pk-debug.h"
-#include "pk-marshal.h"
-#include "pk-client.h"
-#include "pk-common.h"
-#include "pk-task-list.h"
-#include "pk-control.h"
+#include <pk-debug.h>
+#include <pk-client.h>
+#include <pk-common.h>
+#include <pk-task-list.h>
+#include <pk-control.h>
+#include <pk-connection.h>
+#include <pk-marshal.h>
 
 static void     pk_task_list_class_init		(PkTaskListClass *klass);
 static void     pk_task_list_init		(PkTaskList      *task_list);
@@ -63,6 +64,7 @@ struct _PkTaskListPrivate
 {
 	GPtrArray		*task_list;
 	PkControl		*control;
+	PkConnection		*connection;
 };
 
 typedef enum {
@@ -312,6 +314,7 @@ pk_task_list_get_item (PkTaskList *tlist, guint item)
 static void
 pk_task_list_transaction_list_changed_cb (PkControl *control, PkTaskList *tlist)
 {
+	g_return_if_fail (PK_IS_TASK_LIST (tlist));
 	/* for now, just refresh all the jobs. a little inefficient me thinks */
 	pk_task_list_refresh (tlist);
 	pk_debug ("emit task-list-changed");
@@ -319,6 +322,20 @@ pk_task_list_transaction_list_changed_cb (PkControl *control, PkTaskList *tlist)
 }
 
 /**
+ * pk_task_list_connection_changed_cb:
+ **/
+static void
+pk_task_list_connection_changed_cb (PkConnection *connection, gboolean connected, PkTaskList *tlist)
+{
+	g_return_if_fail (PK_IS_TASK_LIST (tlist));
+	pk_debug ("connected=%i", connected);
+	if (connected) {
+		/* force a refresh so we have valid data*/
+		pk_task_list_refresh (tlist);
+	}
+}
+
+/**
  * pk_task_list_class_init:
  **/
 static void
@@ -404,6 +421,10 @@ pk_task_list_init (PkTaskList *tlist)
 	/* we maintain a local copy */
 	tlist->priv->task_list = g_ptr_array_new ();
 
+	tlist->priv->connection = pk_connection_new ();
+	g_signal_connect (tlist->priv->connection, "connection-changed",
+			  G_CALLBACK (pk_task_list_connection_changed_cb), tlist);
+
 	/* force a refresh so we have valid data*/
 	pk_task_list_refresh (tlist);
 }
commit a204bc2712cccffb9e7813132875997329b1c580
Author: Richard Hughes <richard at hughsie.com>
Date:   Wed Apr 9 01:55:26 2008 +0100

    point out where we are logging

diff --git a/libpackagekit/pk-debug.c b/libpackagekit/pk-debug.c
index 7e399a0..2f632b5 100644
--- a/libpackagekit/pk-debug.c
+++ b/libpackagekit/pk-debug.c
@@ -52,6 +52,8 @@
 #define CONSOLE_CYAN		36
 #define CONSOLE_WHITE		37
 
+#define PK_LOG_FILE		PK_LOG_DIR "/PackageKit"
+
 static gboolean do_verbose = FALSE;	/* if we should print out debugging */
 static gboolean do_logging = FALSE;	/* if we should write to a file */
 static gboolean is_console = FALSE;
@@ -64,6 +66,9 @@ void
 pk_debug_set_logging (gboolean enabled)
 {
 	do_logging = enabled;
+	if (enabled) {
+		pk_debug ("now logging to %s", PK_LOG_FILE);
+	}
 }
 
 /**
@@ -93,9 +98,9 @@ pk_log_line (const gchar *buffer)
 	/* open a file */
 	if (fd == -1) {
 		mkdir (PK_LOG_DIR, 0777);
-		fd = open (PK_LOG_DIR "/PackageKit", O_WRONLY|O_APPEND|O_CREAT, 0777);
+		fd = open (PK_LOG_FILE, O_WRONLY|O_APPEND|O_CREAT, 0777);
 		if (fd == -1) {
-			g_error ("could not open log: '%s'", PK_LOG_DIR "/PackageKit");
+			g_error ("could not open log: '%s'", PK_LOG_FILE);
 		}
 	}
 	/* whole line */


More information about the PackageKit-commit mailing list