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

Richard Hughes hughsient at kemper.freedesktop.org
Tue Apr 29 06:37:04 PDT 2008


 backends/alpm/pk-backend-alpm.c   |  144 ++++++++++++++++++++++++++------------
 backends/box/pk-backend-box.c     |   36 +++------
 backends/zypp/pk-backend-zypp.cpp |    5 +
 client/pk-console.c               |   39 +++++++---
 docs/html/pk-faq.html             |   11 ++
 libpackagekit/pk-client.c         |    3 
 src/pk-backend.c                  |   16 ++++
 7 files changed, 173 insertions(+), 81 deletions(-)

New commits:
commit e83f4785d52a6fb82985b5305feb0ea22823cdea
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Apr 29 14:44:20 2008 +0100

    add a FAQ entry

diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 7d799f7..a9e2bb7 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -22,6 +22,7 @@
 <h2>Table Of Contents</h2>
 <ul>
 <li><a href="#how-complete">How complete are the backends?</a></li>
+<li><a href="#rawhide-updates">Why don't I get update details with Fedora Rawhide?</a></li>
 <li><a href="#selinux">Why doesn't PackageKit work with SELinux?</a></li>
 <li><a href="#tray-icons">What do the tray icons mean?</a></li>
 <li><a href="#no-percentage-updates">What if we don't support percentage updates?</a></li>
@@ -580,6 +581,14 @@ In the released versions of Fedora metadata is added to updates and the type of
 </p>
 
 <hr>
+<h3><a name="rawhide-updates">Why don't I get update details with Fedora Rawhide?</a></h3>
+<p>
+The Rawhide repository does not supply metadata needed for the update-viewer to display extra
+information about the update, such as changelogs, CVE and bugzilla references.
+Only released versions of Fedora have this metadata.
+</p>
+
+<hr>
 <h3><a name="selinux">Why doesn't PackageKit work with SELinux?</a></h3>
 <p>
 The process <code>packagekitd</code> is not recognized by SELinux in Fedora 8.
@@ -587,7 +596,7 @@ Until the policy is fixed to handle system activation, you'll have
 to run in permissive mode, rather than enforcing.
 </p>
 <p>
-Using Fedora Rawhide, <code>selinux-policy-3.0.8-62.fc8</code> will make the
+Using Fedora 9 or Rawhide, <code>selinux-policy-3.0.8-62.fc8</code> will make the
 <code>yum</code> backend work correctly when enforcing.
 The future backend <code>yum2</code> will need further changes.
 See <a href="https://bugzilla.redhat.com/show_bug.cgi?id=361151">Red Hat Bugzilla</a>
commit 062687a064120152d245f4b770ecce57b851b39d
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Apr 29 13:57:04 2008 +0100

    check that install, remove and update emit package(), and if not, report a warning

diff --git a/src/pk-backend.c b/src/pk-backend.c
index 65c2cf2..7a6f00f 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -88,6 +88,7 @@ struct _PkBackendPrivate
 	gboolean		 set_error;
 	gboolean		 set_signature;
 	gboolean		 set_eula;
+	gboolean		 has_sent_package;
 	PkRoleEnum		 role; /* this never changes for the lifetime of a transaction */
 	PkStatusEnum		 status; /* this changes */
 	PkExitEnum		 exit;
@@ -689,6 +690,9 @@ pk_backend_package (PkBackend *backend, PkInfoEnum info, const gchar *package_id
 		pk_backend_set_status (backend, PK_STATUS_ENUM_OBSOLETE);
 	}
 
+	/* we've sent a package for this transaction */
+	backend->priv->has_sent_package = TRUE;
+
 	/* replace unsafe chars */
 	summary_safe = pk_strsafe (summary);
 
@@ -1216,6 +1220,17 @@ pk_backend_finished (PkBackend *backend)
 		return FALSE;
 	}
 
