[PackageKit-commit] packagekit: Branch 'master' - 43 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Mon Sep 22 07:56:43 PDT 2008
NEWS | 46 ++
backends/dummy/pk-backend-dummy.c | 11
backends/smart/helpers/get-update-detail.py | 20 +
backends/smart/helpers/smartBackend.py | 157 +++++++-
backends/smart/pk-backend-smart.c | 14
backends/yum/yumBackend.py | 26 +
backends/yum/yumComps.py | 9
backends/zypp/pk-backend-zypp.cpp | 32 +
backends/zypp/zypp-utils.cpp | 18
client/pk-console.c | 6
client/pk-generate-package-list.c | 10
client/pk-import-desktop.c | 27 +
client/pk-import-specspo.c | 23 -
configure.ac | 2
docs/html/pk-download.html | 1
docs/html/pk-matrix.html | 4
etc/PackageKit.conf.in | 8
libpackagekit/pk-enum.c | 2
libpackagekit/pk-enum.h | 2
python/enum-convertor.py | 2
python/packagekit/client.py | 17
src/Makefile.am | 2
src/pk-refresh.c | 506 ++++++++++++++++++++++++++++
src/pk-refresh.h | 59 +++
src/pk-transaction.c | 113 ++----
src/pk-transaction.h | 6
tools/add-error-enum.sh | 2
27 files changed, 978 insertions(+), 147 deletions(-)
New commits:
commit 387857f4b04f7b6b00c0b86507120dc13d1d402a
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 15:52:21 2008 +0100
Release version 0.3.4
diff --git a/NEWS b/NEWS
index 2dadc37..45a27ee 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,49 @@
+Version 0.3.4
+~~~~~~~~~~~~~~
+Released: 2008-09-22
+
+New Features:
+ - Add PK_PROVIDES_ENUM_HARDWARE_DRIVER to query for hardware drivers (Scott Reeves)
+ - python: Implemented some extra methods and did some code cleanups (Tim Lauridsen)
+ - python: Removed packagekitwrapper.py, it is replaced by packagekit/client.py (Tim Lauridsen)
+ - python: Implemented the last methods and make the wrapper-test.py a lot better (Tim Lauridsen)
+ - Change RefreshCacheScanDesktopFiles and RefreshCacheUpdatePackageList to default true (Richard Hughes)
+ - Use a new in-process desktop scanner and package list generator (Richard Hughes)
+ - Add a --quiet flag for the import tools (Richard Hughes)
+
+Bugfixes:
+ - Add PLD to pk_get_distro_id (Marcin Banasiak)
+ - Split the dispatcher commands using tab else we don't handle filenames
+ with spaces in them correctly (Richard Hughes)
+ - Store translations in the C locale so we can still provide a package name
+ in C even if there are no translations (Richard Hughes)
+ - Emit a proper error code when we can't start the dameon (Richard Hughes)
+ - Don't show a critical warning if we can't start up the daemon (Richard Hughes)
+ - Use gconstpointer rather than const gpointer (Richard Hughes)
+ - Make pkcon always overwrite the percentage values (Richard Hughes)
+ - python API: return objects instead of dict (Tim Lauridsen)
+
+Backends:
+ - dummy: Respect the filter setting in SearchFile (Richard Hughes)
+ - smart: Add download status for non-package/repodata files (Anders F Bjorklund)
+ - smart: Implement GetUpdateDetail (Anders F Bjorklund)
+ - smart: Only allow one download at a time, to avoid confusing interface (Anders F Bjorklund)
+ - urpmi: Now using dispatched backend (Aurelien Lefebvre)
+ - yum: Make meta packages use verbose name as summary, insted of description (Tim Lauridsen)
+ - yum: Fix a potential problem if the package_id could not be found (Richard Hughes)
+ - yum: Hook up get-distro-upgrades in the dispatcher (Richard Hughes)
+ - yum: Don't try and upgrade kernel when we GetDistroUpgrades (Richard Hughes)
+ - yum: Don't report the collection version or arch as meta (Richard Hughes)
+ - yum: Add the collection size to the output of GetDetails (Richard Hughes)
+ - yum: get-updates should list obsoletes too (Tim Lauridsen)
+ - yum: GetDepends return packages added from group, not only deps (Tim Lauridsen)
+ - zypp: Fix the separator when returning multiple id's (Scott Reeves)
+ - zypp: Build pool before solving (Stefan Haas)
+ - zypp: Cleaned WhatProvides method (Stefan Haas)
+ - zypp: Fix potential segfault (Martin S)
+ - zypp: Check provides if no package was found (Stefan Haas)
+ - zypp: Package expects a summary, not a (long) description (Martin S)
+
Version 0.3.3
~~~~~~~~~~~~~~
Released: 2008-09-16
diff --git a/configure.ac b/configure.ac
index 8e048c0..5157f9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ DEVELOPMENT_RELEASE=no
# REVISION If the API and ABI remains the same, but bugs are fixed.
# AGE If libpackagekit can be linked into executables which can be
# built with previous versions of this library. Don't use.
-LT_CURRENT=6
+LT_CURRENT=7
LT_REVISION=0
LT_AGE=0
AC_SUBST(LT_CURRENT)
diff --git a/docs/html/pk-download.html b/docs/html/pk-download.html
index 4dee921..75f037d 100644
--- a/docs/html/pk-download.html
+++ b/docs/html/pk-download.html
@@ -74,6 +74,7 @@ Releases are normally once every 1-2 weeks.
<tr><td>0.3.1</td><td></td><td>2008-08-27</td></tr>
<tr><td>0.3.2</td><td></td><td>2008-09-08</td></tr>
<tr><td>0.3.3</td><td></td><td>2008-09-16</td></tr>
+<tr><td>0.3.4</td><td></td><td>2008-09-22</td></tr>
</table>
<h3>
ABI Stable Versions:
commit 16063ca7cbf9c8ccccf91a032f59cd2c78576620
Merge: 527c8db... f214d3f...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 15:30:43 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 527c8db043c815ce4707982f0a33579152b0a6ec
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 15:30:00 2008 +0100
feature: use a new in-process desktop scanner and package list generator, but leave then default off as they can crash the daemon
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 16dd0f3..f72dc04 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -71,6 +71,7 @@
#include "pk-cache.h"
#include "pk-notify.h"
#include "pk-security.h"
+#include "pk-refresh.h"
static void pk_transaction_class_init (PkTransactionClass *klass);
static void pk_transaction_init (PkTransaction *transaction);
@@ -79,6 +80,9 @@ static void pk_transaction_finalize (GObject *object);
#define PK_TRANSACTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_TRANSACTION, PkTransactionPrivate))
#define PK_TRANSACTION_UPDATES_CHANGED_TIMEOUT 100 /* ms */
+static void pk_transaction_status_changed_cb (PkBackend *backend, PkStatusEnum status, PkTransaction *transaction);
+static void pk_transaction_progress_changed_cb (PkBackend *backend, guint percentage, guint subpercentage, guint elapsed, guint remaining, PkTransaction *transaction);
+
struct PkTransactionPrivate
{
PkRoleEnum role;
@@ -372,7 +376,6 @@ pk_transaction_allow_cancel_cb (PkBackend *backend, gboolean allow_cancel, PkTra
else
pk_inhibit_add (transaction->priv->inhibit, transaction);
-
egg_debug ("emitting allow-interrpt %i", allow_cancel);
g_signal_emit (transaction, signals [PK_TRANSACTION_ALLOW_CANCEL], 0, allow_cancel);
}
@@ -472,13 +475,9 @@ static void
pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *transaction)
{
gboolean ret;
- GError *error = NULL;
const gchar *exit_text;
- gchar *filename;
guint time;
gchar *packages;
- gchar *exec;
- gchar *command;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
g_return_if_fail (transaction->priv->tid != NULL);
@@ -489,6 +488,48 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
return;
}
+ /* 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_details);
+ 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_distro_upgrade);
+ 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_eula_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);
+
+ /* do some optional extra actions when we've finished refreshing the cache */
+ if (transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
+ PkRefresh *refresh;
+ refresh = pk_refresh_new ();
+
+ g_signal_connect (refresh, "status-changed",
+ G_CALLBACK (pk_transaction_status_changed_cb), transaction);
+ g_signal_connect (refresh, "progress-changed",
+ G_CALLBACK (pk_transaction_progress_changed_cb), transaction);
+
+ /* generate the package list */
+ ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheUpdatePackageListBugfix");
+ if (ret)
+ pk_refresh_update_package_list (refresh);
+
+ /* refresh the desktop icon cache */
+ ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheScanDesktopFilesBugfix");
+ if (ret)
+ pk_refresh_import_desktop_files (refresh);
+
+ /* clear the firmware requests directory */
+ pk_refresh_clear_firmware_requests (refresh);
+ g_object_unref (refresh);
+ }
+
/* we should get no more from the backend with this tid */
transaction->priv->finished = TRUE;
@@ -540,66 +581,6 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
/* remove any inhibit */
pk_inhibit_remove (transaction->priv->inhibit, transaction);
- /* 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_details);
- 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_distro_upgrade);
- 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_eula_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);
-
- /* do some optional extra actions when we've finished refreshing the cache */
- if (transaction->priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
- /* asynchronously generate the package list
- * NOTE: we can't do this in process as it uses PkClient */
- ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheUpdatePackageList");
- if (ret) {
- exec = g_build_filename (LIBEXECDIR, "pk-generate-package-list", NULL);
- command = g_strdup_printf ("%s --quiet", exec);
- egg_debug ("running helper %s", command);
- ret = g_spawn_command_line_async (command, &error);
- if (!ret) {
- egg_warning ("failed to execute %s: %s", command, error->message);
- g_error_free (error);
- }
- g_free (exec);
- g_free (command);
- }
-
- /* refresh the desktop icon cache
- * NOTE: we can't do this in process as it uses PkClient */
- ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheScanDesktopFiles");
- if (ret) {
- exec = g_build_filename (LIBEXECDIR, "pk-import-desktop", NULL);
- command = g_strdup_printf ("%s --quiet", exec);
- egg_debug ("running helper %s", command);
- ret = g_spawn_command_line_async (command, &error);
- if (!ret) {
- egg_warning ("failed to execute %s: %s", command, error->message);
- g_error_free (error);
- }
- g_free (exec);
- g_free (command);
- }
-
- /* clear the firmware requests directory */
- filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
- egg_debug ("clearing udev firmware requests at %s", filename);
- ret = pk_directory_remove_contents (filename);
- if (!ret)
- egg_warning ("failed to clear %s", filename);
- g_free (filename);
- }
-
/* we emit last, as other backends will be running very soon after us, and we don't want to be notified */
exit_text = pk_exit_enum_to_text (exit);
egg_debug ("emitting finished '%s', %i", exit_text, time);
commit f214d3ffb6ed306fdc598286e117ed79b1bd30d8
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 16:29:14 2008 +0200
trivial: copy/paste bug
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 7ee2720..d799317 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -1034,7 +1034,6 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
name = name.replace('^', '@', 1)
if not loader:
for loader in package.loaders:
- channel = loader.getChannel()
break
channel = loader.getChannel()
if package.installed:
commit 091425c21b09ae806b3363da30888f25fab7dbe9
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 16:28:32 2008 +0200
trivial: it's not an array
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index c174250..7ee2720 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -1033,7 +1033,9 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
collection = True
name = name.replace('^', '@', 1)
if not loader:
- loader = package.loaders[0]
+ for loader in package.loaders:
+ channel = loader.getChannel()
+ break
channel = loader.getChannel()
if package.installed:
data = 'installed'
commit acaceda1173822ec05a258976c38d0e06ab4c6a2
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 15:23:24 2008 +0100
trivial bugfix: disconnect ::Finished() and ::Package() after using to fix a segfault
diff --git a/src/pk-refresh.c b/src/pk-refresh.c
index 0e23769..6453667 100644
--- a/src/pk-refresh.c
+++ b/src/pk-refresh.c
@@ -43,6 +43,8 @@ struct PkRefreshPrivate
PkExtra *extra;
GMainLoop *loop;
PkPackageList *list;
+ guint finished_id;
+ guint package_id;
};
enum {
@@ -339,10 +341,12 @@ pk_refresh_update_package_list (PkRefresh *refresh)
/* clear old list */
pk_package_list_clear (refresh->priv->list);
+ /* update UI */
+ pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_refresh_emit_progress_changed (refresh, 101);
+
/* get the new package list */
pk_backend_reset (refresh->priv->backend);
- pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
- pk_refresh_emit_progress_changed (refresh, 0);
refresh->priv->backend->desc->get_packages (refresh->priv->backend, PK_FILTER_ENUM_NONE);
/* wait for finished */
@@ -396,6 +400,9 @@ pk_refresh_finalize (GObject *object)
g_return_if_fail (PK_IS_REFRESH (object));
refresh = PK_REFRESH (object);
+ g_signal_handler_disconnect (refresh->priv->backend, refresh->priv->finished_id);
+ g_signal_handler_disconnect (refresh->priv->backend, refresh->priv->package_id);
+
if (g_main_loop_is_running (refresh->priv->loop))
g_main_loop_quit (refresh->priv->loop);
g_main_loop_unref (refresh->priv->loop);
@@ -445,10 +452,12 @@ pk_refresh_init (PkRefresh *refresh)
refresh->priv->list = pk_package_list_new ();
refresh->priv->backend = pk_backend_new ();
- g_signal_connect (refresh->priv->backend, "finished",
- G_CALLBACK (pk_refresh_finished_cb), refresh);
- g_signal_connect (refresh->priv->backend, "package",
- G_CALLBACK (pk_refresh_package_cb), refresh);
+ refresh->priv->finished_id =
+ g_signal_connect (refresh->priv->backend, "finished",
+ G_CALLBACK (pk_refresh_finished_cb), refresh);
+ refresh->priv->package_id =
+ g_signal_connect (refresh->priv->backend, "package",
+ G_CALLBACK (pk_refresh_package_cb), refresh);
refresh->priv->extra = pk_extra_new ();
commit 2253b7383fd0aa95051495bb0d99a8666bce3341
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 16:22:24 2008 +0200
smart: use package_id for get_details, to get data right
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index d8c1195..c174250 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -755,8 +755,8 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
group = self._get_group(info)
- self.details(packageid, license, group, description, url,
- pkgsize)
+ self.details(self._package_id(package),
+ license, group, description, url, pkgsize)
@needs_cache
def get_files(self, packageids):
commit b38f89d42c4c28225af749d7d4a0d8df86cc32b4
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 15:06:54 2008 +0100
bugfix: make pkcon always overwrite the percentage values even if they decrease in digit length
diff --git a/client/pk-console.c b/client/pk-console.c
index 42dc597..bb2eb36 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -98,9 +98,9 @@ pk_console_bar (guint subpercentage)
}
g_print ("] ");
if (percentage_last != PK_CLIENT_PERCENTAGE_INVALID) {
- g_print ("(%i%%)", percentage_last);
+ g_print ("(%i%%) ", percentage_last);
} else {
- g_print (" ");
+ g_print (" ");
}
awaiting_space = TRUE;
}
@@ -371,7 +371,7 @@ pk_console_pulse_bar (PulseState *pulse_state)
}
g_print ("] ");
if (percentage_last != PK_CLIENT_PERCENTAGE_INVALID) {
- g_print ("(%i%%)", percentage_last);
+ g_print ("(%i%%) ", percentage_last);
} else {
g_print (" ");
}
commit 1345d5e1bd71ed07740d48a4c34808c098073b82
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 14:35:19 2008 +0100
feature: add the desktop file scanning and package list generation in process as PkRefresh, but don't connect it up just yet
diff --git a/src/Makefile.am b/src/Makefile.am
index 272832c..bbd302d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -56,6 +56,8 @@ shared_SOURCES = \
pk-network.h \
pk-shared.c \
pk-shared.h \
+ pk-refresh.c \
+ pk-refresh.h \
pk-network-nm.h \
pk-network-unix.c \
pk-network-unix.h \
diff --git a/src/pk-refresh.c b/src/pk-refresh.c
new file mode 100644
index 0000000..0e23769
--- /dev/null
+++ b/src/pk-refresh.c
@@ -0,0 +1,497 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+
+#include "egg-debug.h"
+
+#include "pk-refresh.h"
+#include "pk-shared.h"
+#include "pk-extra.h"
+#include "pk-marshal.h"
+#include "pk-backend-internal.h"
+
+#define PK_REFRESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_REFRESH, PkRefreshPrivate))
+
+struct PkRefreshPrivate
+{
+ PkBackend *backend;
+ PkExtra *extra;
+ GMainLoop *loop;
+ PkPackageList *list;
+};
+
+enum {
+ PK_REFRESH_STATUS_CHANGED,
+ PK_REFRESH_PROGRESS_CHANGED,
+ PK_REFRESH_LAST_SIGNAL
+};
+
+static guint signals [PK_REFRESH_LAST_SIGNAL] = { 0 };
+G_DEFINE_TYPE (PkRefresh, pk_refresh, G_TYPE_OBJECT)
+
+/**
+ * pk_refresh_finished_cb:
+ **/
+static void
+pk_refresh_finished_cb (PkBackend *backend, PkExitEnum exit, PkRefresh *refresh)
+{
+ if (g_main_loop_is_running (refresh->priv->loop))
+ g_main_loop_quit (refresh->priv->loop);
+}
+
+/**
+ * pk_refresh_package_cb:
+ **/
+static void
+pk_refresh_package_cb (PkBackend *backend, const PkPackageObj *obj, PkRefresh *refresh)
+{
+ pk_package_list_add_obj (refresh->priv->list, obj);
+}
+
+/**
+ * pk_refresh_emit_status_changed:
+ **/
+static void
+pk_refresh_emit_status_changed (PkRefresh *refresh, PkStatusEnum status)
+{
+ egg_debug ("emiting status-changed %s", pk_status_enum_to_text (status));
+ g_signal_emit (refresh, signals [PK_REFRESH_STATUS_CHANGED], 0, status);
+}
+
+/**
+ * pk_refresh_emit_progress_changed:
+ **/
+static void
+pk_refresh_emit_progress_changed (PkRefresh *refresh, guint percentage)
+{
+ egg_debug ("emiting progress-changed %i", percentage);
+ g_signal_emit (refresh, signals [PK_REFRESH_PROGRESS_CHANGED], 0, percentage, 0, 0, 0);
+}
+
+/**
+ * pk_import_get_locale:
+ **/
+static gchar *
+pk_import_get_locale (const gchar *buffer)
+{
+ guint len;
+ gchar *locale;
+ gchar *result;
+ result = g_strrstr (buffer, "[");
+ if (result == NULL)
+ return NULL;
+ locale = g_strdup (result+1);
+ len = egg_strlen (locale, 20);
+ locale[len-1] = '\0';
+ return locale;
+}
+
+/**
+ * pk_refresh_import_desktop_files_process_desktop:
+ **/
+static void
+pk_refresh_import_desktop_files_process_desktop (PkRefresh *refresh, const gchar *package_name, const gchar *filename)
+{
+ GKeyFile *key;
+ gboolean ret;
+ guint i;
+ gchar *name = NULL;
+ gchar *name_unlocalised = NULL;
+ gchar *exec = NULL;
+ gchar *icon = NULL;
+ gchar *comment = NULL;
+ gchar *genericname = NULL;
+ const gchar *locale = NULL;
+ gchar **key_array;
+ gsize len;
+ gchar *locale_temp;
+ static GPtrArray *locale_array = NULL;
+
+ key = g_key_file_new ();
+ ret = g_key_file_load_from_file (key, filename, G_KEY_FILE_KEEP_TRANSLATIONS, NULL);
+ if (!ret) {
+ egg_warning ("cannot open desktop file %s", filename);
+ return;
+ }
+
+ /* get this specific locale list */
+ key_array = g_key_file_get_keys (key, G_KEY_FILE_DESKTOP_GROUP, &len, NULL);
+ locale_array = g_ptr_array_new ();
+ for (i=0; i<len; i++) {
+ if (g_str_has_prefix (key_array[i], "Name")) {
+ /* set the locale */
+ locale_temp = pk_import_get_locale (key_array[i]);
+ if (locale_temp != NULL)
+ g_ptr_array_add (locale_array, g_strdup (locale_temp));
+ }
+ }
+ g_strfreev (key_array);
+
+ /* get the default entry */
+ name_unlocalised = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
+ if (!egg_strzero (name_unlocalised)) {
+ pk_extra_set_locale (refresh->priv->extra, "C");
+ pk_extra_set_data_locale (refresh->priv->extra, package_name, name_unlocalised);
+ }
+
+ /* for each locale */
+ for (i=0; i<locale_array->len; i++) {
+ locale = g_ptr_array_index (locale_array, i);
+ /* compare the translated against the default */
+ name = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", locale, NULL);
+
+ /* if different, then save */
+ if (egg_strequal (name_unlocalised, name) == FALSE) {
+ comment = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
+ "Comment", locale, NULL);
+ genericname = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
+ "GenericName", locale, NULL);
+ pk_extra_set_locale (refresh->priv->extra, locale);
+
+ /* save in order of priority */
+ if (comment != NULL)
+ pk_extra_set_data_locale (refresh->priv->extra, package_name, comment);
+ else if (genericname != NULL)
+ pk_extra_set_data_locale (refresh->priv->extra, package_name, genericname);
+ else
+ pk_extra_set_data_locale (refresh->priv->extra, package_name, name);
+ g_free (comment);
+ g_free (genericname);
+ }
+ g_free (name);
+ }
+ g_ptr_array_foreach (locale_array, (GFunc) g_free, NULL);
+ g_ptr_array_free (locale_array, TRUE);
+ g_free (name_unlocalised);
+
+ exec = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Exec", NULL);
+ icon = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL);
+ pk_extra_set_data_package (refresh->priv->extra, package_name, icon, exec);
+ g_free (icon);
+ g_free (exec);
+
+ g_key_file_free (key);
+}
+
+/**
+ * pk_refresh_import_desktop_files_get_package:
+ **/
+static gchar *
+pk_refresh_import_desktop_files_get_package (PkRefresh *refresh, const gchar *filename)
+{
+ guint size;
+ gchar *name = NULL;
+ const PkPackageObj *obj;
+
+ /* use PK to find the correct package */
+ pk_package_list_clear (refresh->priv->list);
+ pk_backend_reset (refresh->priv->backend);
+ refresh->priv->backend->desc->search_file (refresh->priv->backend, pk_bitfield_value (PK_FILTER_ENUM_INSTALLED), filename);
+
+ /* wait for finished */
+ g_main_loop_run (refresh->priv->loop);
+
+ /* check that we only matched one package */
+ size = pk_package_list_get_size (refresh->priv->list);
+ if (size != 1) {
+ egg_warning ("not correct size, %i", size);
+ goto out;
+ }
+
+ /* get the obj */
+ obj = pk_package_list_get_obj (refresh->priv->list, 0);
+ if (obj == NULL) {
+ egg_warning ("cannot get obj");
+ goto out;
+ }
+
+ /* strip the name */
+ name = g_strdup (obj->id->name);
+
+out:
+ return name;
+}
+
+/**
+ * pk_refresh_import_desktop_files:
+ **/
+gboolean
+pk_refresh_import_desktop_files (PkRefresh *refresh)
+{
+ GDir *dir;
+ guint i;
+ const gchar *name;
+ GPatternSpec *pattern;
+ gboolean match;
+ gchar *filename;
+ gchar *package_name;
+ GPtrArray *array;
+ gfloat step;
+
+ const gchar *directory = "/usr/share/applications";
+
+ g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
+
+ if (refresh->priv->backend->desc->search_file == NULL) {
+ egg_debug ("cannot search files");
+ return FALSE;
+ }
+
+ /* open directory */
+ dir = g_dir_open (directory, 0, NULL);
+ if (dir == NULL) {
+ egg_warning ("not a valid desktop dir!");
+ return FALSE;
+ }
+
+ /* use a local backend instance */
+ pk_backend_reset (refresh->priv->backend);
+ pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_SCAN_APPLICATIONS);
+
+ /* find files */
+ pattern = g_pattern_spec_new ("*.desktop");
+ name = g_dir_read_name (dir);
+ array = g_ptr_array_new ();
+ while (name != NULL) {
+ /* ITS4: ignore, not used for allocation and has to be NULL terminated */
+ match = g_pattern_match (pattern, strlen (name), name, NULL);
+ if (match) {
+ filename = g_build_filename (directory, name, NULL);
+ g_ptr_array_add (array, filename);
+ }
+ name = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+
+ /* update UI */
+ pk_refresh_emit_progress_changed (refresh, 0);
+ step = 100.0f / array->len;
+
+ for (i=0; i<array->len; i++) {
+ filename = g_ptr_array_index (array, i);
+
+ /* get the name */
+ package_name = pk_refresh_import_desktop_files_get_package (refresh, filename);
+
+ /* process the file */
+ if (package_name != NULL)
+ pk_refresh_import_desktop_files_process_desktop (refresh, package_name, filename);
+ else
+ egg_warning ("%s ignored, failed to get package name\n", filename);
+ g_free (package_name);
+
+ /* update UI */
+ pk_refresh_emit_progress_changed (refresh, i * step);
+ }
+
+ /* update UI */
+ pk_refresh_emit_progress_changed (refresh, 100);
+ pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_FINISHED);
+
+ g_ptr_array_foreach (array, (GFunc) g_free, NULL);
+ g_ptr_array_free (array, TRUE);
+
+ return TRUE;
+}
+
+/**
+ * pk_refresh_update_package_list:
+ **/
+gboolean
+pk_refresh_update_package_list (PkRefresh *refresh)
+{
+ gboolean ret;
+
+ g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
+
+ if (refresh->priv->backend->desc->get_packages == NULL) {
+ egg_debug ("cannot get packages");
+ return FALSE;
+ }
+
+ egg_debug ("updating package lists");
+
+ /* clear old list */
+ pk_package_list_clear (refresh->priv->list);
+
+ /* get the new package list */
+ pk_backend_reset (refresh->priv->backend);
+ pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_GENERATE_PACKAGE_LIST);
+ pk_refresh_emit_progress_changed (refresh, 0);
+ refresh->priv->backend->desc->get_packages (refresh->priv->backend, PK_FILTER_ENUM_NONE);
+
+ /* wait for finished */
+ g_main_loop_run (refresh->priv->loop);
+
+ /* update UI */
+ pk_refresh_emit_progress_changed (refresh, 90);
+
+ /* convert to a file */
+ ret = pk_package_list_to_file (refresh->priv->list, "/var/lib/PackageKit/package-list.txt");
+ if (!ret)
+ egg_warning ("failed to save to file");
+
+ /* update UI */
+ pk_refresh_emit_progress_changed (refresh, 100);
+ pk_refresh_emit_status_changed (refresh, PK_STATUS_ENUM_FINISHED);
+
+ return ret;
+}
+
+/**
+ * pk_refresh_clear_firmware_requests:
+ **/
+gboolean
+pk_refresh_clear_firmware_requests (PkRefresh *refresh)
+{
+ gboolean ret;
+ gchar *filename;
+
+ g_return_val_if_fail (PK_IS_REFRESH (refresh), FALSE);
+
+ /* clear the firmware requests directory */
+ filename = g_build_filename (LOCALSTATEDIR, "run", "PackageKit", "udev", NULL);
+ egg_debug ("clearing udev firmware requests at %s", filename);
+ ret = pk_directory_remove_contents (filename);
+ if (!ret)
+ egg_warning ("failed to clear %s", filename);
+ g_free (filename);
+ return ret;
+}
+
+/**
+ * pk_refresh_finalize:
+ **/
+static void
+pk_refresh_finalize (GObject *object)
+{
+ PkRefresh *refresh;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (PK_IS_REFRESH (object));
+ refresh = PK_REFRESH (object);
+
+ if (g_main_loop_is_running (refresh->priv->loop))
+ g_main_loop_quit (refresh->priv->loop);
+ g_main_loop_unref (refresh->priv->loop);
+
+ g_object_unref (refresh->priv->backend);
+ g_object_unref (refresh->priv->extra);
+ g_object_unref (refresh->priv->list);
+
+ G_OBJECT_CLASS (pk_refresh_parent_class)->finalize (object);
+}
+
+/**
+ * pk_refresh_class_init:
+ **/
+static void
+pk_refresh_class_init (PkRefreshClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = pk_refresh_finalize;
+ signals [PK_REFRESH_STATUS_CHANGED] =
+ g_signal_new ("status-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, g_cclosure_marshal_VOID__UINT,
+ G_TYPE_NONE, 1, G_TYPE_UINT);
+ signals [PK_REFRESH_PROGRESS_CHANGED] =
+ g_signal_new ("progress-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__UINT_UINT_UINT_UINT,
+ G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
+ g_type_class_add_private (klass, sizeof (PkRefreshPrivate));
+}
+
+/**
+ * pk_refresh_init:
+ *
+ * initializes the refresh class. NOTE: We expect refresh objects
+ * to *NOT* be removed or added during the session.
+ * We only control the first refresh object if there are more than one.
+ **/
+static void
+pk_refresh_init (PkRefresh *refresh)
+{
+ gboolean ret;
+
+ refresh->priv = PK_REFRESH_GET_PRIVATE (refresh);
+ refresh->priv->loop = g_main_loop_new (NULL, FALSE);
+ refresh->priv->list = pk_package_list_new ();
+ refresh->priv->backend = pk_backend_new ();
+
+ g_signal_connect (refresh->priv->backend, "finished",
+ G_CALLBACK (pk_refresh_finished_cb), refresh);
+ g_signal_connect (refresh->priv->backend, "package",
+ G_CALLBACK (pk_refresh_package_cb), refresh);
+
+ refresh->priv->extra = pk_extra_new ();
+
+ /* use the default location */
+ ret = pk_extra_set_database (refresh->priv->extra, NULL);
+ if (!ret)
+ egg_warning ("Could not open extra database");
+}
+
+/**
+ * pk_refresh_new:
+ * Return value: A new refresh class instance.
+ **/
+PkRefresh *
+pk_refresh_new (void)
+{
+ PkRefresh *refresh;
+ refresh = g_object_new (PK_TYPE_REFRESH, NULL);
+ return PK_REFRESH (refresh);
+}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef EGG_TEST
+#include "egg-test.h"
+
+void
+egg_test_refresh (EggTest *test)
+{
+ PkRefresh *refresh;
+
+ if (!egg_test_start (test, "PkRefresh"))
+ return;
+
+ /************************************************************/
+ egg_test_title (test, "get an instance");
+ refresh = pk_refresh_new ();
+ egg_test_assert (test, refresh != NULL);
+
+ g_object_unref (refresh);
+
+ egg_test_end (test);
+}
+#endif
+
diff --git a/src/pk-refresh.h b/src/pk-refresh.h
new file mode 100644
index 0000000..1bcc70c
--- /dev/null
+++ b/src/pk-refresh.h
@@ -0,0 +1,59 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PK_REFRESH_H
+#define __PK_REFRESH_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define PK_TYPE_REFRESH (pk_refresh_get_type ())
+#define PK_REFRESH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PK_TYPE_REFRESH, PkRefresh))
+#define PK_REFRESH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), PK_TYPE_REFRESH, PkRefreshClass))
+#define PK_IS_REFRESH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PK_TYPE_REFRESH))
+#define PK_IS_REFRESH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), PK_TYPE_REFRESH))
+#define PK_REFRESH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), PK_TYPE_REFRESH, PkRefreshClass))
+
+typedef struct PkRefreshPrivate PkRefreshPrivate;
+
+typedef struct
+{
+ GObject parent;
+ PkRefreshPrivate *priv;
+} PkRefresh;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} PkRefreshClass;
+
+GType pk_refresh_get_type (void) G_GNUC_CONST;
+PkRefresh *pk_refresh_new (void);
+
+gboolean pk_refresh_clear_firmware_requests (PkRefresh *refresh);
+gboolean pk_refresh_update_package_list (PkRefresh *refresh);
+gboolean pk_refresh_import_desktop_files (PkRefresh *refresh);
+
+G_END_DECLS
+
+#endif /* __PK_REFRESH_H */
+
commit 03171dc263e8180e9fbe36c7b776dcab50e5f3d8
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 14:25:25 2008 +0100
trivial: add two new status enums, SCAN_APPLICATIONS and GENERATE_PACKAGE_LIST
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index e0220df..ba427ed 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -81,6 +81,8 @@ static const PkEnumMatch enum_status[] = {
{PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "download-updateinfo"},
{PK_STATUS_ENUM_REPACKAGING, "repackaging"},
{PK_STATUS_ENUM_LOADING_CACHE, "loading-cache"},
+ {PK_STATUS_ENUM_SCAN_APPLICATIONS, "scan-applications"},
+ {PK_STATUS_ENUM_GENERATE_PACKAGE_LIST, "generate-package-list"},
{0, NULL}
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 4dcfead..4ad8570 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -127,6 +127,8 @@ typedef enum {
PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO,
PK_STATUS_ENUM_REPACKAGING,
PK_STATUS_ENUM_LOADING_CACHE,
+ PK_STATUS_ENUM_SCAN_APPLICATIONS,
+ PK_STATUS_ENUM_GENERATE_PACKAGE_LIST,
PK_STATUS_ENUM_UNKNOWN
} PkStatusEnum;
diff --git a/tools/add-error-enum.sh b/tools/add-error-enum.sh
index 5748d5d..2ae43b9 100755
--- a/tools/add-error-enum.sh
+++ b/tools/add-error-enum.sh
@@ -7,5 +7,5 @@
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
-$EDITOR docs/api/spec/pk-concepts.xml libpackagekit/pk-enum.h libpackagekit/pk-enum.c ../gnome-packagekit/src/gpk-common.c
+$EDITOR docs/api/spec/pk-concepts.xml libpackagekit/pk-enum.h libpackagekit/pk-enum.c ../gnome-packagekit/src/gpk-enum.c ../gnome-packagekit/src/gpk-common.c
commit 5094e90500c4c8d3b6c0e40c31d19682ed7c41df
Merge: 1431bf5... d5aaf35...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 14:21:30 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 1431bf50475cb8cb7fb1a45948cd89123f40e309
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 14:11:56 2008 +0100
trivial: whitespace and comment fixes
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 55442aa..16dd0f3 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -862,7 +862,6 @@ pk_transaction_update_detail_cb (PkBackend *backend, const PkUpdateDetailObj *de
g_free (package_id);
}
-
/**
* pk_transaction_set_running:
*/
@@ -998,7 +997,7 @@ pk_transaction_set_running (PkTransaction *transaction)
else if (priv->role == PK_ROLE_ENUM_SEARCH_DETAILS)
desc->search_details (priv->backend, priv->cached_filters, priv->cached_search);
else if (priv->role == PK_ROLE_ENUM_SEARCH_FILE)
- desc->search_file (priv->backend,priv->cached_filters,priv->cached_search);
+ desc->search_file (priv->backend, priv->cached_filters, priv->cached_search);
else if (priv->role == PK_ROLE_ENUM_SEARCH_GROUP)
desc->search_group (priv->backend, priv->cached_filters, priv->cached_search);
else if (priv->role == PK_ROLE_ENUM_SEARCH_NAME)
@@ -1238,14 +1237,10 @@ pk_transaction_action_is_allowed (PkTransaction *transaction, gboolean trusted,
/**
* pk_transaction_priv_get_role:
- *
- * Only valid from an async caller, which is fine, as we won't prompt the user
- * when not async.
**/
PkRoleEnum
pk_transaction_priv_get_role (PkTransaction *transaction)
{
- g_return_val_if_fail (transaction != NULL, FALSE);
g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
return transaction->priv->role;
}
diff --git a/src/pk-transaction.h b/src/pk-transaction.h
index cdd3693..0c7814d 100644
--- a/src/pk-transaction.h
+++ b/src/pk-transaction.h
@@ -84,12 +84,8 @@ PkTransaction *pk_transaction_new (void);
/* go go go! */
gboolean pk_transaction_run (PkTransaction *transaction)
G_GNUC_WARN_UNUSED_RESULT;
-/* get status */
-PkStatusEnum pk_transaction_priv_get_status (PkTransaction *transaction);
+/* internal status */
PkRoleEnum pk_transaction_priv_get_role (PkTransaction *transaction);
-const gchar *pk_transaction_priv_get_text (PkTransaction *transaction);
-PkPackageList *pk_transaction_priv_get_package_list (PkTransaction *transaction);
-guint pk_transaction_priv_get_runtime (PkTransaction *transaction);
/* set and retrieve tid */
const gchar *pk_transaction_get_tid (PkTransaction *transaction);
commit d5aaf352f5e6050174f1840ab22f8d03cb88be2d
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Mon Sep 22 15:03:09 2008 +0200
yum: let get-details return the right group enum for meta-packages
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 3596826..c62c060 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1330,11 +1330,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
desc = grp.description
desc = desc.replace('\n\n',';')
desc = desc.replace('\n',' ')
- cat = self._get_category(grp.groupid)
- if cat:
- group = "%s\%s" % (cat.name,grp.name)
- else:
- group = grp.name
+ group = GROUP_COLLECTIONS
pkgs = self._get_group_packages(grp)
size = 0;
for pkg in pkgs:
commit 05b299d86b16e17920f8c929c4939a827571126c
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Mon Sep 22 14:04:18 2008 +0200
yum: make get-details return full category\group for a meta-package (comps group)
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 8194882..3596826 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1306,6 +1306,13 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
else:
self.error(ERROR_PACKAGE_NOT_INSTALLED,"The packages failed to be removed")
+ def _get_category(self,groupid):
+ cat_id = self.comps.get_category(groupid)
+ if self.yumbase.comps._categories.has_key(cat_id):
+ return self.yumbase.comps._categories[cat_id]
+ else:
+ return None
+
def get_details(self,package_ids):
'''
Print a detailed details for a given package
@@ -1323,7 +1330,11 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
desc = grp.description
desc = desc.replace('\n\n',';')
desc = desc.replace('\n',' ')
- group = grp.name
+ cat = self._get_category(grp.groupid)
+ if cat:
+ group = "%s\%s" % (cat.name,grp.name)
+ else:
+ group = grp.name
pkgs = self._get_group_packages(grp)
size = 0;
for pkg in pkgs:
diff --git a/backends/yum/yumComps.py b/backends/yum/yumComps.py
index 7b00ae2..a2e3e42 100755
--- a/backends/yum/yumComps.py
+++ b/backends/yum/yumComps.py
@@ -288,6 +288,15 @@ class yumComps:
all_packages.append(row[0])
return all_packages
+ def get_category(self,groupid):
+ ''' for a comps group, get the category for a group '''
+ category = None
+ self.cursor.execute('SELECT category FROM groups WHERE groupid = ?;',[groupid])
+ for row in self.cursor:
+ category = row[0]
+ break
+ return category
+
if __name__ == "__main__":
import yum
import os
commit b313f032f0f0c65b5ecb6309d2aa7bf18c213d9d
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 13:43:26 2008 +0200
convert array to string
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 42a0779..d8c1195 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -370,6 +370,7 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
info = loader.getInfo(package)
if hasattr(info, 'getChangeLog'):
changelog = info.getChangeLog()
+ changelog = ';'.join(changelog)
if hasattr(loader, 'getErrata'):
errata = loader.getErrata(package)
commit 3b8354892431d9d624497bfafa67525f58295f67
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 13:42:40 2008 +0200
smart: silence UnicodeDecodeError internal errors
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index e7c65e5..42a0779 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -38,7 +38,11 @@ def needs_cache(func):
obj.status(STATUS_LOADING_CACHE)
obj.allow_cancel(True)
obj.ctrl.reloadChannels()
- result = func(obj, *args, **kwargs)
+ result = None
+ try:
+ result = func(obj, *args, **kwargs)
+ except UnicodeDecodeError, e:
+ pass
if not obj._cacheloaded:
obj.ctrl.saveSysConf()
obj._cacheloaded = True
commit a4c0a9789c6110fd6573cbd242bf47a2a600f7ec
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 13:17:15 2008 +0200
smart: report blank instead of unknown for license
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 4fa91f7..e7c65e5 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -746,7 +746,7 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
if hasattr(info, 'getLicense'):
license = info.getLicense()
else:
- license = LICENSE_UNKNOWN
+ license = ''
group = self._get_group(info)
commit 0b21971fa921c6e7688accdc38a919a0530c9895
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Mon Sep 22 12:21:06 2008 +0200
yum: make get-depends return packages added from group, not only deps
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 7437ca6..8194882 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -801,6 +801,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
bump = 100 / len(package_ids)
deps_list = []
resolve_list = []
+ grp_pkgs = []
# resolve each package_id to a pkg object
for package in package_ids:
@@ -808,7 +809,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
grp = self._is_meta_package(package)
if grp:
pkgs = self._get_group_packages(grp)
- resolve_list.extend(pkgs)
+ grp_pkgs.extend(pkgs)
else:
name = package.split(';')[0]
pkg,inst = self._findPackage(package)
@@ -819,12 +820,19 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
break
percentage += bump
+ if grp_pkgs:
+ resolve_list.extend(grp_pkgs)
# get the best deps
deps_list = self._get_best_depends(resolve_list,recursive)
# make unique list
deps_list = unique(deps_list)
+ # If packages comes from a group, then we show them along with deps.
+ if grp_pkgs:
+ deps_list.extend(grp_pkgs)
+
+
# add to correct lists
for pkg in deps_list:
if self._is_inst(pkg):
commit 0da977a67ea3e74e556b847e0085737bbb1f28fe
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 11:02:21 2008 +0100
Revert "change the default of RefreshCacheScanDesktopFiles and RefreshCacheUpdatePackageList to true. Distros that have slow methods may want to disable these"
This reverts commit 5977bf83532790c4e6e7a4e69b85011cdbe4cf5b.
diff --git a/etc/PackageKit.conf.in b/etc/PackageKit.conf.in
index fae5ad4..8e58e9a 100644
--- a/etc/PackageKit.conf.in
+++ b/etc/PackageKit.conf.in
@@ -50,13 +50,13 @@ DefaultBackend=@defaultbackend@
#
# NOTE: Don't enable this for backends that are slow doing SearchFile()
#
-# default=true
-RefreshCacheScanDesktopFiles=true
+# default=false
+RefreshCacheScanDesktopFiles=false
# Update the package list when we RefreshCache
#
# NOTE: Don't enable this for backends that are slow doing GetPackages()
#
-# default=true
-RefreshCacheUpdatePackageList=true
+# default=false
+RefreshCacheUpdatePackageList=false
commit cc052ce68e10e21f02c4f2b5cc82c031d3968e03
Merge: cd21028... 2e5ddaa...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 11:02:11 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 2e5ddaabc993d01985d9e5d04c83fe115e092b8e
Merge: 254800b... b5b7aec...
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 11:56:03 2008 +0200
Merge branch 'master' of git+ssh://afb@git.packagekit.org/srv/git/PackageKit
commit 254800be6e7df4b0eb76f2942e009d243cee81fc
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 11:55:39 2008 +0200
smart: only allow one download at a time, to avoid confusing interface
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index d25094b..4fa91f7 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -50,6 +50,7 @@ class PackageKitSmartInterface(Interface):
def __init__(self, ctrl, backend):
Interface.__init__(self, ctrl)
+ smart.sysconf.set("max-active-downloads", 1, soft=True)
self._progress = PackageKitSmartProgress(True, backend)
def getProgress(self, obj, hassub=False):
commit cd21028dc5c857eec4fc5ffc4ae08e28ea5a44c5
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 10:54:04 2008 +0100
trivial: fix the enum converter now we are static const
diff --git a/python/enum-convertor.py b/python/enum-convertor.py
index f21cfe0..642e9a0 100644
--- a/python/enum-convertor.py
+++ b/python/enum-convertor.py
@@ -2,7 +2,7 @@
from re import compile,DOTALL,MULTILINE
-enum = compile("static PkEnumMatch enum_([^\]]+)\[\] = {(.*?)};", DOTALL|MULTILINE)
+enum = compile("static const PkEnumMatch enum_([^\]]+)\[\] = {(.*?)};", DOTALL|MULTILINE)
value = compile("PK_([A-Z_]+)_ENUM_([A-Z0-9_]+),\s+\"([^\"]+)\"")
inp = open("../libpackagekit/pk-enum.c").read()
commit b5b7aec03b5af18af6b545a7876ec70cbf3ac29e
Merge: e323caf... 68a0ed8...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 10:47:41 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 68a0ed84f095f94a2eba6aabc181e4d0658e64b0
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 11:44:54 2008 +0200
trivial: clean up imports
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 485bf73..d25094b 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -22,11 +22,7 @@ import smart
from smart.interface import Interface
from smart.progress import Progress
from smart.fetcher import Fetcher
-from packagekit.backend import PackageKitBaseBackend, INFO_INSTALLED, \
- INFO_AVAILABLE, INFO_NORMAL, FILTER_NOT_INSTALLED, FILTER_INSTALLED, \
- INFO_SECURITY, INFO_BUGFIX, INFO_ENHANCEMENT, \
- ERROR_REPO_NOT_FOUND, ERROR_PACKAGE_ALREADY_INSTALLED, \
- ERROR_PACKAGE_DOWNLOAD_FAILED
+from packagekit.backend import PackageKitBaseBackend
from packagekit.package import PackagekitPackage
from packagekit.enums import *
import re
commit e323caf1eb560f99257d127e3a2b43bf10232e5b
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 10:33:01 2008 +0100
bugfix: add a --quiet flag for the import tools so we can use them in the daemon without printing lots of debug text
diff --git a/client/pk-generate-package-list.c b/client/pk-generate-package-list.c
index 1cdfe3d..4aaa851 100644
--- a/client/pk-generate-package-list.c
+++ b/client/pk-generate-package-list.c
@@ -45,6 +45,7 @@ main (int argc, char *argv[])
PkClient *client;
GOptionContext *context;
gboolean verbose = FALSE;
+ gboolean quiet = FALSE;
gboolean ret;
GError *error = NULL;
PkPackageList *list = NULL;
@@ -52,6 +53,8 @@ main (int argc, char *argv[])
const GOptionEntry options[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
"Show extra debugging information", NULL },
+ { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
+ "Do not show any output to the console", NULL },
{ NULL}
};
@@ -71,7 +74,8 @@ main (int argc, char *argv[])
/* get the package list with no filter */
ret = pk_client_get_packages (client, PK_FILTER_ENUM_NONE, &error);
if (!ret) {
- g_print ("Failed to get package lists: %s\n", error->message);
+ if (!quiet)
+ g_print ("Failed to get package lists: %s\n", error->message);
g_error_free (error);
goto out;
}
@@ -80,8 +84,8 @@ main (int argc, char *argv[])
list = pk_client_get_package_list (client);
ret = pk_package_list_to_file (list, PK_PACKAGE_LIST_LOCATION);
if (!ret) {
- g_print ("Failed to write to disk\n");
- g_error_free (error);
+ if (!quiet)
+ g_print ("Failed to write to disk\n");
goto out;
}
diff --git a/client/pk-import-desktop.c b/client/pk-import-desktop.c
index 5feab0b..ba8378b 100644
--- a/client/pk-import-desktop.c
+++ b/client/pk-import-desktop.c
@@ -41,6 +41,7 @@
static PkClient *client = NULL;
static PkExtra *extra = NULL;
+static gboolean quiet = FALSE;
/**
* pk_desktop_get_name_for_file:
@@ -153,12 +154,14 @@ pk_desktop_process_desktop (const gchar *package_name, const gchar *filename)
}
g_strfreev (key_array);
- g_print ("PackageName:\t%s\t[", package_name);
+ if (!quiet)
+ g_print ("PackageName:\t%s\t[", package_name);
/* get the default entry */
name_unlocalised = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Name", NULL);
if (!egg_strzero (name_unlocalised)) {
- g_print ("C");
+ if (!quiet)
+ g_print ("C");
pk_extra_set_locale (extra, "C");
pk_extra_set_data_locale (extra, package_name, name_unlocalised);
}
@@ -171,7 +174,8 @@ pk_desktop_process_desktop (const gchar *package_name, const gchar *filename)
/* if different, then save */
if (egg_strequal (name_unlocalised, name) == FALSE) {
- g_print (" %s", locale);
+ if (!quiet)
+ g_print (" %s", locale);
comment = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
"Comment", locale, NULL);
genericname = g_key_file_get_locale_string (key, G_KEY_FILE_DESKTOP_GROUP,
@@ -195,7 +199,8 @@ pk_desktop_process_desktop (const gchar *package_name, const gchar *filename)
g_ptr_array_foreach (locale_array, (GFunc) g_free, NULL);
g_ptr_array_free (locale_array, TRUE);
g_free (name_unlocalised);
- g_print ("]\n");
+ if (!quiet)
+ g_print ("]\n");
exec = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Exec", NULL);
icon = g_key_file_get_string (key, G_KEY_FILE_DESKTOP_GROUP, "Icon", NULL);
@@ -240,8 +245,10 @@ pk_desktop_process_directory (const gchar *directory)
/* process the file */
if (package_name != NULL)
pk_desktop_process_desktop (package_name, filename);
- else
- g_print ("%s ignored, failed to get package name\n", filename);
+ else {
+ if (!quiet)
+ g_print ("%s ignored, failed to get package name\n", filename);
+ }
g_free (package_name);
g_free (filename);
}
@@ -269,6 +276,8 @@ main (int argc, char *argv[])
"Database location (default set from daemon)", NULL },
{ "desktop-location", '\0', 0, G_OPTION_ARG_STRING, &desktop_location,
"Desktop location (default " PK_IMPORT_APPLICATIONSDIR ")", NULL },
+ { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
+ "Do not show any output to the console", NULL },
{ NULL}
};
@@ -292,8 +301,10 @@ main (int argc, char *argv[])
extra = pk_extra_new ();
ret = pk_extra_set_database (extra, database_location);
if (!ret) {
- g_print (_("Could not open database: %s"), database_location);
- g_print ("\n%s\n", _("You probably need to run this program as the root user"));
+ if (!quiet) {
+ g_print (_("Could not open database: %s"), database_location);
+ g_print ("\n%s\n", _("You probably need to run this program as the root user"));
+ }
goto out;
}
diff --git a/client/pk-import-specspo.c b/client/pk-import-specspo.c
index 4fed402..d898dfc 100644
--- a/client/pk-import-specspo.c
+++ b/client/pk-import-specspo.c
@@ -48,6 +48,7 @@ static PkClient *client = NULL;
static PkExtra *extra = NULL;
static GPtrArray *locale_array = NULL;
static GPtrArray *package_array = NULL;
+static gboolean quiet = FALSE;
/**
* pk_import_specspo_get_summary:
@@ -114,11 +115,12 @@ pk_import_specspo_do_package (const gchar *package_name)
summary = pk_import_specspo_get_summary (package_name);
if (summary == NULL) {
- g_print ("no summary for %s\n", package_name);
+ if (!quiet)
+ g_print ("no summary for %s\n", package_name);
return;
}
- g_print ("processing %s [", package_name);
-// g_print ("%s,", summary);
+ if (!quiet)
+ g_print ("processing %s [", package_name);
for (j=0; j<locale_array->len; j++) {
locale = g_ptr_array_index (locale_array, j);
@@ -129,14 +131,15 @@ pk_import_specspo_do_package (const gchar *package_name)
/* if different, then save */
if (egg_strequal (summary, trans) == FALSE) {
- g_print (" %s", locale);
-// g_print (" %s", trans);
+ if (!quiet)
+ g_print (" %s", locale);
pk_extra_set_locale (extra, locale);
pk_extra_set_data_locale (extra, package_name, trans);
}
}
}
- g_print ("]\n");
+ if (!quiet)
+ g_print ("]\n");
}
/**
@@ -157,6 +160,8 @@ main (int argc, char *argv[])
"Show extra debugging information", NULL },
{ "database-location", '\0', 0, G_OPTION_ARG_STRING, &database_location,
"Database location (default set from daemon)", NULL },
+ { "quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
+ "Do not show any output to the console", NULL },
{ NULL}
};
@@ -176,8 +181,10 @@ main (int argc, char *argv[])
extra = pk_extra_new ();
ret = pk_extra_set_database (extra, database_location);
if (!ret) {
- g_print (_("Could not open database: %s"), database_location);
- g_print ("\n%s\n", _("You probably need to run this program as the root user"));
+ if (!quiet) {
+ g_print (_("Could not open database: %s"), database_location);
+ g_print ("\n%s\n", _("You probably need to run this program as the root user"));
+ }
goto out;
}
diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index 463b6b0..55442aa 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -477,6 +477,7 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
gchar *filename;
guint time;
gchar *packages;
+ gchar *exec;
gchar *command;
g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -562,13 +563,15 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
* NOTE: we can't do this in process as it uses PkClient */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheUpdatePackageList");
if (ret) {
- command = g_build_filename (LIBEXECDIR, "pk-generate-package-list", NULL);
+ exec = g_build_filename (LIBEXECDIR, "pk-generate-package-list", NULL);
+ command = g_strdup_printf ("%s --quiet", exec);
egg_debug ("running helper %s", command);
ret = g_spawn_command_line_async (command, &error);
if (!ret) {
egg_warning ("failed to execute %s: %s", command, error->message);
g_error_free (error);
}
+ g_free (exec);
g_free (command);
}
@@ -576,13 +579,15 @@ pk_transaction_finished_cb (PkBackend *backend, PkExitEnum exit, PkTransaction *
* NOTE: we can't do this in process as it uses PkClient */
ret = pk_conf_get_bool (transaction->priv->conf, "RefreshCacheScanDesktopFiles");
if (ret) {
- command = g_build_filename (LIBEXECDIR, "pk-import-desktop", NULL);
+ exec = g_build_filename (LIBEXECDIR, "pk-import-desktop", NULL);
+ command = g_strdup_printf ("%s --quiet", exec);
egg_debug ("running helper %s", command);
ret = g_spawn_command_line_async (command, &error);
if (!ret) {
egg_warning ("failed to execute %s: %s", command, error->message);
g_error_free (error);
}
+ g_free (exec);
g_free (command);
}
commit 1f813f0b618b02347847177422a46e0b9cbcd17f
Merge: 5f3a060... 0332cec...
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 11:30:04 2008 +0200
Merge branch 'master' of git+ssh://shaas@git.packagekit.org/srv/git/PackageKit
commit 5f3a060aab95b8aa9ebb9ef4052cd7d4f8e1ac72
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 11:29:34 2008 +0200
zypp:pk_backend_package() expects a summary, not a (long) description; fixes gpk-app display using zypp (opensuse at sukimashita.com)
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 52b9c26..7a089be 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -227,9 +227,7 @@ backend_get_requires_thread (PkBackend *backend)
it->resolvable ()->arch ().c_str(),
it->resolvable ()->repoInfo().alias ().c_str ());
- pk_backend_package (backend, status, package_id, "");
- // FIXME There is something in our descriptions which let crash pk
- //it->resolvable ()->description ().c_str ());
+ pk_backend_package (backend, status, package_id, it->resolvable ()->summary ().c_str ());
g_free (package_id);
}
@@ -421,12 +419,12 @@ backend_get_depends_thread (PkBackend *backend)
pk_backend_package (backend,
PK_INFO_ENUM_INSTALLED,
package_id_temp,
- item->description ().c_str());
+ item->summary ().c_str());
} else {
pk_backend_package (backend,
PK_INFO_ENUM_AVAILABLE,
package_id_temp,
- "");
+ item->summary ().c_str());
}
g_free (package_id_temp);
}
@@ -721,10 +719,11 @@ backend_get_updates_thread (PkBackend *backend)
}
gchar *package_id = zypp_build_package_id_from_resolvable (res->satSolvable ());
- pk_backend_package (backend, infoEnum, package_id, "");
+ pk_backend_package (backend, infoEnum, package_id, res->summary ().c_str ());
// some package descriptions generate markup parse failures
// causing the update to show empty package lines, comment for now
- // res->description ().c_str ());
+ // res->summary ().c_str ());
+ // Test if this still happens!
g_free (package_id);
}
@@ -1270,11 +1269,15 @@ backend_resolve_thread (PkBackend *backend)
}
const gchar *package_id = zypp_build_package_id_from_resolvable (package);
- // TODO: Determine whether the package is installed and emit either PK_INFO_ENUM_AVAILABLE or PK_INFO_ENUM_INSTALLED
+
+ PkInfoEnum info = PK_INFO_ENUM_AVAILABLE;
+ if( package.isSystem ())
+ info = PK_INFO_ENUM_INSTALLED;
+
pk_backend_package (backend,
- PK_INFO_ENUM_AVAILABLE,
+ info,
package_id,
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
+ package.lookupStrAttribute (zypp::sat::SolvAttr::summary).c_str ());
}
pk_backend_finished (backend);
@@ -1795,7 +1798,7 @@ backend_what_provides_thread (PkBackend *backend)
it->resolvable ()->arch ().c_str(),
it->resolvable ()->repoInfo().alias ().c_str ());
- pk_backend_package (backend, status, package_id, it->resolvable ()->description ().c_str ());
+ pk_backend_package (backend, status, package_id, it->resolvable ()->summary ().c_str ());
g_free (package_id);
}
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 44bc535..8becd3c 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -596,7 +596,7 @@ zypp_emit_packages_in_list (PkBackend *backend, std::vector<zypp::sat::Solvable>
PK_INFO_ENUM_INSTALLED :
PK_INFO_ENUM_AVAILABLE,
package_id,
- it->lookupStrAttribute (zypp::sat::SolvAttr::description).c_str ());
+ it->lookupStrAttribute (zypp::sat::SolvAttr::summary).c_str ());
g_free (package_id);
}
}
commit ca435e30c8d839caa2ef5846b655210780967d7c
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 10:21:11 2008 +0100
dummy: respect the filter setting in SearchFile
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 061a9cf..0632770 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -539,9 +539,14 @@ backend_search_file (PkBackend *backend, PkBitfield filters, const gchar *search
{
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
pk_backend_set_allow_cancel (backend, TRUE);
- pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE,
- "vips-doc;7.12.4-2.fc8;noarch;linva",
- "The vips documentation package.");
+ if (!pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED))
+ pk_backend_package (backend, PK_INFO_ENUM_AVAILABLE,
+ "vips-doc;7.12.4-2.fc8;noarch;linva",
+ "The vips documentation package");
+ else
+ pk_backend_package (backend, PK_INFO_ENUM_INSTALLED,
+ "vips-doc;7.12.4-2.fc8;noarch;linva",
+ "The vips documentation package");
pk_backend_finished (backend);
}
commit 0332cecaed8eaeb058b4a83fdcf37f246c827e51
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 11:10:11 2008 +0200
Update feature matrix for smart.
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index ccc0303..47c913a 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -550,7 +550,7 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- poldek -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- zypp -->
commit a1f175a8ce51c33143a070e9b2b429974ec76262
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 11:04:57 2008 +0200
zypp: fixing segfault (opensuse at sukimashita.com)
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index 708f331..44bc535 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -881,7 +881,12 @@ zypp_build_package_id_capabilities (zypp::Capabilities caps)
for (zypp::sat::WhatProvides::const_iterator it = provs.begin (); it != provs.end (); it++) {
gchar *package_id = zypp_build_package_id_from_resolvable (*it);
- package_ids = g_strconcat (package_ids, package_id, "^", (gchar *)NULL);
+ //package_ids = g_strconcat (package_ids, package_id, "^", (gchar *)NULL);
+ if (strlen (package_ids) == 0) {
+ package_ids = g_strdup (package_id);
+ } else {
+ package_ids = g_strconcat (package_ids, "^", package_id, (gchar *)NULL);
+ }
g_free (package_id);
}
commit 8a08daadc7bc84d3139ed32dd0ab69fdd784a5ac
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 11:04:20 2008 +0200
Update feature matrix for smart.
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index 10f5757..ccc0303 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -168,7 +168,7 @@
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- pisi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- poldek -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- smart -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- smart -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- urpmi -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- yum -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- zypp -->
commit 781f3ebb6436b59e1aed0d7af9d7584f1e69e0d5
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 11:01:11 2008 +0200
zypp: check provides if no package was found (search file)
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index e4a96cb..708f331 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -377,6 +377,15 @@ zypp_get_packages_by_file (const gchar *search_file)
}
}
+ if (v->empty ()) {
+ zypp::Capability cap (search_file);
+ zypp::sat::WhatProvides prov (cap);
+
+ for(zypp::sat::WhatProvides::const_iterator it = prov.begin (); it != prov.end (); it++) {
+ v->push_back (*it);
+ }
+ }
+
return v;
}
commit 864aafb97c71a715589c828ed3908ae37f1caf81
Author: Stefan Haas <shaas at suse.de>
Date: Mon Sep 22 10:59:04 2008 +0200
zypp: fixing segfault (opensuse at sukimashita.com)
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 417113f..52b9c26 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -925,7 +925,12 @@ backend_get_update_detail_thread (PkBackend *backend)
zypp::sat::SolvableSet content = patch->contents ();
for (zypp::sat::SolvableSet::const_iterator it = content.begin (); it != content.end (); it++) {
- obsoletes = g_strconcat (obsoletes, zypp_build_package_id_capabilities (it->obsoletes ()), "^", (gchar *)NULL);
+ //obsoletes = g_strconcat (obsoletes, zypp_build_package_id_capabilities (it->obsoletes ()), "^", (gchar *)NULL);
+ if (strlen(obsoletes) == 0) {
+ obsoletes = zypp_build_package_id_capabilities (it->obsoletes ());
+ } else {
+ obsoletes = g_strconcat (obsoletes, "^", zypp_build_package_id_capabilities (it->obsoletes ()), (gchar *)NULL);
+ }
}
}
commit 755046efc002d33fa1d95c3aeb29cef79e138dda
Merge: 6257b9a... 33d9be9...
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 10:55:06 2008 +0200
Merge branch 'master' of git+ssh://afb@git.packagekit.org/srv/git/PackageKit
commit 6257b9acea5b70a9c73b1e49ba10f9fa19fa7920
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 10:54:54 2008 +0200
smart: implement GetUpdateDetail
diff --git a/backends/smart/helpers/get-update-detail.py b/backends/smart/helpers/get-update-detail.py
new file mode 100755
index 0000000..0de45f4
--- /dev/null
+++ b/backends/smart/helpers/get-update-detail.py
@@ -0,0 +1,20 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2007 Richard Hughes <richard at hughsie.com>
+# Copyright (C) 2007 James Bowes <jbowes at dangerouslyinc.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from smartBackend import PackageKitSmartBackend
+
+package = sys.argv[1]
+backend = PackageKitSmartBackend(sys.argv[1:])
+backend.get_update_detail(package.split('|'))
+sys.exit(0)
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 7a3a780..485bf73 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -344,6 +344,85 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
self._show_package_list()
@needs_cache
+ def get_update_detail(self, packageids):
+ self.status(STATUS_INFO)
+ self.allow_cancel(True)
+ for packageid in packageids:
+ ratio, results, suggestions = self._search_packageid(packageid)
+
+ packages = self._process_search_results(results)
+
+ if len(packages) == 0:
+ packagestring = self._string_packageid(packageid)
+ self.error(ERROR_PACKAGE_NOT_FOUND,
+ 'Package %s was not found' % packagestring)
+ return
+
+ channels = self._search_channels(packageid)
+
+ package = packages[0]
+ changelog = ''
+ errata = None
+ for loader in package.loaders:
+ if channels and loader.getChannel() not in channels:
+ continue
+ info = loader.getInfo(package)
+ if hasattr(info, 'getChangeLog'):
+ changelog = info.getChangeLog()
+ if hasattr(loader, 'getErrata'):
+ errata = loader.getErrata(package)
+
+ upgrades = ''
+ if package.upgrades:
+ upgrades = []
+ for upg in package.upgrades:
+ for prv in upg.providedby:
+ for prvpkg in prv.packages:
+ if prvpkg.installed:
+ upgrades.append(self._package_id(prvpkg, loader))
+ upgrades = '^'.join(upgrades)
+ obsoletes = ''
+
+ if not errata:
+ state = self._get_status(package) or ''
+ self.update_detail(self._package_id(package, loader),
+ upgrades, obsoletes, '', '', '',
+ 'none', '', changelog, state, '', '')
+ continue
+
+ state = errata.getType()
+ issued = errata.getDate()
+ updated = ''
+
+ description = errata.getDescription()
+ description = description.replace(";", ",")
+ description = description.replace("\n", ";")
+
+ urls = errata.getReferenceURLs()
+ vendor_urls = []
+ bugzilla_urls = []
+ cve_urls = []
+ for url in urls:
+ if url.find("cve") != -1:
+ cve_urls.append(url)
+ elif url.find("bugzilla") != -1:
+ bugzilla_urls.append(url)
+ else:
+ vendor_urls.append(url)
+ vendor_url = ';'.join(vendor_urls)
+ bugzilla_url = ';'.join(vendor_urls)
+ cve_url = ';'.join(vendor_urls)
+
+ if errata.isRebootSuggested():
+ reboot = 'system'
+ else:
+ reboot = 'none'
+
+ self.update_detail(self._package_id(package, loader),
+ upgrades, obsoletes, vendor_url, bugzilla_url, cve_url,
+ reboot, description, changelog, state, issued, updated)
+
+ @needs_cache
def resolve(self, filters, packages):
self.status(STATUS_QUERY)
self.allow_cancel(True)
@@ -1023,6 +1102,17 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
return group
def _get_status(self, package):
+ for loader in package.loaders:
+ if hasattr(loader, 'getErrata'):
+ errata = loader.getErrata(package)
+ type = errata.getType()
+ if type == 'security':
+ return INFO_SECURITY
+ elif type == 'bugfix':
+ return INFO_BUGFIX
+ elif type == 'enhancement':
+ return INFO_ENHANCEMENT
+ # using the flags for errata is deprecated
flags = smart.pkgconf.testAllFlags(package)
for flag in flags:
if flag == 'security':
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 95367f9..72c916b 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -228,6 +228,18 @@ backend_get_packages (PkBackend *backend, PkBitfield filters)
}
/**
+ * backend_get_update_detail:
+ */
+static void
+backend_get_update_detail (PkBackend *backend, gchar **package_ids)
+{
+ gchar *package_ids_temp;
+ package_ids_temp = pk_package_ids_to_text (package_ids, "|");
+ pk_backend_spawn_helper (spawn, BACKEND("get-update-detail"), package_ids_temp, NULL);
+ g_free (package_ids_temp);
+}
+
+/**
* backend_install_packages:
*/
static void
@@ -450,7 +462,7 @@ PK_BACKEND_OPTIONS (
backend_get_packages, /* get_packages */
backend_get_repo_list, /* get_repo_list */
backend_get_requires, /* get_requires */
- NULL, /* get_update_detail */
+ backend_get_update_detail, /* get_update_detail */
backend_get_updates, /* get_updates */
backend_install_files, /* install_files */
backend_install_packages, /* install_packages */
commit 688051b5a2c5d37c700bb72313eb9b3a0975c8c1
Merge: 4fc603d... 33d9be9...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Sep 22 09:37:36 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 0c1711b5b7dd2402dd5eac4f886a4ef7a54960d9
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 10:10:15 2008 +0200
trivial: use temporary variable
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 60f2cb5..7a3a780 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -95,19 +95,20 @@ class PackageKitSmartProgress(Progress):
if self._fetcher and subtopic != self._lasturl:
packages = self._backend._packagesdict
if not packages:
- if subtopic.find('repomd') != -1 \
- or subtopic.find('Release') != -1:
+ filename = subtopic
+ if filename.find('repomd') != -1 \
+ or filename.find('Release') != -1:
self._backend.status(STATUS_DOWNLOAD_REPOSITORY)
- elif subtopic.find('primary') != -1 \
- or subtopic.find('Packages') != -1:
+ elif filename.find('primary') != -1 \
+ or filename.find('Packages') != -1:
self._backend.status(STATUS_DOWNLOAD_PACKAGELIST)
- elif subtopic.find('filelists') != -1:
+ elif filename.find('filelists') != -1:
self._backend.status(STATUS_DOWNLOAD_FILELIST)
- elif subtopic.find('other') != -1:
+ elif filename.find('other') != -1:
self._backend.status(STATUS_DOWNLOAD_CHANGELOG)
- elif subtopic.find('comps') != -1:
+ elif filename.find('comps') != -1:
self._backend.status(STATUS_DOWNLOAD_GROUP)
- elif subtopic.find('updateinfo') != -1:
+ elif filename.find('updateinfo') != -1:
self._backend.status(STATUS_DOWNLOAD_UPDATEINFO)
return
for package in packages:
commit b15ec7a6d57f885cfd47ea9a05e35046437a816a
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 10:07:40 2008 +0200
smart: add download status for non-package/repodata files
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 8234870..60f2cb5 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -95,6 +95,20 @@ class PackageKitSmartProgress(Progress):
if self._fetcher and subtopic != self._lasturl:
packages = self._backend._packagesdict
if not packages:
+ if subtopic.find('repomd') != -1 \
+ or subtopic.find('Release') != -1:
+ self._backend.status(STATUS_DOWNLOAD_REPOSITORY)
+ elif subtopic.find('primary') != -1 \
+ or subtopic.find('Packages') != -1:
+ self._backend.status(STATUS_DOWNLOAD_PACKAGELIST)
+ elif subtopic.find('filelists') != -1:
+ self._backend.status(STATUS_DOWNLOAD_FILELIST)
+ elif subtopic.find('other') != -1:
+ self._backend.status(STATUS_DOWNLOAD_CHANGELOG)
+ elif subtopic.find('comps') != -1:
+ self._backend.status(STATUS_DOWNLOAD_GROUP)
+ elif subtopic.find('updateinfo') != -1:
+ self._backend.status(STATUS_DOWNLOAD_UPDATEINFO)
return
for package in packages:
for loader in package.loaders:
commit 2da8ecbeaf52c42174846f2b02c8a277ec541c8f
Author: Anders F Bjorklund <afb at users.sourceforge.net>
Date: Mon Sep 22 09:41:02 2008 +0200
refactor smart package_id to own method
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index 7fdac2f..8234870 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -930,6 +930,23 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
for package,status in self._package_list:
self._show_package(package, status)
+ def _package_id(self, package, loader=None):
+ name, version, arch = self._splitpackage(package)
+ collection = False
+ if name.startswith('^'):
+ collection = True
+ name = name.replace('^', '@', 1)
+ if not loader:
+ loader = package.loaders[0]
+ channel = loader.getChannel()
+ if package.installed:
+ data = 'installed'
+ elif self._channel_is_local(channel):
+ data = 'local'
+ else:
+ data = channel.getAlias()
+ return pkpackage.get_package_id(name, version, arch, data)
+
def _show_package(self, package, status=None):
if not status:
if self._status == STATUS_DOWNLOAD:
@@ -942,25 +959,13 @@ class PackageKitSmartBackend(PackageKitBaseBackend):
status = INFO_REMOVING
else:
status = INFO_UNKNOWN
- name, version, arch = self._splitpackage(package)
- collection = False
- if name.startswith('^'):
- collection = True
- name = name.replace('^', '@', 1)
for loader in package.loaders:
channel = loader.getChannel()
if package.installed and not channel.getType().endswith('-sys'):
continue
info = loader.getInfo(package)
- if package.installed:
- data = 'installed'
- elif self._channel_is_local(channel):
- data = 'local'
- else:
- data = channel.getAlias()
summary = info.getSummary()
- self.package(pkpackage.get_package_id(name, version, arch, data),
- status, summary)
+ self.package(self._package_id(package, loader), status, summary)
def _package_in_requires(self, packagename, groupname):
groups = self.ctrl.getCache().getPackages(groupname)
commit 33d9be92ca7cdf3dc2891a9ab472118ad2cb6eb8
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Mon Sep 22 09:02:27 2008 +0200
yum: get-updates should list obsoletes too
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 6604d7a..7437ca6 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1459,13 +1459,16 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
fltlist = filters.split(';')
package_list = []
pkgfilter = YumFilter(fltlist)
-
+ pkgs = []
try:
ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
+ pkgs.extend(ygl.updates)
+ ygl = self.yumbase.doPackageLists(pkgnarrow='obsoletes')
+ pkgs.extend(ygl.obsoletes)
except yum.Errors.RepoError,e:
self.error(ERROR_REPO_NOT_AVAILABLE,str(e))
md = self.updateMetadata
- for pkg in ygl.updates:
+ for pkg in pkgs:
if pkgfilter._do_extra_filtering(pkg):
# Get info about package in updates info
notice = md.get_notice((pkg.name,pkg.version,pkg.release))
commit 4fc603d53557adbe7d7bc76a5a51c191e36bf550
Merge: 6c7b57b... c9b9aa8...
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Sep 21 20:56:34 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit c9b9aa86f1f5e00e66367a3e198a01718ed2208a
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Sun Sep 21 19:14:39 2008 +0200
python API: changed license to GPLv2+ for client.py so all python stuff has the same license
diff --git a/python/packagekit/client.py b/python/packagekit/client.py
index fa80da4..6101788 100644
--- a/python/packagekit/client.py
+++ b/python/packagekit/client.py
@@ -1,11 +1,26 @@
#!/usr/bin/python
#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
# (c) 2008
# Canonical Ltd.
# Aidan Skinner <aidan at skinner.me.uk>
# Martin Pitt <martin.pitt at ubuntu.com>
# Tim Lauridsen <timlau at fedoraproject.org>
-# License: LGPL 2.1 or later
#
# Synchronous PackageKit client wrapper API for Python.
More information about the PackageKit-commit
mailing list