[PackageKit-commit] packagekit: Branch 'master' - 4 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Jun 2 03:08:59 PDT 2010
NEWS | 57 ++++
backends/poldek/pk-backend-poldek.c | 332 +++++++++++++++++++----------
backends/yum/yumBackend.py | 2
configure.ac | 2
contrib/browser-plugin/pk-plugin-install.c | 19 -
docs/html/pk-download.html | 1
6 files changed, 294 insertions(+), 119 deletions(-)
New commits:
commit 40165edb4bf665ef45a4b888a90be3d0e943ed87
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jun 2 11:08:18 2010 +0100
Release version 0.6.5
diff --git a/NEWS b/NEWS
index ccfa549..de58c8c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,60 @@
+Version 0.6.5
+~~~~~~~~~~~~~
+Released: 2010-06-02
+
+Notes:
+ - Added pacman-glib backend (Jonathan Conder)
+
+Translations:
+ - Updates to Chinese (Taiwan) (zh_TW) translation (zerng07)
+ - Updates to Danish (da) translation (kristho)
+ - Updates to Finnish (fi) translation (vpv)
+
+Libraries:
+ - glib: Add some new PkTask methods that handle the Media and Eula callbacks (Richard Hughes)
+ - qt: Add Q_ENUMS to DaemonError (Adrien Bustany)
+ - python: Fix a typo in format_string (Sebastian Heinlein)
+
+Backends:
+ - APT: Adapt patch for name searching to the 0.6 API (Sebastian Heinlein)
+ - APT: Allow to do an AND search for multiple package names (Sebastian Heinlein)
+ - APT: Make sure to use format_string consequently on every output (Sebastian Heinlein)
+ - APT: Show a sub progress for package downloads (Sebastian Heinlein)
+ - APT: Use UTF-8 as default encoding and allow to write unicode to stdout (Sebastian Heinlein)
+ - entropy: Make backend working with latest Entropy releases (Fabio Erculiani)
+ - pacman: Add basic transaction infrastructure (Jonathan Conder)
+ - pacman: Add cancellation infrastructure (Jonathan Conder)
+ - pacman: Add dependency lookup (Jonathan Conder)
+ - pacman: Add error reporting infrastructure (Jonathan Conder)
+ - pacman: Add package-related methods and helpers (Jonathan Conder)
+ - pacman: Add searching support (Jonathan Conder)
+ - pacman: Add support for installing packages (Jonathan Conder)
+ - pacman: Add support for managing repos (Jonathan Conder)
+ - pacman: Add support for package groups (Jonathan Conder)
+ - pacman: Add support for removing packages (Jonathan Conder)
+ - pacman: Add support for updating packages (Jonathan Conder)
+ - yum: Attempt to use removable disk repos if they exist at backend startup (Richard Hughes)
+ - yum: Catch and ignore the socket exception on oddball systems. Fixes rh#596779
+ - yum: Do not abort init when Yum.conf does not contain some required keys (Richard Hughes)
+ - yum: Fix up the filter check when doing GetRepoList(). Fixes rh#598697
+ - yum: Remove all the MediaManager implementations and write a small GIO based callback (Richard Hughes)
+ - yum: The transaction root is not set at _init(), so we have to re-query the root when we start each action (Richard Hughes)
+ - yum: Use the system installed version of the zif accelerator (Richard Hughes)
+ - zypp: Detect and advertise from /etc/meego-release (Peter J Zhu)
+ - zypp: Re-factor to pass PkBackend around (Michael Meeks)
+ - zypp: Re-work install_packages_thread (Michael Meeks)
+ - zypp: Unify code used to generate the list of updates (Michael Meeks)
+
+New Features:
+ - Add --force argument to pkcon refresh (Michael Meeks)
+ - Show the MediaChangeRequired signals in pkmon (Richard Hughes)
+ - Use the new PkTask API in pkcon so we can deal with Media and Eula queries (Richard Hughes)
+
+Bugfixes:
+ - Build conditional BUILD_ZIF needs to be at the top level (Michael Meeks)
+ - Fix problem whereby the terminal wouldn't return data to scanf from a read (Michael Meeks)
+ - Fix up several daemon thinkos when a client tries to set a root other than '/' (Richard Hughes)
+
Version 0.6.4
~~~~~~~~~~~~~
Released: 2010-05-06
diff --git a/configure.ac b/configure.ac
index 2b7a4e4..ae0dfc6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -37,7 +37,7 @@ AC_SUBST(PK_VERSION)
# AGE If libpackagekit can be linked into executables which can be
# built with previous versions of this library. Don't use.
LT_CURRENT=14
-LT_REVISION=1
+LT_REVISION=2
LT_AGE=0
AC_SUBST(LT_CURRENT)
AC_SUBST(LT_REVISION)
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index 346c1d1..b7d6aae 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -68,6 +68,7 @@ Releases are normally on the first working Monday of each month.
</p>
<table>
<tr><td><b>Version</b></td><td> </td><td><b>Date</b></td></tr>
+<tr><td>0.6.5</td><td></td><td>2010-06-02</td></tr>
<tr><td>0.6.4</td><td></td><td>2010-05-06</td></tr>
<tr><td>0.6.3</td><td></td><td>2010-03-29</td></tr>
<tr><td>0.6.2</td><td></td><td>2010-03-01</td></tr>
commit 13cf587de0f4eead670438f77430952b9d814110
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jun 2 10:55:19 2010 +0100
trivial: remove the word link after unistd.h insanity
diff --git a/contrib/browser-plugin/pk-plugin-install.c b/contrib/browser-plugin/pk-plugin-install.c
index e91132d..5abdde8 100644
--- a/contrib/browser-plugin/pk-plugin-install.c
+++ b/contrib/browser-plugin/pk-plugin-install.c
@@ -446,7 +446,7 @@ pk_plugin_install_set_source_from_rgba (cairo_t *cr, guint32 rgba)
* the window.
**/
static void
-pk_plugin_install_get_style (PangoFontDescription **font_desc, guint32 *foreground, guint32 *background, guint32 *link)
+pk_plugin_install_get_style (PangoFontDescription **font_desc, guint32 *foreground, guint32 *background, guint32 *linked)
{
GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
GtkStyle *style;
@@ -465,8 +465,7 @@ pk_plugin_install_get_style (PangoFontDescription **font_desc, guint32 *foregrou
gdk_color_free (tmp);
}
- *link = pk_plugin_install_rgba_from_gdk_color (&link_color);
-
+ *linked = pk_plugin_install_rgba_from_gdk_color (&link_color);
*font_desc = pango_font_description_copy (style->font_desc);
gtk_widget_destroy (window);
@@ -680,7 +679,7 @@ pk_plugin_install_rounded_rectangle (cairo_t *cr, gdouble x, gdouble y,
static gboolean
pk_plugin_install_draw (PkPlugin *plugin, cairo_t *cr)
{
- guint32 foreground, background, link;
+ guint32 foreground, background, linked;
PangoFontDescription *font_desc;
guint x;
guint y;
@@ -722,7 +721,7 @@ pk_plugin_install_draw (PkPlugin *plugin, cairo_t *cr)
pk_debug ("drawing on %ux%u (%ux%u)", x, y, width, height);
/* get properties */
- pk_plugin_install_get_style (&font_desc, &foreground, &background, &link);
+ pk_plugin_install_get_style (&font_desc, &foreground, &background, &linked);
if (self->priv->update_spinner) {
self->priv->update_spinner = FALSE;
goto update_spinner;
@@ -761,7 +760,7 @@ pk_plugin_install_draw (PkPlugin *plugin, cairo_t *cr)
skip:
/* write text */
- pk_plugin_install_ensure_layout (self, cr, font_desc, link);
+ pk_plugin_install_ensure_layout (self, cr, font_desc, linked);
pango_layout_get_pixel_extents (self->priv->pango_layout, &rect, NULL);
cairo_move_to (cr, x + sep + 48 + sep, y + (height - (rect.height + 48) / 2) / 2);
pk_plugin_install_set_source_from_rgba (cr, foreground);
@@ -808,14 +807,14 @@ pk_plugin_install_line_is_terminated (PangoLayoutIter *iter)
*/
PangoLayoutLine *line = pango_layout_iter_get_line (iter);
GSList *lines = pango_layout_get_lines (pango_layout_iter_get_layout (iter));
- GSList *link = g_slist_find (lines, line);
- if (!link) {
+ GSList *found = g_slist_find (lines, line);
+ if (!found) {
pk_warning ("Can't find line in layout line list");
return FALSE;
}
- if (link->next) {
- PangoLayoutLine *next_line = (PangoLayoutLine *)link->next->data;
+ if (found->next) {
+ PangoLayoutLine *next_line = (PangoLayoutLine *)found->next->data;
if (next_line->is_paragraph_start)
return TRUE;
}
commit 72a5f91e354697c53ac82d91b348d627fdf52c1f
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Jun 2 09:20:34 2010 +0100
yum: Fix up the filter check when doing GetRepoList(). Fixes rh#598697
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 94d7dab..e2878b9 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -2682,7 +2682,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self.error(ERROR_INTERNAL_ERROR, _format_str(traceback.format_exc()))
return
for repo in repos:
- if filters != FILTER_NOT_DEVELOPMENT or not _is_development_repo(repo.id):
+ if not FILTER_NOT_DEVELOPMENT in filters or not _is_development_repo(repo.id):
enabled = repo.isEnabled()
self.repo_detail(repo.id, repo.name, enabled)
commit 1ed4c0c35ab8637c912a3d0dcc54295ed89356db
Author: Marcin Banasiak <marcin.banasiak at gmail.com>
Date: Sun May 30 18:38:05 2010 +0200
poldek: port backend to new API
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 12480c2..131d780 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*
- * Copyright (C) 2008-2009 Marcin Banasiak <megabajt at pld-linux.org>
+ * Copyright (C) 2008-2010 Marcin Banasiak <megabajt at pld-linux.org>
*
* Licensed under the GNU General Public License Version 2
*
@@ -69,24 +69,24 @@ typedef struct {
} PLDGroupRegex;
static PLDGroupRegex group_perlre[] = {
- {PK_GROUP_ENUM_ACCESSORIES, "/.*Archiving\\|.*Dictionaries/"},
- {PK_GROUP_ENUM_ADMIN_TOOLS, "/.*Databases.*\\|.*Admin/"},
- {PK_GROUP_ENUM_COMMUNICATION, "/.*Communications/"},
- {PK_GROUP_ENUM_DOCUMENTATION, "/Documentation/"},
- {PK_GROUP_ENUM_EDUCATION, "/.*Engineering\\|.*Math\\|.*Science/"},
- {PK_GROUP_ENUM_FONTS, "/Fonts/"},
- {PK_GROUP_ENUM_GAMES, "/.*Games.*/"},
- {PK_GROUP_ENUM_GRAPHICS, "/.*Graphics/"},
- {PK_GROUP_ENUM_LOCALIZATION, "/I18n/"},
- {PK_GROUP_ENUM_MULTIMEDIA, "/.*Multimedia\\|.*Sound/"},
- {PK_GROUP_ENUM_NETWORK, "/.*Networking.*\\|/.*Mail\\|.*News\\|.*WWW/"},
- {PK_GROUP_ENUM_OFFICE, "/.*Editors.*\\|.*Spreadsheets/"},
- {PK_GROUP_ENUM_OTHER, "/^Applications$\\|.*Console\\|.*Emulators\\|.*File\\|.*Printing\\|.*Terminal\\|.*Text\\|^Libraries.*\\|^Themes.*\\|^X11$\\|.*Amusements\\|^X11\\/Applications$\\|^X11\\/Libraries$\\|.*Window\\ Managers.*/"},
- {PK_GROUP_ENUM_PROGRAMMING, "/.*Development.*/"},
- {PK_GROUP_ENUM_PUBLISHING, "/.*Publishing.*/"},
- {PK_GROUP_ENUM_SERVERS, "/Daemons\\|.*Servers/"},
- {PK_GROUP_ENUM_SYSTEM, "/.*Shells\\|.*System\\|Base.*/"},
- {0, NULL}
+ { PK_GROUP_ENUM_ACCESSORIES, ".*Archiving\\|.*Dictionaries" },
+ { PK_GROUP_ENUM_ADMIN_TOOLS, ".*Databases.*\\|.*Admin" },
+ { PK_GROUP_ENUM_COMMUNICATION, ".*Communications" },
+ { PK_GROUP_ENUM_DOCUMENTATION, "Documentation" },
+ { PK_GROUP_ENUM_EDUCATION, ".*Engineering\\|.*Math\\|.*Science" },
+ { PK_GROUP_ENUM_FONTS, "Fonts" },
+ { PK_GROUP_ENUM_GAMES, ".*Games.*" },
+ { PK_GROUP_ENUM_GRAPHICS, ".*Graphics" },
+ { PK_GROUP_ENUM_LOCALIZATION, "I18n" },
+ { PK_GROUP_ENUM_MULTIMEDIA, ".*Multimedia\\|.*Sound" },
+ { PK_GROUP_ENUM_NETWORK, ".*Networking.*\\|/.*Mail\\|.*News\\|.*WWW" },
+ { PK_GROUP_ENUM_OFFICE, ".*Editors.*\\|.*Spreadsheets" },
+ { PK_GROUP_ENUM_OTHER, "^Applications$\\|.*Console\\|.*Emulators\\|.*File\\|.*Printing\\|.*Terminal\\|.*Text\\|^Libraries.*\\|^Themes.*\\|^X11$\\|.*Amusements\\|^X11\\/Applications$\\|^X11\\/Libraries$\\|.*Window\\ Managers.*" },
+ { PK_GROUP_ENUM_PROGRAMMING, ".*Development.*" },
+ { PK_GROUP_ENUM_PUBLISHING, ".*Publishing.*" },
+ { PK_GROUP_ENUM_SERVERS, "Daemons\\|.*Servers" },
+ { PK_GROUP_ENUM_SYSTEM, ".*Shells\\|.*System\\|Base.*" },
+ { 0, NULL }
};
typedef struct {
@@ -927,20 +927,21 @@ pld_group_to_enum (const gchar *group)
}
/**
- * pld_group_get_regex_from_enum:
+ * pld_group_get_regex_from_text:
**/
static const gchar*
-pld_group_get_regex_from_enum (PkGroupEnum value)
+pld_group_get_regex_from_text (const gchar *str)
{
- gint i;
+ guint i = 0;
- for (i = 0;; i++) {
- if (group_perlre[i].regex == NULL)
- return NULL;
-
- if (group_perlre[i].group == value)
+ while (group_perlre[i].regex) {
+ if (pk_group_enum_from_string (str) == group_perlre[i].group)
return group_perlre[i].regex;
+
+ i++;
}
+
+ return NULL;
}
/**
@@ -1516,6 +1517,47 @@ poldek_get_pkg_from_package_id (const gchar *package_id)
return pkg;
}
+static tn_array*
+do_search_details (const gchar *tree, gchar **values)
+{
+ guint i;
+ tn_array *pkgs = NULL;
+
+ g_return_val_if_fail (tree != NULL, NULL);
+ g_return_val_if_fail (values != NULL, NULL);
+
+ pkgs = execute_packages_command ("%s; search -qsd *%s*", tree, values[0]);
+
+ if (g_strv_length (values) > 1) {
+ GString *pkgnames = NULL;
+
+ pkgnames = g_string_new ("");
+
+ for (i = 1; pkgs && i < g_strv_length (values); i++) {
+ guint j;
+
+ g_string_truncate (pkgnames, 0);
+
+ /* create string from pkgs names */
+ for (j = 0; j < n_array_size (pkgs); j++) {
+ struct pkg *pkg = n_array_nth (pkgs, j);
+
+ g_string_append (pkgnames, pkg_id (pkg));
+ g_string_append_c (pkgnames, ' ');
+ }
+
+ n_array_free (pkgs);
+
+ pkgs = execute_packages_command ("%s; search -qsd \"*%s*\" %s",
+ tree, values[i], pkgnames->str);
+ }
+
+ g_string_free (pkgnames, TRUE);
+ }
+
+ return pkgs;
+}
+
/**
* search_package_thread:
*/
@@ -1527,7 +1569,8 @@ search_package_thread (PkBackend *backend)
gchar *search_cmd_available = NULL;
gchar *search_cmd_installed = NULL;
tn_array *pkgs = NULL;
- const gchar *search;
+ gchar **values = NULL;
+ gchar *search;
guint mode;
pb_load_packages (backend);
@@ -1535,73 +1578,117 @@ search_package_thread (PkBackend *backend)
mode = pk_backend_get_uint (backend, "mode");
filters = pk_backend_get_uint (backend, "filters");
- /* GetPackages */
- if (mode == SEARCH_ENUM_NONE) {
- search_cmd_installed = g_strdup ("ls -q");
- search_cmd_available = g_strdup (search_cmd_installed);
+ values = pk_backend_get_strv (backend, "search");
+
+ if (values == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR,
+ "failed to get 'search'");
+ goto out;
+ }
+
/* SearchName */
- } else if (mode == SEARCH_ENUM_NAME) {
- search = pk_backend_get_string (backend, "search");
+ if (mode == SEARCH_ENUM_NAME) {
+ search = g_strjoinv ("*", values);
search_cmd_installed = g_strdup_printf ("ls -q *%s*", search);
search_cmd_available = g_strdup (search_cmd_installed);
+
+ g_free (search);
/* SearchGroup */
} else if (mode == SEARCH_ENUM_GROUP) {
- PkGroupEnum group;
- const gchar *regex;
+ GString *command;
+ guint i;
- search = pk_backend_get_string (backend, "search");
+ command = g_string_new ("search -qg --perlre /");
- group = pk_group_enum_from_string (search);
- regex = pld_group_get_regex_from_enum (group);
+ for (i = 0; i < g_strv_length (values); i++) {
+ const gchar *regex = NULL;
- search_cmd_installed = g_strdup_printf ("search -qg --perlre %s", regex);
- search_cmd_available = g_strdup (search_cmd_installed);
- /* SearchDetails */
- } else if (mode == SEARCH_ENUM_DETAILS) {
- search = pk_backend_get_string (backend, "search");
+ regex = pld_group_get_regex_from_text (values[i]);
+
+ if (regex == NULL) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_GROUP_NOT_FOUND,
+ "The group '%s' does not exist.", values[i]);
+ g_string_free (command, TRUE);
+ goto out;
+ }
- search_cmd_installed = g_strdup_printf ("search -dsq *%s*", search);
+ if (i > 0)
+ g_string_append (command, "\\|");
+
+ g_string_append (command, regex);
+ }
+
+ g_string_append_c (command, '/');
+
+ search_cmd_installed = g_string_free (command, FALSE);
search_cmd_available = g_strdup (search_cmd_installed);
/* SearchFile */
} else if (mode == SEARCH_ENUM_FILE) {
- search = pk_backend_get_string (backend, "search");
+ GString *local_pkgs = NULL;
+ GString *installed_pkgs = NULL;
+ GString *available_pkgs = NULL;
+ guint i;
+
+ local_pkgs = g_string_new ("");
+ installed_pkgs = g_string_new ("");
+ available_pkgs = g_string_new ("");
+
+ for (i = 0; i < g_strv_length (values); i++) {
+ if (available_pkgs->len > 0)
+ g_string_append (available_pkgs, "\\|");
+
+ if (*values[i] == '/') {
+ gchar *pkgid = NULL;
+
+ /* use rpmdb to get local packages (equivalent to: rpm -qf /foo/bar) */
+ if ((pkgid = get_pkgid_from_localpath (values[i]))) {
+ g_string_append_printf (local_pkgs, " %s", pkgid);
+ g_free (pkgid);
+ }
+
+ g_string_append_printf (available_pkgs, "^%s$", values[i]);
+ } else {
+
+ g_string_append_printf (available_pkgs, ".*%s.*", values[i]);
- if (*search == '/') {
- gchar *pkgid = NULL;
+ if (installed_pkgs->len > 0)
+ g_string_append (installed_pkgs, "\\|");
- /* use rpmdb to get local packages (equivalent to: rpm -qf /foo/bar) */
- if ((pkgid = get_pkgid_from_localpath (search))) {
- search_cmd_installed = g_strdup_printf ("ls -q %s", pkgid);
- g_free (pkgid);
+ g_string_append_printf (installed_pkgs, ".*%s.*", values[i]);
}
+ }
- search_cmd_available = g_strdup_printf ("search -ql --perlre /^%s$/", search);
- } else {
- search_cmd_installed = g_strdup_printf ("search -ql --perlre /.*%s.*/", search);
- search_cmd_available = g_strdup (search_cmd_installed);
+ if (installed_pkgs->len > 0) {
+ g_string_prepend (installed_pkgs, "search -ql --perlre /");
+ g_string_append (installed_pkgs, "/;");
}
+
+ if (local_pkgs->len > 0)
+ g_string_append_printf (installed_pkgs, "ls -q %s", local_pkgs->str);
+
+ g_string_prepend (available_pkgs, "search -ql --perlre /");
+ g_string_append_c (available_pkgs, '/');
+
+ g_string_free (local_pkgs, TRUE);
+
+ search_cmd_installed = g_string_free (installed_pkgs, FALSE);
+ search_cmd_available = g_string_free (available_pkgs, FALSE);
+
/* WhatProvides */
} else if (mode == SEARCH_ENUM_PROVIDES) {
- provides = pk_backend_get_uint (backend, "provides");
-
- search = pk_backend_get_string (backend, "search");
+ search = g_strjoinv ("\\|", values);
- if (provides == PK_PROVIDES_ENUM_ANY || provides == PK_PROVIDES_ENUM_CODEC) {
- search_cmd_installed = g_strdup_printf ("search -qp %s", search);
- } else if (provides == PK_PROVIDES_ENUM_MODALIAS) {
- } else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
- search_cmd_installed = g_strdup_printf ("search -qp mimetype(%s)", search);
- }
+ search_cmd_installed = g_strdup_printf ("search -qp --perlre /%s/", search);
+ search_cmd_available = g_strdup_printf ("search -qp --perlre /%s/", search);
- search_cmd_available = g_strdup (search_cmd_installed);
+ g_free (search);
/* Resolve */
} else if (mode == SEARCH_ENUM_RESOLVE) {
gchar **package_ids;
gchar *packages_str;
package_ids = pk_backend_get_strv (backend, "package_ids");
-
packages_str = g_strjoinv(" ", package_ids);
search_cmd_installed = g_strdup_printf ("ls -q %s", packages_str);
@@ -1610,37 +1697,30 @@ search_package_thread (PkBackend *backend)
g_free (packages_str);
}
- if (search_cmd_installed != NULL || search_cmd_available != NULL) {
- tn_array *installed = NULL, *available = NULL;
+ if ((search_cmd_installed != NULL && search_cmd_available != NULL) || mode == SEARCH_ENUM_DETAILS) {
+ tn_array *installed = NULL;
+ tn_array *available = NULL;
- if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED) && search_cmd_installed) {
- installed = execute_packages_command ("cd /installed; %s", search_cmd_installed);
+ if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
+ if (mode == SEARCH_ENUM_DETAILS)
+ installed = do_search_details ("cd /installed", values);
+ else
+ installed = execute_packages_command ("cd /installed; %s", search_cmd_installed);
}
- if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED) && search_cmd_available) {
- available = execute_packages_command ("cd /all-avail; %s", search_cmd_available);
+ if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED)) {
+ if (mode == SEARCH_ENUM_DETAILS)
+ available = do_search_details ("cd /all-avail", values);
+ else
+ available = execute_packages_command ("cd /all-avail; %s", search_cmd_available);
}
+ /* merge installed and available */
if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED) &&
- !pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED) &&
- installed && available) {
- guint i;
-
- pkgs = available;
-
- for (i = 0; i < n_array_size (installed); i++) {
- struct pkg *pkg = n_array_nth (installed, i);
-
- /* check for duplicates */
- if (!poldek_pkg_in_array (pkg, pkgs, (tn_fn_cmp)pkg_cmp_name_evr)) {
- n_array_push (pkgs, pkg_link (pkg));
- }
- }
-
- n_array_sort_ex(pkgs, (tn_fn_cmp)pkg_cmp_name_evr_rev_recno);
-
- n_array_free (installed);
+ !pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED)) {
+ pkgs = do_post_search_process (installed, available);
+ /* filter out installed packages from available */
} else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_NOT_INSTALLED) && available) {
tn_array *dbpkgs = NULL;
guint i;
@@ -1657,19 +1737,24 @@ search_package_thread (PkBackend *backend)
}
}
- n_array_free (available);
n_array_free (dbpkgs);
} else if (available) {
- pkgs = available;
+ pkgs = n_ref (available);
} else if (pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED) || installed)
- pkgs = installed;
+ pkgs = n_ref (installed);
+
+ if (installed)
+ n_array_free (installed);
+
+ if (available)
+ n_array_free (available);
}
do_filtering (pkgs, filters);
- if (pkgs) {
+ if (pkgs && n_array_size (pkgs) > 0) {
guint i;
for (i = 0; i < n_array_size (pkgs); i++) {
@@ -1702,6 +1787,7 @@ search_package_thread (PkBackend *backend)
g_free (search_cmd_installed);
g_free (search_cmd_available);
+out:
pk_backend_finished (backend);
return TRUE;
}
@@ -2138,12 +2224,16 @@ poldek_reload (PkBackend *backend, gboolean load_packages) {
static void
backend_initalize (PkBackend *backend)
{
+ egg_debug ("backend initalize start");
+
clv = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)n_array_free);
pberror = g_new0 (PbError, 1);
pberror->tslog = g_string_new ("");
do_poldek_init (backend);
+
+ egg_debug ("backend initalize end");
}
/**
* backend_destroy:
@@ -3005,7 +3095,7 @@ backend_remove_packages (PkBackend *backend, gchar **package_ids, gboolean allow
* backend_resolve:
*/
static void
-backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
+backend_resolve (PkBackend *backend, PkBitfield filters, gchar **packages)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
@@ -3018,7 +3108,7 @@ backend_resolve (PkBackend *backend, PkBitfield filters, gchar **package_ids)
* backend_search_details:
*/
static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_details (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
@@ -3028,10 +3118,10 @@ backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *sea
}
/**
- * backend_search_file:
+ * backend_search_files:
*/
static void
-backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_files (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
@@ -3041,10 +3131,10 @@ backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search
}
/**
- * backend_search_group:
+ * backend_search_groups:
*/
static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_groups (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
@@ -3054,10 +3144,10 @@ backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *searc
}
/**
- * backend_search_name:
+ * backend_search_names:
*/
static void
-backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search)
+backend_search_names (PkBackend *backend, PkBitfield filters, gchar **values)
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
@@ -3144,14 +3234,42 @@ backend_get_repo_list (PkBackend *backend, PkBitfield filters)
* backend_what_provides:
**/
static void
-backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, const gchar *search)
+backend_what_provides (PkBackend *backend, PkBitfield filters, PkProvidesEnum provides, gchar **values)
{
+ GPtrArray *array = NULL;
+ gchar **search = NULL;
+ guint i;
+
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
poldek_backend_set_allow_cancel (backend, TRUE, TRUE);
pb_error_clean ();
pk_backend_set_uint (backend, "mode", SEARCH_ENUM_PROVIDES);
+
+ /* prepare array of commands */
+ array = g_ptr_array_new_with_free_func (g_free);
+
+ for (i = 0; i < g_strv_length (values); i++) {
+ if (provides == PK_PROVIDES_ENUM_ANY) {
+ g_ptr_array_add (array, g_strdup_printf ("%s", values[i]));
+ g_ptr_array_add (array, g_strdup_printf ("gstreamer0.10\\(%s\\)", values[i]));
+ g_ptr_array_add (array, g_strdup_printf ("mimetype\\(%s\\)", values[i]));
+ } else if (provides == PK_PROVIDES_ENUM_CODEC) {
+ g_ptr_array_add (array, g_strdup_printf ("gstreamer0.10\\(%s\\)", values[i]));
+ } else if (provides == PK_PROVIDES_ENUM_MIMETYPE) {
+ g_ptr_array_add (array, g_strdup_printf ("mimetype\\(%s\\)", values[i]));
+ } else {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_PROVIDE_TYPE_NOT_SUPPORTED,
+ "provide type '%s' not supported",
+ pk_provides_enum_to_text (provides));
+ }
+ }
+
+ search = pk_ptr_array_to_strv (array);
+ pk_backend_set_strv (backend, "search", search);
pk_backend_thread_create (backend, search_package_thread);
+ g_strfreev (search);
+ g_ptr_array_unref (array);
}
static gboolean do_simulate_packages (PkBackend *backend)
@@ -3310,9 +3428,9 @@ PK_BACKEND_OPTIONS (
backend_resolve, /* resolve */
NULL, /* rollback */
backend_search_details, /* search_details */
- backend_search_file, /* search_file */
- backend_search_group, /* search_group */
- backend_search_name, /* search_name */
+ backend_search_files, /* search_file */
+ backend_search_groups, /* search_group */
+ backend_search_names, /* search_name */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
backend_what_provides, /* what_provides */
More information about the PackageKit-commit
mailing list