+	/* check we got a Package() else the UI will suck */
+	if (!backend->priv->set_error &&
+	    !backend->priv->has_sent_package &&
+	    (backend->priv->role == PK_ROLE_ENUM_INSTALL_PACKAGE ||
+	     backend->priv->role == PK_ROLE_ENUM_REMOVE_PACKAGE ||
+	     backend->priv->role == PK_ROLE_ENUM_UPDATE_PACKAGES)) {
+		pk_backend_message (backend, PK_MESSAGE_ENUM_DAEMON,
+				    "Backends need to send a Package() for this role!");
+		return FALSE;
+	}
+
 	/* if we set an error code notifier, clear */
 	if (backend->priv->signal_error_timeout != 0) {
 		g_source_remove (backend->priv->signal_error_timeout);
@@ -1532,6 +1547,7 @@ pk_backend_reset (PkBackend *backend)
 	backend->priv->set_eula = FALSE;
 	backend->priv->allow_cancel = FALSE;
 	backend->priv->finished = FALSE;
+	backend->priv->has_sent_package = FALSE;
 	backend->priv->status = PK_STATUS_ENUM_UNKNOWN;
 	backend->priv->exit = PK_EXIT_ENUM_UNKNOWN;
 	backend->priv->role = PK_ROLE_ENUM_UNKNOWN;
commit 9c0d44002d70b25ee203167057bb6225939b8e33
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Apr 29 13:15:46 2008 +0100

    only try to cancel the task on reset if the task has ever been set

diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index e943cc4..ec127aa 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -3454,7 +3454,8 @@ pk_client_reset (PkClient *client, GError **error)
 
 	g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
 
-	if (client->priv->is_finished != TRUE) {
+	if (client->priv->tid != NULL &&
+	    client->priv->is_finished != TRUE) {
 		pk_debug ("not exit status, will try to cancel");
 		/* we try to cancel the running tranaction */
 		ret = pk_client_cancel (client, error);
commit 01a48547a1fdd70a2d5addd5084c4bb5f83254c8
Merge: 68eacda... 0e44eef...
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Apr 29 12:56:01 2008 +0100

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

commit 68eacda2d464e4a5d2d48b77b481bc63d0819b5e
Author: Richard Hughes <richard at hughsie.com>
Date:   Tue Apr 29 12:54:57 2008 +0100

    ensure we get a progress bar for refresh, and clean up the logic a little

diff --git a/client/pk-console.c b/client/pk-console.c
index 032da65..6e66486 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -76,6 +76,7 @@ pk_console_bar (guint subpercentage)
 		return;
 	}
 	if (!has_output_bar) {
+		pk_warning ("no bar");
 		return;
 	}
 	/* restore cursor */
@@ -99,6 +100,25 @@ pk_console_bar (guint subpercentage)
 }
 
 /**
+ * pk_console_start_bar:
+ **/
+static void
+pk_console_start_bar (const gchar *text)
+{
+	gchar *text_pad;
+
+	/* make these all the same lenght */
+	text_pad = pk_strpad (text, 50);
+	g_print ("%s", text_pad);
+	g_free (text_pad);
+	has_output_bar = TRUE;
+
+	/* save cursor in new position */
+	g_print ("%c7", 0x1B);
+	pk_console_bar (0);
+}
+
+/**
  * pk_console_package_cb:
  **/
 static void
@@ -108,7 +128,7 @@ pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
 	PkRoleEnum role;
 	gchar *package = NULL;
 	gchar *info_pad = NULL;
-	gchar *package_pad = NULL;
+	gchar *text = NULL;
 
 	/* split */
 	ident = pk_package_id_new_from_string (package_id);
@@ -132,7 +152,6 @@ pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
 	} else {
 		package = g_strdup_printf ("%s-%s", ident->name, ident->version);
 	}
-	package_pad = pk_strpad (package, 40);
 
 	/* mark previous complete */
 	if (has_output_bar) {
@@ -153,25 +172,19 @@ pk_console_package_cb (PkClient *client, PkInfoEnum info, const gchar *package_i
 	    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);
+		g_print ("%s %s\n", info_pad, package);
 		goto out;
 	}
 
-	has_output_bar = TRUE;
-	/* do we need to new line? */
-
-	/* pretty print */
-	g_print ("%s %s ", info_pad, package_pad);
+	text = g_strdup_printf ("%s %s", info_pad, package);
+	pk_console_start_bar (text);
+	g_free (text);
 
-	/* save cursor in new position */
-	g_print ("%c7", 0x1B);
-	pk_console_bar (0);
 out:
 	/* free all the data */
 	pk_package_id_free (ident);
 	g_free (package);
 	g_free (info_pad);
-	g_free (package_pad);
 }
 
 /**
@@ -1482,6 +1495,8 @@ main (int argc, char *argv[])
 		ret = pk_client_get_old_transactions (client, 10, &error);
 
 	} else if (strcmp (mode, "refresh") == 0) {
+		/* special case - this takes a long time, and doesn't do packages */
+		pk_console_start_bar ("refresh-cache");
 		ret = pk_client_refresh_cache (client, FALSE, &error);
 
 	} else {
commit 0e44eef28ec7fce272ab510bf3a9f250ba4b22d7
Merge: 6b68e0a... d905202...
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date:   Tue Apr 29 13:22:51 2008 +0300

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

commit d90520284f2744f10261dbdebec018f14e88fd2c
Author: Stefan Haas <shaas at suse.de>
Date:   Mon Apr 28 16:22:31 2008 +0200

    look also for patches

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 6c7b8d2..bf5d74c 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -568,7 +568,11 @@ backend_get_description_thread (PkBackendThread *thread, gpointer data)
 	pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
 	std::vector<zypp::sat::Solvable> *v;
+	std::vector<zypp::sat::Solvable> *v2;
 	v = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::package, TRUE);
+	v2 = zypp_get_packages_by_name ((const gchar *)pi->name, zypp::ResKind::patch, TRUE);
+
+	v->insert (v->end (), v2->begin (), v2->end ());
 
 	zypp::sat::Solvable package;
 	for (std::vector<zypp::sat::Solvable>::iterator it = v->begin ();
@@ -585,6 +589,7 @@ backend_get_description_thread (PkBackendThread *thread, gpointer data)
 	}
 
 	delete (v);
+	delete (v2);
 
 	if (package == NULL) {
 		pk_backend_error_code (backend, PK_ERROR_ENUM_PACKAGE_NOT_FOUND, "couldn't find package");
commit a18e54444362e02fcc2a57b86c8acffede7320fd
Author: Grzegorz Dabrowski <gdx at o2.pl>
Date:   Mon Apr 28 09:31:38 2008 +0000

    [box] fixed broken search function

diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 07e5a97..7c7ca0d 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -157,34 +157,26 @@ find_packages_real (PkBackend *backend, const gchar *search, PkFilterEnum filter
 	db = db_open();
 
 	if (mode == SEARCH_TYPE_FILE) {
-		if (!pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
-		    !pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
-			pk_backend_error_code (backend, PK_ERROR_ENUM_UNKNOWN, "invalid search mode");
-		} else	{
-			list = box_db_repos_search_file_with_filter (db, search, filter_box);
-			add_packages_from_list (backend, list, FALSE);
-			box_db_repos_package_list_free (list);
-		}
+		list = box_db_repos_search_file_with_filter (db, search, filter_box);
+		add_packages_from_list (backend, list, FALSE);
+		box_db_repos_package_list_free (list);
 	} else if (mode == SEARCH_TYPE_RESOLVE) {
 		list = box_db_repos_packages_search_one (db, (gchar *)search);
 		add_packages_from_list (backend, list, FALSE);
 		box_db_repos_package_list_free (list);
 	} else {
-		if (!pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
-		    !pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
-			pk_backend_error_code (backend, PK_ERROR_ENUM_UNKNOWN, "invalid search mode");
-		} else	{
-			if (pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
-			    pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
-				list = box_db_repos_packages_search_all(db, (gchar *)search, filter_box);
-			} else if (pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
-				list = box_db_repos_packages_search_installed(db, (gchar *)search, filter_box);
-			} else if (pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
-				list = box_db_repos_packages_search_available(db, (gchar *)search, filter_box);
-			}
-			add_packages_from_list (backend, list, FALSE);
-			box_db_repos_package_list_free (list);
+		if ((pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
+		     pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) ||
+		    (!pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
+		     !pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED))) {
+			list = box_db_repos_packages_search_all(db, (gchar *)search, filter_box);
+		} else if (pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
+			list = box_db_repos_packages_search_installed(db, (gchar *)search, filter_box);
+		} else if (pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
+			list = box_db_repos_packages_search_available(db, (gchar *)search, filter_box);
 		}
+		add_packages_from_list (backend, list, FALSE);
+		box_db_repos_package_list_free (list);
 	}
 
 	db_close(db);
commit 6b68e0a4756b27188dd1732d68e1083955d4d276
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date:   Sat Apr 26 19:00:07 2008 +0300

    added backend_get_description

diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index cc543e0..d9d430b 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -77,11 +77,18 @@ cb_trans_conv (pmtransconv_t conv, void *data1, void *data2, void *data3, int *r
 }
 
 void
-cb_trans_progress (pmtransprog_t prog, const char *pkgname, int percent, int n, int remain)
+cb_trans_progress (pmtransprog_t event, const char *pkgname, int percent, int howmany, int remain)
 {
     pk_debug ("Percentage is %i", percent);
-    subprogress_percentage = percent;
-    pk_backend_set_percentage ((PkBackend *) install_backend, subprogress_percentage);
+    pk_backend_set_percentage ((PkBackend *) install_backend, percent);
+}
+
+void
+cb_dl_progress (const char *filename, int file_xfered, int file_total, int list_xfered, int list_total)
+{
+    int percent = (int) ((float) file_xfered / (float) file_total) * 100;
+    pk_debug ("Percentage is %i", percent);
+    pk_backend_set_percentage ((PkBackend *) install_backend, percent);
 }
 
 gboolean
@@ -611,6 +618,8 @@ backend_initialize (PkBackend *backend)
     }
     pk_debug ("alpm: ready to go");
 
+    alpm_option_set_dlcb(cb_dl_progress);
+
     network = pk_network_new();
 }
 
@@ -736,32 +745,20 @@ backend_refresh_cache (PkBackend *backend, gboolean force)
 	return;
     }
 
-    alpm_list_t *dbs = alpm_option_get_syncdbs ();
-/*
-    alpm_list_t *problems = NULL;
-*/
+    pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
 
-    if (alpm_trans_init (PM_TRANS_TYPE_SYNC, 0, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) {
+    install_backend = backend;
+    if (alpm_trans_init (PM_TRANS_TYPE_SYNC, PM_TRANS_FLAG_NOSCRIPTLET, cb_trans_evt, cb_trans_conv, cb_trans_progress) != 0) {
 	pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
 	pk_backend_finished (backend);
 	return;
     }
-
     pk_debug ("alpm: %s", "transaction initialized");
 
-/*
-    if (alpm_trans_prepare (&problems) != 0) {
-	pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
-	pk_backend_finished (backend);
-	return;
-    }
-*/
-
-    pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
-
+    alpm_list_t *dbs = alpm_option_get_syncdbs ();
     alpm_list_t *iterator;
     for (iterator = dbs; iterator; iterator = alpm_list_next (iterator)) {
-	if (alpm_db_update (force, (pmdb_t *) alpm_list_getdata (iterator))) {
+	if (alpm_db_update (0, (pmdb_t *) alpm_list_getdata (iterator))) {
 	    pk_backend_error_code (backend, PK_ERROR_ENUM_TRANSACTION_ERROR, alpm_strerror (pm_errno));
 	    pk_backend_finished (backend);
 	    return;
@@ -866,28 +863,29 @@ backend_search_details (PkBackend *backend, PkFilterEnum filters, const gchar *s
     g_return_if_fail (backend != NULL);
 
     alpm_list_t *result = NULL;
-    alpm_list_t *repos = NULL;
 
     pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
-    gboolean installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
-    gboolean ninstalled = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
+    gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
+    gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
 
-    if (!ninstalled)
-	repos = alpm_list_add (repos, alpm_option_get_localdb ());
-    if (!installed)
-	repos = alpm_list_join (repos, alpm_list_copy (alpm_option_get_syncdbs ()));
+    if (!search_not_installed) {
+	// Search in local db
+	result = alpm_list_join (result, find_packages_by_desc (search, alpm_option_get_localdb ()));
+    }
 
-    alpm_list_t *iterator;
-    for (iterator = repos; iterator; iterator = alpm_list_next (iterator))
-	result = alpm_list_join (result, find_packages_by_desc (search, (pmdb_t *) alpm_list_getdata(iterator)));
+    if (!search_installed) {
+	// Search in sync dbs
+	alpm_list_t *iterator;
+	for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
+	    result = alpm_list_join (result, find_packages_by_desc (search, (pmdb_t *) alpm_list_getdata(iterator)));
+    }
 
     add_packages_from_list (backend, alpm_list_first (result));
 
     alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
     alpm_list_free (result);
 
-    alpm_list_free (repos);
     pk_backend_finished (backend);
 }
 
@@ -899,29 +897,30 @@ backend_search_name (PkBackend *backend, PkFilterEnum filters, const gchar *sear
 {
     g_return_if_fail (backend != NULL);
 
-    alpm_list_t *repos = NULL;
     alpm_list_t *result = NULL;
 
     pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
 
-    gboolean installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
-    gboolean ninstalled = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
+    gboolean search_installed = pk_enums_contain (filters, PK_FILTER_ENUM_INSTALLED);
+    gboolean search_not_installed = pk_enums_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED);
 
-    if (!ninstalled)
-	repos = alpm_list_add (repos, alpm_option_get_localdb ());
-    if (!installed)
-	repos = alpm_list_join (repos, alpm_list_copy (alpm_option_get_syncdbs ()));
+    if (!search_not_installed) {
+	// Search in local db
+	result = alpm_list_join (result, find_packages_by_name (search, alpm_option_get_localdb ()));
+    }
 
-    alpm_list_t *iterator;
-    for (iterator = repos; iterator; iterator = alpm_list_next (iterator))
-	result = alpm_list_join (result, find_packages_by_name (search, (pmdb_t *) alpm_list_getdata(iterator)));
+    if (!search_installed) {
+	// Search in sync dbs
+	alpm_list_t *iterator;
+	for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator))
+	    result = alpm_list_join (result, find_packages_by_name (search, (pmdb_t *) alpm_list_getdata(iterator)));
+    }
 
     add_packages_from_list (backend, alpm_list_first (result));
 
     alpm_list_free_inner (result, (alpm_list_fn_free) package_source_free);
     alpm_list_free (result);
 
-    alpm_list_free (repos);
     pk_backend_finished (backend);
 }
 
@@ -934,7 +933,7 @@ backend_get_groups (PkBackend *backend)
     g_return_val_if_fail (backend != NULL, PK_GROUP_ENUM_UNKNOWN);
 
     // TODO: Provide support for groups in alpm
-    return PK_GROUP_ENUM_OTHER | PK_GROUP_ENUM_UNKNOWN;
+    return PK_GROUP_ENUM_OTHER;
 }
 
 /**
@@ -948,6 +947,61 @@ backend_get_filters (PkBackend *backend)
     return PK_FILTER_ENUM_INSTALLED;
 }
 
+/**
+ * backend_get_description:
+ */
+static void
+backend_get_description (PkBackend *backend, const gchar *package_id)
+{
+    g_return_if_fail (backend != NULL);
+
+    pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+    PkPackageId *pkg_id = pk_package_id_new_from_string (package_id);
+    // do all this fancy stuff
+    pmdb_t *repo = NULL;
+    if (strcmp ("local", pkg_id->data) == 0)
+	repo = alpm_option_get_localdb ();
+    else {
+	alpm_list_t *iterator;
+	for (iterator = alpm_option_get_syncdbs (); iterator; iterator = alpm_list_next (iterator)) {
+	    repo = alpm_list_getdata (iterator);
+	    if (strcmp (alpm_db_get_name (repo), pkg_id->data) == 0)
+		break;
+	}
+    }
+
+    if (repo == NULL) {
+	pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, alpm_strerror (pm_errno));
+	pk_package_id_free (pkg_id);
+	pk_backend_finished (backend);
+	return;
+    }
+
+    pmpkg_t *pkg = alpm_db_get_pkg (repo, pkg_id->name);
+    // free package id as we no longer need it
+    pk_package_id_free (pkg_id);
+
+    gchar *licenses;
+    alpm_list_t *licenses_list = alpm_pkg_get_licenses (pkg);
+    if (licenses_list == NULL)
+	licenses = "unknown";
+    else {
+	licenses = g_strnfill(100, '\0');
+	alpm_list_t *iterator;
+	for (iterator = licenses_list; iterator; iterator = alpm_list_next (iterator)) {
+	    if (iterator != licenses_list)
+		g_strlcat (licenses, ", ", 100);
+	    g_strlcat (licenses, alpm_list_getdata (iterator), 100);
+	}
+    }
+
+    pk_backend_description (backend, package_id, licenses, PK_GROUP_ENUM_OTHER, alpm_pkg_get_desc (pkg), alpm_pkg_get_url(pkg), alpm_pkg_get_size (pkg));
+    pk_backend_finished (backend);
+}
+
+/**
+ * backend_install_file:
+ */
 static void
 backend_install_file (PkBackend *backend, gboolean trusted, const gchar *path)
 {
@@ -1004,7 +1058,7 @@ backend_get_repo_list (PkBackend *backend, PkFilterEnum filters)
     alpm_list_t *iterator;
     for (iterator = repos; iterator; iterator = alpm_list_next(iterator)) {
 	pmdb_t *db = alpm_list_getdata (repos);
-	pk_backend_repo_detail (backend, alpm_db_get_name (db), alpm_db_get_url (db), TRUE);
+	pk_backend_repo_detail (backend, alpm_db_get_name (db), alpm_db_get_name (db), TRUE);
 	repos = alpm_list_next (repos);
     }
 
@@ -1020,7 +1074,7 @@ PK_BACKEND_OPTIONS (
 	backend_get_filters,				/* get_filters */
 	NULL,						/* cancel */
 	NULL,						/* get_depends */
-	NULL,						/* get_description */
+	backend_get_description,			/* get_description */
 	NULL,						/* get_files */
 	NULL,						/* get_packages */
 	backend_get_repo_list,				/* get_repo_list */


More information about the PackageKit-commit mailing list