[packagekit] packagekit: Branch 'master' - 25 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Mar 28 05:12:08 PDT 2008
backends/dummy/pk-backend-dummy.c | 52 ++++++++----
backends/poldek/pk-backend-poldek.c | 6 -
backends/yum/helpers/yumBackend.py | 49 +++++++----
backends/yum2/helpers/yumDBUSBackend.py | 116 +++++---------------------
backends/zypp/pk-backend-zypp.cpp | 81 +++++++++---------
client/pk-console.c | 8 -
client/pk-monitor.c | 11 ++
configure.ac | 55 +++++++++---
docs/spec/pk-backend-spawn.xml | 14 +--
libpackagekit/pk-client.c | 121 ++++++++--------------------
libpackagekit/pk-client.h | 5 -
policy/org.freedesktop.packagekit.policy.in | 13 ---
python/packagekit/backend.py | 8 +
src/pk-backend.c | 17 ++-
src/pk-engine.c | 99 +++++++---------------
src/pk-engine.h | 5 -
src/pk-interface.xml | 9 --
src/pk-runner.c | 3
src/pk-security-polkit.c | 2
src/pk-transaction-db.c | 11 +-
20 files changed, 296 insertions(+), 389 deletions(-)
New commits:
commit ebd3c581d4cb667272632b5392073229548da153
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Mar 28 11:42:47 2008 +0000
watch for ::repo-list-changed in pkmon for debugging
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index d723f8d..e9ed835 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -122,6 +122,15 @@ pk_monitor_finished_cb (PkClient *client, PkExitEnum exit, guint runtime, gpoint
}
/**
+ * pk_monitor_repo_list_changed_cb:
+ **/
+static void
+pk_monitor_repo_list_changed_cb (PkClient *client, gpointer data)
+{
+ g_print ("repo-list-changed\n");
+}
+
+/**
* pk_connection_changed_cb:
**/
static void
@@ -197,6 +206,8 @@ main (int argc, char *argv[])
G_CALLBACK (pk_monitor_package_cb), NULL);
g_signal_connect (client, "allow-cancel",
G_CALLBACK (pk_monitor_allow_cancel_cb), NULL);
+ g_signal_connect (client, "repo-list-changed",
+ G_CALLBACK (pk_monitor_repo_list_changed_cb), NULL);
tlist = pk_task_list_new ();
g_signal_connect (tlist, "task-list-changed",
commit 8d8b63b0b6b1b79ca1f1566470ef636242a060b5
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Mar 28 11:40:02 2008 +0000
allow the dummy backend to have it's repo's enabled and disabled for testing. also add a servicepack stub while I'm here, although it won't do anything
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index a985a4e..ce06e3f 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -32,6 +32,10 @@ static gulong _signal_timeout = 0;
static const gchar *_package_id;
static gchar **_package_ids;
static guint _package_current = 0;
+static gboolean _has_service_pack = FALSE;
+static gboolean _repo_enabled_local = FALSE;
+static gboolean _repo_enabled_fedora = TRUE;
+static gboolean _repo_enabled_livna = TRUE;
/**
* backend_initialize:
@@ -596,18 +600,14 @@ backend_get_repo_list (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
+ if (_has_service_pack) {
+ pk_backend_repo_detail (backend, "local",
+ "Local PackageKit volume", _repo_enabled_local);
+ }
pk_backend_repo_detail (backend, "development",
- "Fedora - Development", TRUE);
- pk_backend_repo_detail (backend, "development-debuginfo",
- "Fedora - Development - Debug", TRUE);
- pk_backend_repo_detail (backend, "development-source",
- "Fedora - Development - Source", FALSE);
+ "Fedora - Development", _repo_enabled_fedora);
pk_backend_repo_detail (backend, "livna-development",
- "Livna for Fedora Core 8 - i386 - Development Tree", TRUE);
- pk_backend_repo_detail (backend, "livna-development-debuginfo",
- "Livna for Fedora Core 8 - i386 - Development Tree - Debug", TRUE);
- pk_backend_repo_detail (backend, "livna-development-source",
- "Livna for Fedora Core 8 - i386 - Development Tree - Source", FALSE);
+ "Livna for Fedora Core 8 - i386 - Development Tree", _repo_enabled_livna);
pk_backend_finished (backend);
}
@@ -619,10 +619,18 @@ backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
{
g_return_if_fail (backend != NULL);
pk_backend_set_status (backend, PK_STATUS_ENUM_REQUEST);
- if (enabled == TRUE) {
- pk_warning ("REPO ENABLE '%s'", rid);
+
+ if (pk_strequal (rid, "local")) {
+ pk_debug ("local repo: %i", enabled);
+ _repo_enabled_local = enabled;
+ } else if (pk_strequal (rid, "development")) {
+ pk_debug ("fedora repo: %i", enabled);
+ _repo_enabled_fedora = enabled;
+ } else if (pk_strequal (rid, "livna-development")) {
+ pk_debug ("livna repo: %i", enabled);
+ _repo_enabled_livna = enabled;
} else {
- pk_warning ("REPO DISABLE '%s'", rid);
+ pk_warning ("unknown repo: %s", rid);
}
pk_backend_finished (backend);
}
@@ -646,7 +654,20 @@ static void
backend_service_pack (PkBackend *backend, const gchar *location, gboolean enabled)
{
g_return_if_fail (backend != NULL);
+ pk_backend_set_status (backend, PK_STATUS_ENUM_RUNNING);
pk_warning ("service pack %i on %s device", enabled, location);
+
+ /*
+ * VERY IMPORTANT: THE REPO MUST BE DISABLED IF IT IS ADDED!
+ * (else it's a security flaw, think of a user with a malicious USB key)
+ */
+ if (enabled) {
+ _repo_enabled_local = FALSE;
+ /* we tell the daemon what the new repo is called */
+ pk_backend_repo_detail (backend, "local", NULL, FALSE);
+ }
+ _has_service_pack = enabled;
+
pk_backend_finished (backend);
}
commit cb4a4e2c95a52fb504392b34b66a781d52730231
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 18:46:47 2008 +0000
rip PackageKit from the external API, but leave it in place internally
diff --git a/client/pk-console.c b/client/pk-console.c
index 9e6c91f..da7dd80 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -334,7 +334,6 @@ static const gchar *summary =
" search name|details|group|file data\n"
" install <package_id>\n"
" install-file <file>\n"
- " service-pack <location>\n"
" remove <package_id>\n"
" update <package_id>\n"
" refresh\n"
@@ -825,13 +824,6 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], GError **
} else {
ret = pk_client_install_file (client, value, error);
}
- } else if (strcmp (mode, "service-pack") == 0) {
- if (value == NULL) {
- g_set_error (error, 0, 0, _("specify a location to update from"));
- return FALSE;
- } else {
- ret = pk_client_service_pack (client, value, TRUE, error);
- }
} else if (strcmp (mode, "remove") == 0) {
if (value == NULL) {
g_set_error (error, 0, 0, _("specify a package to remove"));
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index d0dd963..65805b7 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -2562,89 +2562,6 @@ pk_client_install_file (PkClient *client, const gchar *file, GError **error)
return ret;
}
-
-/**
- * pk_client_service_pack_action:
- **/
-static gboolean
-pk_client_service_pack_action (PkClient *client, const gchar *location, gboolean enabled, GError **error)
-{
- gboolean ret;
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
-
- ret = dbus_g_proxy_call (client->priv->proxy, "ServicePack", error,
- G_TYPE_STRING, client->priv->tid,
- G_TYPE_STRING, location,
- G_TYPE_BOOLEAN, enabled,
- G_TYPE_INVALID, G_TYPE_INVALID);
- return ret;
-}
-
-/**
- * pk_client_service_pack:
- * @client: a valid #PkClient instance
- * @location: a location such as "/dev/cdrom"
- * @error: a %GError to put the error code and message in, or %NULL
- *
- * Install a service pack CD of updates or new functionality.
- *
- * Return value: %TRUE if the daemon queued the transaction
- **/
-gboolean
-pk_client_service_pack (PkClient *client, const gchar *location, gboolean enabled, GError **error)
-{
- gboolean ret;
- GError *error_pk = NULL; /* we can't use the same error as we might be NULL */
-
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
- g_return_val_if_fail (location != NULL, FALSE);
-
- /* check to see if we already have a transaction */
- ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
- return FALSE;
- }
-
- /* save this so we can re-issue it */
- client->priv->role = PK_ROLE_ENUM_SERVICE_PACK;
- client->priv->cached_force = enabled;
- client->priv->cached_full_path = g_strdup (location);
-
- /* hopefully do the operation first time */
- ret = pk_client_service_pack_action (client, location, enabled, &error_pk);
-
- /* we were refused by policy */
- if (!ret && pk_polkit_client_error_denied_by_policy (error_pk)) {
- /* try to get auth */
- if (pk_polkit_client_gain_privilege_str (client->priv->polkit, error_pk->message)) {
- /* clear old error */
- g_clear_error (&error_pk);
- /* retry the action now we have got auth */
- ret = pk_client_service_pack_action (client, location, enabled, &error_pk);
- }
- }
- /* we failed one of these, return the error to the user */
- if (!ret) {
- pk_client_error_fixup (&error_pk);
- g_propagate_error (error, error_pk);
- }
-
- if (ret) {
- /* allow clients to respond in the status changed callback */
- pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
-
- /* spin until finished */
- if (client->priv->synchronous) {
- g_main_loop_run (client->priv->loop);
- }
- }
-
- return ret;
-}
-
/**
* pk_client_get_repo_list:
* @client: a valid #PkClient instance
@@ -3184,8 +3101,6 @@ pk_client_requeue (PkClient *client, GError **error)
ret = pk_client_install_package (client, priv->cached_package_id, error);
} else if (priv->role == PK_ROLE_ENUM_INSTALL_FILE) {
ret = pk_client_install_file (client, priv->cached_full_path, error);
- } else if (priv->role == PK_ROLE_ENUM_SERVICE_PACK) {
- ret = pk_client_service_pack (client, priv->cached_full_path, priv->cached_force, error);
} else if (priv->role == PK_ROLE_ENUM_REFRESH_CACHE) {
ret = pk_client_refresh_cache (client, priv->cached_force, error);
} else if (priv->role == PK_ROLE_ENUM_REMOVE_PACKAGE) {
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 3c79976..acd9c7c 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -273,10 +273,6 @@ gboolean pk_client_update_packages_strv (PkClient *client,
gboolean pk_client_install_file (PkClient *client,
const gchar *file,
GError **error);
-gboolean pk_client_service_pack (PkClient *client,
- const gchar *location,
- gboolean enabled,
- GError **error);
gboolean pk_client_resolve (PkClient *client,
const gchar *filter,
const gchar *package,
diff --git a/policy/org.freedesktop.packagekit.policy.in b/policy/org.freedesktop.packagekit.policy.in
index cfc6cf6..1a7908d 100644
--- a/policy/org.freedesktop.packagekit.policy.in
+++ b/policy/org.freedesktop.packagekit.policy.in
@@ -31,18 +31,7 @@
<vendor_url>http://www.packagekit.org/pk-reference.html#api-install-file</vendor_url>
<defaults>
<allow_inactive>no</allow_inactive>
- <allow_active>auth_admin</allow_active>
- </defaults>
- </action>
-
- <action id="org.freedesktop.packagekit.service-pack">
- <_description>Update from service pack</_description>
- <_message>System policy prevents updating from service pack</_message>
- <icon_name>pk-package-update</icon_name>
- <vendor_url>http://www.packagekit.org/pk-reference.html#api-service-pack</vendor_url>
- <defaults>
- <allow_inactive>no</allow_inactive>
- <allow_active>auth_admin</allow_active>
+ <allow_active>auth_admin_keep_always</allow_active>
</defaults>
</action>
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 7d14ed5..5600498 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2154,67 +2154,6 @@ pk_engine_install_file (PkEngine *engine, const gchar *tid, const gchar *full_pa
}
/**
- * pk_engine_service_pack:
- **/
-void
-pk_engine_service_pack (PkEngine *engine, const gchar *tid, const gchar *location,
- gboolean enabled, DBusGMethodInvocation *context)
-{
- gboolean ret;
- PkTransactionItem *item;
- GError *error;
- gchar *sender;
-
- g_return_if_fail (engine != NULL);
- g_return_if_fail (PK_IS_ENGINE (engine));
-
- pk_debug ("ServicePack method called: %s, %s, %i", tid, location, enabled);
-
- /* find pre-requested transaction id */
- item = pk_transaction_list_get_from_tid (engine->priv->transaction_list, tid);
- if (item == NULL) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
- "transaction_id '%s' not found", tid);
- dbus_g_method_return_error (context, error);
- return;
- }
-
- /* check if the action is allowed from this client - if not, set an error */
- sender = dbus_g_method_get_sender (context);
- ret = pk_engine_action_is_allowed (engine, sender, PK_ROLE_ENUM_SERVICE_PACK, &error);
- g_free (sender);
- if (!ret) {
- dbus_g_method_return_error (context, error);
- return;
- }
-
- /* create a new runner object */
- item->runner = pk_engine_runner_new (engine);
-
- /* set the dbus name, so we can get the disconnect */
- pk_runner_set_dbus_name (item->runner, dbus_g_method_get_sender (context));
-
- ret = pk_runner_service_pack (item->runner, location, enabled);
- if (!ret) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
- "Operation not yet supported by backend");
- pk_engine_item_delete (engine, item);
- dbus_g_method_return_error (context, error);
- return;
- }
- /* try to commit this */
- ret = pk_engine_item_commit (engine, item);
- if (!ret) {
- error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_COMMIT_FAILED,
- "Could not commit to a runner object");
- pk_engine_item_delete (engine, item);
- dbus_g_method_return_error (context, error);
- return;
- }
- dbus_g_method_return (context);
-}
-
-/**
* pk_engine_rollback:
**/
void
diff --git a/src/pk-engine.h b/src/pk-engine.h
index e825be2..410aea1 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -168,11 +168,6 @@ void pk_engine_install_file (PkEngine *engine,
const gchar *tid,
const gchar *full_path,
DBusGMethodInvocation *context);
-void pk_engine_service_pack (PkEngine *engine,
- const gchar *tid,
- const gchar *location,
- gboolean enabled,
- DBusGMethodInvocation *context);
void pk_engine_update_packages (PkEngine *engine,
const gchar *tid,
gchar **package_ids,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 9b81c27..f375696 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -113,12 +113,6 @@
<arg type="s" name="tid" direction="in"/>
<arg type="s" name="full_path" direction="in"/>
</method>
- <method name="ServicePack">
- <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="tid" direction="in"/>
- <arg type="s" name="location" direction="in"/>
- <arg type="b" name="enabled" direction="in"/>
- </method>
<!-- signals emitted from any transaction -->
<signal name="StatusChanged">
diff --git a/src/pk-security-polkit.c b/src/pk-security-polkit.c
index 1837162..b20e16a 100644
--- a/src/pk-security-polkit.c
+++ b/src/pk-security-polkit.c
@@ -114,8 +114,6 @@ pk_security_role_to_action (PkSecurity *security, PkRoleEnum role)
policy = "org.freedesktop.packagekit.install";
} else if (role == PK_ROLE_ENUM_INSTALL_FILE) {
policy = "org.freedesktop.packagekit.localinstall";
- } else if (role == PK_ROLE_ENUM_SERVICE_PACK) {
- policy = "org.freedesktop.packagekit.service-pack";
} else if (role == PK_ROLE_ENUM_ROLLBACK) {
policy = "org.freedesktop.packagekit.rollback";
} else if (role == PK_ROLE_ENUM_REPO_ENABLE ||
commit 31e97e1afacaad994bb850f2f713a4c34abd50ec
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Mar 28 10:24:34 2008 +0000
until the time remaining is more sensible, only enable it if PK_IS_DEVELOPER is set
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 5b5261e..8f29d27 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -332,6 +332,8 @@ pk_backend_emit_progress_changed (PkBackend *backend)
gboolean
pk_backend_set_percentage (PkBackend *backend, guint percentage)
{
+ guint remaining;
+
g_return_val_if_fail (backend != NULL, FALSE);
g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
@@ -374,8 +376,13 @@ pk_backend_set_percentage (PkBackend *backend, guint percentage)
pk_time_add_data (backend->priv->time, percentage);
/* lets try this and print as debug */
- backend->priv->last_remaining = pk_time_get_remaining (backend->priv->time);
- pk_debug ("this will now take ~%i seconds", backend->priv->last_remaining);
+ remaining = pk_time_get_remaining (backend->priv->time);
+ pk_debug ("this will now take ~%i seconds", remaining);
+
+#ifdef PK_IS_DEVELOPER
+ /* Until the predicted time is more sane... */
+ backend->priv->last_remaining = remaining;
+#endif
}
/* emit the progress changed signal */
commit 07faa3ad8a853c7d03e3c16e2b857eb08da2f9b3
Author: Scott Reeves <sreeves at novell.com>
Date: Fri Mar 28 00:14:10 2008 -0600
Update to match the libzypp 4.6 API
diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 7ebdf4e..2cc1467 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -573,49 +573,48 @@ backend_get_description_thread (PkBackendThread *thread, gpointer data)
return FALSE;
}
- try {
- PkGroupEnum group = get_enum_group (package);
-
- // currently it is necessary to access the rpmDB directly to get infos like size for already installed packages
- if (package.isSystem ()){
-
- zypp::target::rpm::RpmDb &rpm = zypp_get_rpmDb ();
- rpm.initDatabase();
- zypp::target::rpm::RpmHeader::constPtr rpmHeader;
- rpm.getData (package.name (), package.edition (), rpmHeader);
-
- pk_backend_description (backend,
- d->package_id, // package_id
- rpmHeader->tag_license ().c_str (), // const gchar *license
- group, // PkGroupEnum group
- rpmHeader->tag_description ().c_str (), // const gchar *description
- rpmHeader->tag_url (). c_str (), // const gchar *url
- (gulong)rpmHeader->tag_size ()); // gulong size
-
- rpm.closeDatabase();
- }else{
- pk_backend_description (backend,
- d->package_id,
- package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
- group,
- package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
- "TODO", //pkg->url ().c_str (),
- (gulong)package.lookupNumAttribute (zypp::sat::SolvAttr::size)); //pkg->size ());
- }
+ try {
+ PkGroupEnum group = get_enum_group (package);
+
+ // currently it is necessary to access the rpmDB directly to get infos like size for already installed packages
+ if (package.isSystem ()){
+ zypp::target::rpm::RpmDb &rpm = zypp_get_rpmDb ();
+ rpm.initDatabase();
+ zypp::target::rpm::RpmHeader::constPtr rpmHeader;
+ rpm.getData (package.name (), package.edition (), rpmHeader);
+
+ pk_backend_description (backend,
+ d->package_id, // package_id
+ rpmHeader->tag_license ().c_str (), // const gchar *license
+ group, // PkGroupEnum group
+ rpmHeader->tag_description ().c_str (), // const gchar *description
+ rpmHeader->tag_url (). c_str (), // const gchar *url
+ (gulong)rpmHeader->tag_size ()); // gulong size
+
+ rpm.closeDatabase();
+ }else{
+ pk_backend_description (backend,
+ d->package_id,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::license).c_str (), //pkg->license ().c_str (),
+ group,
+ package.lookupStrAttribute (zypp::sat::SolvAttr::description).c_str (), //pkg->description ().c_str (),
+ "TODO", //pkg->url ().c_str (),
+ (gulong)package.lookupNumAttribute (zypp::sat::SolvAttr::downloadsize)); //pkg->size ());
+ }
- } catch (const zypp::target::rpm::RpmException &ex) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
- pk_backend_finished (backend);
+ } catch (const zypp::target::rpm::RpmException &ex) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_REPO_NOT_FOUND, "Couldn't open rpm-database");
+ pk_backend_finished (backend);
g_free (d->package_id);
- g_free (d);
- return FALSE;
- } catch (const zypp::Exception &ex) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, ex.asUserString ().c_str ());
- pk_backend_finished (backend);
- g_free (d->package_id);
- g_free (d);
- return FALSE;
- }
+ g_free (d);
+ return FALSE;
+ } catch (const zypp::Exception &ex) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, ex.asUserString ().c_str ());
+ pk_backend_finished (backend);
+ g_free (d->package_id);
+ g_free (d);
+ return FALSE;
+ }
pk_package_id_free (pi);
g_free (d->package_id);
diff --git a/configure.ac b/configure.ac
index a04ea8a..63fa4db 100755
--- a/configure.ac
+++ b/configure.ac
@@ -537,7 +537,7 @@ if test x$enable_poldek = xyes; then
fi
if test x$enable_zypp = xyes; then
- PKG_CHECK_MODULES(ZYPP, libzypp >= 4.5.0)
+ PKG_CHECK_MODULES(ZYPP, libzypp >= 4.6.0)
AC_SUBST(ZYPP_CFLAGS)
AC_SUBST(ZYPP_LIBS)
fi
commit 6666d201b131ccaded14082c4bc4f7617648e9c2
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 20:33:38 2008 +0000
do repo-list-changed for the other repo actions
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 57af547..7d14ed5 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -627,7 +627,9 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
}
/* the repo list will have changed */
- if (role == PK_ROLE_ENUM_SERVICE_PACK) {
+ if (role == PK_ROLE_ENUM_SERVICE_PACK ||
+ role == PK_ROLE_ENUM_REPO_ENABLE ||
+ role == PK_ROLE_ENUM_REPO_SET_DATA) {
pk_debug ("emitting repo-list-changed tid:%s", c_tid);
g_signal_emit (engine, signals [PK_ENGINE_REPO_LIST_CHANGED], 0, c_tid);
}
commit 344ebee0831c13cae55262b40ebaf76dcf35fb43
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 20:11:09 2008 +0000
add RepoListChanged when a repo is added or removed
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index 482a41e..d0dd963 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -101,6 +101,7 @@ typedef enum {
PK_CLIENT_PACKAGE,
PK_CLIENT_PROGRESS_CHANGED,
PK_CLIENT_UPDATES_CHANGED,
+ PK_CLIENT_REPO_LIST_CHANGED,
PK_CLIENT_REQUIRE_RESTART,
PK_CLIENT_MESSAGE,
PK_CLIENT_TRANSACTION,
@@ -729,6 +730,21 @@ pk_client_updates_changed_cb (DBusGProxy *proxy, const gchar *tid, PkClient *cli
}
/**
+ * pk_client_repo_list_changed_cb:
+ */
+static void
+pk_client_repo_list_changed_cb (DBusGProxy *proxy, const gchar *tid, PkClient *client)
+{
+ g_return_if_fail (client != NULL);
+ g_return_if_fail (PK_IS_CLIENT (client));
+
+ /* we always emit, even if the tid does not match */
+ pk_debug ("emitting repo-list-changed");
+ g_signal_emit (client, signals [PK_CLIENT_REPO_LIST_CHANGED], 0);
+
+}
+
+/**
* pk_client_transaction_cb:
*/
static void
@@ -3224,6 +3240,19 @@ pk_client_class_init (PkClientClass *klass)
NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
+ * PkClient::repo-list-changed:
+ * @client: the #PkClient instance that emitted the signal
+ *
+ * The ::repo-list-changed signal is emitted when the repo list may have
+ * changed and the client program may have to update some UI.
+ **/
+ signals [PK_CLIENT_REPO_LIST_CHANGED] =
+ g_signal_new ("repo-list-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (PkClientClass, repo_list_changed),
+ NULL, NULL, g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ /**
* PkClient::progress-changed:
* @client: the #PkClient instance that emitted the signal
* @percentage: the percentage of the transaction
@@ -3650,6 +3679,11 @@ pk_client_init (PkClient *client)
dbus_g_proxy_connect_signal (proxy, "UpdatesChanged",
G_CALLBACK (pk_client_updates_changed_cb), client, NULL);
+ dbus_g_proxy_add_signal (proxy, "RepoListChanged",
+ G_TYPE_STRING, G_TYPE_INVALID);
+ dbus_g_proxy_connect_signal (proxy, "RepoListChanged",
+ G_CALLBACK (pk_client_repo_list_changed_cb), client, NULL);
+
dbus_g_proxy_add_signal (proxy, "UpdateDetail",
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING,
@@ -3749,6 +3783,8 @@ pk_client_finalize (GObject *object)
G_CALLBACK (pk_client_status_changed_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "UpdatesChanged",
G_CALLBACK (pk_client_updates_changed_cb), client);
+ dbus_g_proxy_disconnect_signal (client->priv->proxy, "RepoListChanged",
+ G_CALLBACK (pk_client_repo_list_changed_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Package",
G_CALLBACK (pk_client_package_cb), client);
dbus_g_proxy_disconnect_signal (client->priv->proxy, "Transaction",
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index bbb7f2a..3c79976 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -83,6 +83,7 @@ struct _PkClientClass
void (* status_changed) (PkClient *client,
PkStatusEnum status);
void (* updates_changed) (PkClient *client);
+ void (* repo_list_changed) (PkClient *client);
void (* progress_changed) (PkClient *client,
guint percentage,
guint subpercentage,
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 74f1da9..57af547 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -103,6 +103,7 @@ enum {
PK_ENGINE_REQUIRE_RESTART,
PK_ENGINE_MESSAGE,
PK_ENGINE_UPDATES_CHANGED,
+ PK_ENGINE_REPO_LIST_CHANGED,
PK_ENGINE_REPO_SIGNATURE_REQUIRED,
PK_ENGINE_FINISHED,
PK_ENGINE_UPDATE_DETAIL,
@@ -625,6 +626,12 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
g_free (packages);
}
+ /* the repo list will have changed */
+ if (role == PK_ROLE_ENUM_SERVICE_PACK) {
+ pk_debug ("emitting repo-list-changed tid:%s", c_tid);
+ g_signal_emit (engine, signals [PK_ENGINE_REPO_LIST_CHANGED], 0, c_tid);
+ }
+
/* only reset the time if we succeeded */
if (exit == PK_EXIT_ENUM_SUCCESS) {
pk_transaction_db_action_time_reset (engine->priv->transaction_db, role);
@@ -3032,6 +3039,11 @@ pk_engine_class_init (PkEngineClass *klass)
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
0, NULL, NULL, pk_marshal_VOID__STRING,
G_TYPE_NONE, 1, G_TYPE_STRING);
+ signals [PK_ENGINE_REPO_LIST_CHANGED] =
+ g_signal_new ("repo-list-changed",
+ G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
+ 0, NULL, NULL, pk_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
signals [PK_ENGINE_REPO_SIGNATURE_REQUIRED] =
g_signal_new ("repo-signature-required",
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 0fa90a7..9b81c27 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -190,6 +190,9 @@
<signal name="UpdatesChanged">
<arg type="s" name="tid" direction="out"/>
</signal>
+ <signal name="RepoListChanged">
+ <arg type="s" name="tid" direction="out"/>
+ </signal>
<signal name="Locked">
<arg type="b" name="is_locked" direction="out"/>
</signal>
commit 7467257172ca79eca54b46ddb2b1dcfcd4bb1fdd
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 18:04:32 2008 +0000
add --enable-developer to fix rh:439216 and other bugs like that
diff --git a/configure.ac b/configure.ac
index b97ac9c..a04ea8a 100755
--- a/configure.ac
+++ b/configure.ac
@@ -5,6 +5,10 @@ AC_CONFIG_SRCDIR(src)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
AM_CONFIG_HEADER(config.h)
+# Should we enable extra stuff automatically?
+# set no for release builds, yes for development builds
+DEVELOPMENT_RELEASE=yes
+
# libtool versioning - this applies to libpackagekit
#
# See http://sources.redhat.com/autobook/autobook/autobook_91.html#SEC91 for details
@@ -162,10 +166,40 @@ AC_DEFINE_UNQUOTED(PK_BACKEND_USER,"$PK_BACKEND_USER", [Alternative user for run
dnl ---------------------------------------------------------------------------
dnl - Build self tests
dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),enable_tests=$enableval,enable_tests=$USE_MAINTAINER_MODE)
-AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),enable_gcov=$enableval,enable_gcov=no)
-AC_ARG_ENABLE(gprof, AS_HELP_STRING([--enable-gprof],[compile with gprof support (gcc only)]),enable_gprof=$enableval,enable_gprof=no)
-AC_ARG_ENABLE(local, AS_HELP_STRING([--enable-local],[enable running in local checkout]),enable_local=$enableval,enable_local=$USE_MAINTAINER_MODE)
+AC_ARG_ENABLE(tests, AS_HELP_STRING([--enable-tests],[enable unit test code]),
+ enable_tests=$enableval,enable_tests=$DEVELOPMENT_RELEASE)
+AM_CONDITIONAL(PK_BUILD_TESTS, test x$enable_tests = xyes)
+if test x$enable_tests = xyes; then
+ AC_DEFINE(PK_BUILD_TESTS,1,[Build test code])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl - Display DAEMON messages?
+dnl ---------------------------------------------------------------------------
+AC_ARG_ENABLE(developer, AS_HELP_STRING([--enable-developer],[enable daemon debug messages]),
+ enable_developer=$enableval,enable_developer=$DEVELOPMENT_RELEASE)
+AM_CONDITIONAL(PK_IS_DEVELOPER, test x$enable_developer = xyes)
+if test x$enable_developer = xyes; then
+ AC_DEFINE(PK_IS_DEVELOPER,1,[Build developer code])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl - Able to run from a checkout?
+dnl ---------------------------------------------------------------------------
+AC_ARG_ENABLE(local, AS_HELP_STRING([--enable-local],[enable running in local checkout]),
+ enable_local=$enableval,enable_local=$DEVELOPMENT_RELEASE)
+AM_CONDITIONAL(PK_BUILD_LOCAL, test x$enable_local = xyes)
+if test x$enable_local = xyes; then
+ AC_DEFINE(PK_BUILD_LOCAL,1,[Build local code])
+fi
+
+dnl ---------------------------------------------------------------------------
+dnl - Other tests
+dnl ---------------------------------------------------------------------------
+AC_ARG_ENABLE(gcov, AS_HELP_STRING([--enable-gcov],[compile with coverage profiling instrumentation (gcc only)]),
+ enable_gcov=$enableval,enable_gcov=no)
+AC_ARG_ENABLE(gprof, AS_HELP_STRING([--enable-gprof],[compile with gprof support (gcc only)]),
+ enable_gprof=$enableval,enable_gprof=no)
# backends
AC_ARG_ENABLE(alpm, AS_HELP_STRING([--enable-alpm],[use the ALPM backend]),enable_alpm=$enableval,enable_alpm=no)
@@ -197,16 +231,6 @@ AM_CONDITIONAL(BACKEND_TYPE_YUM, [test x$enable_yum = xyes], [using YUM backend]
AM_CONDITIONAL(BACKEND_TYPE_YUM2, [test x$enable_yum2 = xyes], [using YUM DBUS backend])
AM_CONDITIONAL(BACKEND_TYPE_ZYPP, [test x$enable_zypp = xyes], [using Zypp backend])
-AM_CONDITIONAL(PK_BUILD_TESTS, test x$enable_tests = xyes)
-if test x$enable_tests = xyes; then
- AC_DEFINE(PK_BUILD_TESTS,1,[Build test code])
-fi
-
-AM_CONDITIONAL(PK_BUILD_LOCAL, test x$enable_local = xyes)
-if test x$enable_local = xyes; then
- AC_DEFINE(PK_BUILD_LOCAL,1,[Build local code])
-fi
-
if test x$enable_gcov = xyes; then
## so that config.h changes when you toggle gcov support
AC_DEFINE_UNQUOTED(PK_BUILD_GCOV, 1, [Defined if gcov is enabled to force a rebuild due to config.h changing])
@@ -596,6 +620,7 @@ echo "
cflags: ${CFLAGS}
Building unit tests: ${enable_tests}
Able to run locally: ${enable_local}
+ Developer warnings: ${enable_developer}
GCC coverage profiling: ${enable_gcov}
GCC time profiling: ${enable_gprof}
Security framework: ${with_security_framework}
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 933b044..74f1da9 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -415,6 +415,13 @@ pk_engine_message_cb (PkBackend *backend, PkMessageEnum message, const gchar *de
g_return_if_fail (engine != NULL);
g_return_if_fail (PK_IS_ENGINE (engine));
+#ifndef PK_IS_DEVELOPER
+ if (message == PK_MESSAGE_ENUM_DAEMON) {
+ pk_warning ("ignoring message: %s", details);
+ return;
+ }
+#endif
+
c_tid = pk_backend_get_current_tid (engine->priv->backend);
if (c_tid == NULL) {
pk_warning ("could not get current tid from backend");
commit 250a1091b144b271878954922ddee0bdd7a79390
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 16:21:04 2008 +0100
yum: fixes yum Exception return value problem
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 1d5888f..755d4c1 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -892,6 +892,11 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.require_restart(RESTART_SYSTEM,"")
break
+ def _format_msgs(self,msgs):
+ if type(msgs) == type(''):
+ msgs = msgs.split('\n')
+ return ";".join(msgs)
+
def _runYumTransaction(self,removedeps=None):
'''
Run the yum Transaction
@@ -899,7 +904,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'''
rc,msgs = self.yumbase.buildTransaction()
if rc !=2:
- retmsg = "Error in Dependency Resolution;" +";".join(msgs)
+ retmsg = "Error in Dependency Resolution;" + self._format_msgs(msgs)
self.error(ERROR_DEP_RESOLUTION_FAILED,retmsg)
else:
self._check_for_reboot()
@@ -915,10 +920,10 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.yumbase.processTransaction(callback=callback,
rpmDisplay=rpmDisplay)
except yum.Errors.YumDownloadError, ye:
- retmsg = "Error in Download;" +";".join(ye.value)
+ retmsg = "Error in Download;" + self._format_msgs(ye.value)
self.error(ERROR_PACKAGE_DOWNLOAD_FAILED,retmsg)
except yum.Errors.YumGPGCheckError, ye:
- retmsg = "Error in Package Signatures;" +";".join(ye.value)
+ retmsg = "Error in Package Signatures;" + self._format_msgs(ye.value)
self.error(ERROR_INTERNAL_ERROR,retmsg)
except GPGKeyNotImported, e:
keyData = self.yumbase.missingGPGKey
@@ -939,7 +944,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
'GPG')
self.error(ERROR_GPG_FAILURE,"GPG key not imported.")
except yum.Errors.YumBaseError, ye:
- retmsg = "Error in Transaction Processing;" +";".join(ye.value)
+ retmsg = "Error in Transaction Processing;" + self._format_msgs(ye.value)
self.error(ERROR_TRANSACTION_ERROR,retmsg)
def remove(self, allowdep, package):
commit 483cd3946805802c5ca587efb121fc2e57a5b1ff
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 16:03:16 2008 +0100
yum: fixed missing %s
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 5b62b10..933231e 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -89,7 +89,7 @@ class PackageKitBaseBackend:
send 'message' signal
@param typ: MESSAGE_WARNING, MESSAGE_NOTICE, MESSAGE_DEAMON
'''
- print "message\t%s\t" % (typ,msg)
+ print "message\t%s\t%s" % (typ,msg)
sys.stdout.flush()
def package(self,id,status,summary):
commit c1ecd7e9a686079a98b8be6389777816c48a52cc
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 15:59:47 2008 +0100
yum+yum2: fixed type problem
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 3c2444a..1d5888f 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -850,7 +850,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkgs_to_inst = []
self.yumbase.conf.gpgcheck=0
txmbr = self.yumbase.installLocal(inst_file)
- self._checkForNewer(txmbr.po)
+ self._checkForNewer(txmbr[0].po)
try:
# Added the package to the transaction set
if len(self.yumbase.tsInfo) > 0:
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 97f09b9..bbd8be8 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -853,8 +853,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkgs_to_inst = []
self.yumbase.conf.gpgcheck=0
txmbr = self.yumbase.installLocal(inst_file)
- self._checkForNewer(txmbr.po)
- po = txmbr.po
+ self._checkForNewer(txmbr[0].po)
+ po = txmbr[0].po
self.AllowCancel(False)
self.StatusChanged(STATUS_INSTALL)
commit f7d3283ceea363db4a55bd6c1cb2e1d804cd2f49
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 15:21:08 2008 +0100
yum2:
Use yum internal to install a local rpm.
Send a message if a newer version is available when installing a local rpm.
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index 2079525..97f09b9 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -852,8 +852,9 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkgs_to_inst = []
self.yumbase.conf.gpgcheck=0
- po = self._localInstall(inst_file)
-
+ txmbr = self.yumbase.installLocal(inst_file)
+ self._checkForNewer(txmbr.po)
+ po = txmbr.po
self.AllowCancel(False)
self.StatusChanged(STATUS_INSTALL)
@@ -1547,6 +1548,19 @@ class PackageKitYumBackend(PackageKitBaseBackend):
(version,release) = tuple(idver.split('-'))
return epoch,version,release
+ def _checkForNewer(self,po):
+ '''
+ Check if there is a newer version available
+ '''
+ pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
+ if pkgs:
+ newest = pkgs[0]
+ if newest.EVR > po.EVR:
+ #TODO Add code to send a message here
+ self.Message(MESSAGE_WARNING,"Newer version of %s, exist in the repositories " % po.name)
+
+
+
def _findPackage(self,id):
'''
find a package based on a package id (name;version;arch;repoid)
@@ -1570,6 +1584,8 @@ class PackageKitYumBackend(PackageKitBaseBackend):
def _is_inst(self,pkg):
return self.yumbase.rpmdb.installed(po=pkg)
+
+
def _installable(self, pkg, ematch=False):
@@ -1645,90 +1661,6 @@ class PackageKitYumBackend(PackageKitBaseBackend):
return (dep_resolution_errors, unique(bestdeps))
- def _localInstall(self, inst_file):
- """handles installs/updates of rpms provided on the filesystem in a
- local dir (ie: not from a repo)"""
-
- # Slightly modified localInstall from yum's cli.py
-
- # read in each package into a YumLocalPackage Object
- # append it to self.yumbase.localPackages
- # check if it can be installed or updated based on nevra versus rpmdb
- # don't import the repos until we absolutely need them for depsolving
-
- oldcount = len(self.yumbase.tsInfo)
-
- installpkgs = []
- updatepkgs = []
-
- pkg = inst_file
- try:
- po = yum.packages.YumLocalPackage(ts=self.yumbase.rpmdb.readOnlyTS(), filename=pkg)
- except yum.Errors.MiscError:
- self._unlock_yum()
- self.ErrorCode(ERROR_LOCAL_INSTALL_FAILED,'Cannot open file: %s. Skipping.' % pkg)
- self.Finished(EXIT_FAILED)
- self.Exit()
-
- if po.arch == "src":
- # Short circuit for srpms
- self.yumbase.localPackages.append(po)
- self.yumbase.install(po=po)
-
- return po
-
- # everything installed that matches the name
- installedByKey = self.yumbase.rpmdb.searchNevra(name=po.name)
- # go through each package
- if len(installedByKey) == 0: # nothing installed by that name
- installpkgs.append(po)
- else:
- for installed_pkg in installedByKey:
- if po.EVR > installed_pkg.EVR: # we're newer - this is an update, pass to them
- if installed_pkg.name in self.yumbase.conf.exactarchlist:
- if po.arch == installed_pkg.arch:
- updatepkgs.append((po, installed_pkg))
- continue
- else:
- continue
- else:
- updatepkgs.append((po, installed_pkg))
- continue
- elif po.EVR == installed_pkg.EVR:
- if po.arch != installed_pkg.arch and (isMultiLibArch(po.arch) or
- isMultiLibArch(installed_pkg.arch)):
- installpkgs.append(po)
- continue
- else:
- continue
- else:
- continue
-
- # handle excludes for a localinstall
- toexc = []
- if len(self.yumbase.conf.exclude) > 0:
- exactmatch, matched, unmatched = \
- yum.packages.parsePackages(installpkgs + map(lambda x: x[0], updatepkgs),
- self.yumbase.conf.exclude, casematch=1)
- toexc = exactmatch + matched
-
- # Process potential installs
- for po in installpkgs:
- if po in toexc:
- continue # Exclude package
- # Add package to transaction for installation
- self.yumbase.localPackages.append(po)
- self.yumbase.install(po=po)
- # Process potential updates
- for (po, oldpo) in updatepkgs:
- if po in toexc:
- continue # Excludeing package
- # Add Package to transaction for updating
- self.yumbase.localPackages.append(po)
- self.yumbase.tsInfo.addUpdate(po, oldpo)
-
- return po
-
def _check_for_reboot(self):
md = self.updateMetadata
for txmbr in self.yumbase.tsInfo:
@@ -1872,18 +1804,18 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if refs:
for ref in refs:
typ = ref['type']
- href = ref['href']
- title = ref['title']
+ href = ref['href']
+ title = ref['title']
if typ in ('bugzilla','cve') and href != None:
- if title == None:
- title = ""
+ if title == None:
+ title = ""
urls[typ].append("%s;%s" % (href,title))
else:
urls['vendor'].append("%s;%s" % (ref['href'],ref['title']))
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
- reboot = 'system'
+ reboot = 'system'
else:
reboot = 'none'
return desc,urls,reboot
@@ -2038,7 +1970,7 @@ class DownloadCallback( BaseMeter ):
else:
if self.lastPct != pct and pct != 0 and pct != 100:
self.lastPct = pct
- # bump the sub percentage for this package
+ # bump the sub percentage for this package
self.base.SubPercentageChanged(pct)
class PackageKitCallback(RPMBaseCallback):
commit 3c728b6221610dc597fb4a9a25e216748ac08bea
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 15:10:15 2008 +0100
yum: fix some indentation problems
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 46e945c..3c2444a 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -1144,12 +1144,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
typ = ref['type']
href = ref['href']
title = ref['title']
- if typ in ('bugzilla','cve') and href != None:
- if title == None:
- title = ""
- urls[typ].append("%s;%s" % (href,title))
- else:
- urls['vendor'].append("%s;%s" % (ref['href'],ref['title']))
+ if typ in ('bugzilla','cve') and href != None:
+ if title == None:
+ title = ""
+ urls[typ].append("%s;%s" % (href,title))
+ else:
+ urls['vendor'].append("%s;%s" % (ref['href'],ref['title']))
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
commit b57cc87af7511a4dc6feed1fd5c941ec4f0bdff0
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 13:09:15 2008 +0100
yum: added message signal to backend.py and make install-file send a message if a newer file exits
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 7f59b25..46e945c 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -829,7 +829,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
newest = pkgs[0]
if newest.EVR > po.EVR:
#TODO Add code to send a message here
- pass
+ self.message(MESSAGE_WARNING,"Newer version of %s, exist in the repositories " % po.name)
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 706d580..5b62b10 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -83,6 +83,14 @@ class PackageKitBaseBackend:
if self.isLocked():
self.unLock()
sys.exit(1)
+
+ def message(self,typ,msg):
+ '''
+ send 'message' signal
+ @param typ: MESSAGE_WARNING, MESSAGE_NOTICE, MESSAGE_DEAMON
+ '''
+ print "message\t%s\t" % (typ,msg)
+ sys.stdout.flush()
def package(self,id,status,summary):
'''
commit 12858343b541c1d2a95eaea3439d63eb46b6e157
Author: Tim Lauridsen <timlau at fedoraproject.org>
Date: Thu Mar 27 12:55:46 2008 +0100
yum: added code for checking for newer available version, when installing a local rpm (install-file) (Don't do anything yet, just doing the check)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index abf23c5..7f59b25 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -823,6 +823,16 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"No packages to instal")
+ def _checkForNewer(self,po):
+ pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
+ if pkgs:
+ newest = pkgs[0]
+ if newest.EVR > po.EVR:
+ #TODO Add code to send a message here
+ pass
+
+
+
def install_file (self, inst_file):
'''
Implement the {backend}-install_file functionality
@@ -840,7 +850,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
pkgs_to_inst = []
self.yumbase.conf.gpgcheck=0
txmbr = self.yumbase.installLocal(inst_file)
- print txmbr
+ self._checkForNewer(txmbr.po)
try:
# Added the package to the transaction set
if len(self.yumbase.tsInfo) > 0:
@@ -1132,18 +1142,18 @@ class PackageKitYumBackend(PackageKitBaseBackend):
if refs:
for ref in refs:
typ = ref['type']
- href = ref['href']
- title = ref['title']
+ href = ref['href']
+ title = ref['title']
if typ in ('bugzilla','cve') and href != None:
- if title == None:
- title = ""
+ if title == None:
+ title = ""
urls[typ].append("%s;%s" % (href,title))
else:
urls['vendor'].append("%s;%s" % (ref['href'],ref['title']))
# Reboot flag
if notice.get_metadata().has_key('reboot_suggested') and notice['reboot_suggested']:
- reboot = 'system'
+ reboot = 'system'
else:
reboot = 'none'
return self._format_str(desc),urls,reboot
@@ -1315,9 +1325,9 @@ class DownloadCallback( BaseMeter ):
self.base.sub_percentage(0)
else:
if self.lastPct != pct and pct != 0 and pct != 100:
- self.lastPct = pct
- # bump the sub persentage for this package
- self.base.sub_percentage(pct)
+ self.lastPct = pct
+ # bump the sub persentage for this package
+ self.base.sub_percentage(pct)
class PackageKitCallback(RPMBaseCallback):
def __init__(self,base):
commit e5a27cc67f056e36cc6d31521eba5e9c5329b3bd
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 00:26:29 2008 +0000
correctly set transaction state in pk_engine_finished_cb
diff --git a/src/pk-engine.c b/src/pk-engine.c
index d4b48d4..933b044 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -625,10 +625,8 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
/* did we finish okay? */
if (exit == PK_EXIT_ENUM_SUCCESS) {
- /* yes */
pk_transaction_db_set_finished (engine->priv->transaction_db, c_tid, TRUE, time);
} else {
- /* no */
pk_transaction_db_set_finished (engine->priv->transaction_db, c_tid, FALSE, time);
}
commit 578d6abfab1f3e318aef94b06ac46bab75dd7160
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 00:25:51 2008 +0000
correctly set transaction state in pk_engine_finished_cb
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 361cc8b..d4b48d4 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -604,6 +604,7 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
/* find the length of time we have been running */
time = pk_runner_get_runtime (item->runner);
+ pk_debug ("backend was running for %i ms", time);
/* add to the database if we are going to log it */
if (role == PK_ROLE_ENUM_UPDATE_SYSTEM ||
@@ -617,14 +618,20 @@ pk_engine_finished_cb (PkBackend *backend, PkExitEnum exit, PkEngine *engine)
g_free (packages);
}
- pk_debug ("backend was running for %i ms", time);
- pk_transaction_db_set_finished (engine->priv->transaction_db, c_tid, TRUE, time);
-
/* only reset the time if we succeeded */
if (exit == PK_EXIT_ENUM_SUCCESS) {
pk_transaction_db_action_time_reset (engine->priv->transaction_db, role);
}
+ /* did we finish okay? */
+ if (exit == PK_EXIT_ENUM_SUCCESS) {
+ /* yes */
+ pk_transaction_db_set_finished (engine->priv->transaction_db, c_tid, TRUE, time);
+ } else {
+ /* no */
+ pk_transaction_db_set_finished (engine->priv->transaction_db, c_tid, FALSE, time);
+ }
+
exit_text = pk_exit_enum_to_text (exit);
pk_debug ("emitting finished transaction:%s, '%s', %i", c_tid, exit_text, time);
g_signal_emit (engine, signals [PK_ENGINE_FINISHED], 0, c_tid, exit_text, time);
commit 6ad0042cd04df67fd75c372283a771986cf4db8e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 00:12:13 2008 +0000
return the correct Finished value when doing GetOldTransactions
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 3cd3e7e..361cc8b 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2701,6 +2701,7 @@ gboolean
pk_engine_get_old_transactions (PkEngine *engine, const gchar *tid, guint number, GError **error)
{
PkTransactionItem *item;
+ const gchar *exit_text;
g_return_val_if_fail (engine != NULL, FALSE);
g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
@@ -2717,8 +2718,11 @@ pk_engine_get_old_transactions (PkEngine *engine, const gchar *tid, guint number
engine->priv->sync_item = item;
pk_transaction_db_get_list (engine->priv->transaction_db, number);
- pk_debug ("emitting finished transaction:%s, '%s', %i", tid, "", 0);
- g_signal_emit (engine, signals [PK_ENGINE_FINISHED], 0, tid, "", 0);
+
+ exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
+ pk_debug ("emitting finished transaction:%s, '%s', %i", tid, exit_text, 0);
+ g_signal_emit (engine, signals [PK_ENGINE_FINISHED], 0, tid, exit_text, 0);
+
pk_transaction_list_remove (engine->priv->transaction_list, item);
return TRUE;
}
commit b7fdb8f0be3ce8065b6adaec1e06656caf412a6e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 27 00:05:09 2008 +0000
if we failed to get the duration, then set to zero rather than using the last value
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index a46341b..635b4c5 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -122,8 +122,8 @@ pk_transaction_sqlite_callback (void *data, gint argc, gchar **argv, gchar **col
value = argv[i];
if (pk_strequal (col, "succeeded")) {
ret = pk_strtouint (value, &temp);
- if (ret == FALSE) {
- pk_warning ("failed to convert");
+ if (!ret) {
+ pk_warning ("failed to parse succeeded: %s", value);
}
if (temp == 1) {
item.succeeded = TRUE;
@@ -152,11 +152,12 @@ pk_transaction_sqlite_callback (void *data, gint argc, gchar **argv, gchar **col
}
} else if (pk_strequal (col, "duration")) {
ret = pk_strtouint (value, &item.duration);
- if (ret == FALSE) {
- pk_warning ("failed to convert");
+ if (!ret) {
+ pk_warning ("failed to parse duration: %s", value);
+ item.duration = 0;
}
if (item.duration > 60*60*12) {
- pk_warning ("insane duartion %i", item.duration);
+ pk_warning ("insane duration: %i", item.duration);
item.duration = 0;
}
} else {
commit ba87f27e5ce49b5a66113d2a95a10eaab7659ee3
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Mar 26 23:33:42 2008 +0000
allow pk_backend_set_status(FINISHED) when we have an error set - which should fix the finished status call in the client applications
diff --git a/src/pk-backend.c b/src/pk-backend.c
index bc89958..5b5261e 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -473,7 +473,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* have we already set an error? */
- if (backend->priv->set_error) {
+ if (backend->priv->set_error && status != PK_STATUS_ENUM_FINISHED) {
pk_warning ("already set error, cannot process");
return FALSE;
}
commit 1e5e46f527a10b5e3c651721864ef13ba25f5abf
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Mar 26 23:30:32 2008 +0000
convert a warnign to a debug
diff --git a/src/pk-backend.c b/src/pk-backend.c
index c9658ac..bc89958 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -503,7 +503,7 @@ pk_backend_set_status (PkBackend *backend, PkStatusEnum status)
/* do we have to enumate a running call? */
if (status != PK_STATUS_ENUM_RUNNING && status != PK_STATUS_ENUM_SETUP) {
if (backend->priv->status == PK_STATUS_ENUM_SETUP) {
- pk_warning ("emiting status-changed running");
+ pk_debug ("emiting status-changed running");
g_signal_emit (backend, signals [PK_BACKEND_STATUS_CHANGED], 0, PK_STATUS_ENUM_RUNNING);
}
}
@@ -860,7 +860,7 @@ pk_backend_repo_detail (PkBackend *backend, const gchar *repo_id,
}
/**
- * pk_backend_finished_delay:
+ * pk_backend_error_timeout_delay_cb:
*
* We have to call Finished() within PK_BACKEND_FINISHED_ERROR_TIMEOUT of ErrorCode(), enforce this.
**/
commit 1a8a45f20b83822437891169979456ec50a41327
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Mar 26 23:23:04 2008 +0000
don't leave it up to backends to set the STATUS_CANCEL state, do it in the runner
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index e8722b1..a985a4e 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -110,7 +110,6 @@ backend_cancel (PkBackend *backend)
g_source_remove (_signal_timeout);
/* emulate that it takes us a few ms to cancel */
- pk_backend_set_status (backend, PK_STATUS_ENUM_CANCEL);
g_timeout_add (1500, backend_cancel_timeout, backend);
}
}
diff --git a/src/pk-runner.c b/src/pk-runner.c
index 28c5edc..842a6e8 100644
--- a/src/pk-runner.c
+++ b/src/pk-runner.c
@@ -234,6 +234,9 @@ pk_runner_cancel (PkRunner *runner, gchar **error_text)
return FALSE;
}
+ /* set the state, as cancelling might take a few seconds */
+ pk_backend_set_status (runner->priv->backend, PK_STATUS_ENUM_CANCEL);
+
/* actually run the method */
runner->priv->backend->desc->cancel (runner->priv->backend);
return TRUE;
commit 0139fd93831080bf1056a28a25c99287eb8fb263
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Mar 26 23:16:10 2008 +0000
add to the html documentaion about flushing
diff --git a/docs/spec/pk-backend-spawn.xml b/docs/spec/pk-backend-spawn.xml
index 842661d..7c73e59 100644
--- a/docs/spec/pk-backend-spawn.xml
+++ b/docs/spec/pk-backend-spawn.xml
@@ -47,6 +47,13 @@
A method has command line arguments seporated with tabs, and data is also
seporated with tabs.
</para>
+ <para>
+ It is important to flush the standard output after each output, else
+ Linux will helpfully buffer the output into more efficient size chunks.
+ If you do not flush, then there will be a long IPC delay.
+ Flushing can be achived in C using <literal>fflush</literal> or in python
+ using <literal>sys.stdout.flush()</literal>.
+ </para>
<sect1 id="backends-spawn-methods">
<title>Methods</title>
@@ -196,37 +203,30 @@
<row>
<entry>Package</entry>
<entry><literal>package_id[tab]status[tab]summary</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>Description</entry>
<entry><literal>description[tab]package_id[tab]group[tab]detail[tab]url[tab]size_in_bytes</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>Files</entry>
<entry><literal>files[tab]package_id[tab]file_list</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>UpdateDetail</entry>
<entry><literal>package_id[tab]updates[tab]obsoletes[tab]vendor_url[tab]bugzilla_url[tab]cve_url[tab]restart[tab]update_text</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>ChangeTransactionData</entry>
<entry><literal>change-transaction-data[tab]data</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>RepoSignatureRequired</entry>
<entry><literal>repository_name[tab]key_url[tab]key_userid[tab]key_id[tab]key_fingerprint[tab]key_timestamp[tab]type</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
<row>
<entry>RepoDetail</entry>
<entry><literal>repo-detail[tab]repo_id[tab]description[tab]enabled</literal></entry>
- <entry><literal>stdout</literal></entry>
</row>
</tbody>
</tgroup>
commit 2381e772a30ed7aa358c4d42afa7fb8b4c66f20f
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Mar 26 23:15:39 2008 +0000
allow searches to be cancelled in the dummy backend
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 1a1df6f..e8722b1 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -391,6 +391,7 @@ backend_search_details (PkBackend *backend, const gchar *filter, const gchar *se
{
g_return_if_fail (backend != NULL);
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.");
@@ -405,6 +406,7 @@ backend_search_file (PkBackend *backend, const gchar *filter, const gchar *searc
{
g_return_if_fail (backend != NULL);
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.");
@@ -419,6 +421,7 @@ backend_search_group (PkBackend *backend, const gchar *filter, const gchar *sear
{
g_return_if_fail (backend != NULL);
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.");
@@ -459,6 +462,7 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
{
g_return_if_fail (backend != NULL);
pk_backend_no_percentage_updates (backend);
+ pk_backend_set_allow_cancel (backend, TRUE);
pk_backend_set_status (backend, PK_STATUS_ENUM_QUERY);
_signal_timeout = g_timeout_add (2000, backend_search_name_timeout, backend);
}
commit 04c5cfcb9f9c12ef4db58746633a596bd7d46806
Author: Marcin Banasiak <megabajt at pld-linux.org>
Date: Wed Mar 26 22:06:44 2008 +0100
poldek: don't set SETUP status before the thread is created
diff --git a/backends/poldek/pk-backend-poldek.c b/backends/poldek/pk-backend-poldek.c
index 13daa74..69ff91d 100644
--- a/backends/poldek/pk-backend-poldek.c
+++ b/backends/poldek/pk-backend-poldek.c
@@ -1583,8 +1583,6 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_SETUP);
-
if (pk_network_is_online (network) == FALSE) {
/* free allocated memory */
if (data)
@@ -1735,8 +1733,6 @@ backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean al
g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_SETUP);
-
data->package_id = g_strdup (package_id);
data->allow_deps = allow_deps;
pk_backend_thread_create (thread, backend_remove_package_thread, data);
@@ -1919,8 +1915,6 @@ backend_update_packages (PkBackend *backend, gchar **package_ids)
g_return_if_fail (backend != NULL);
- pk_backend_set_status (backend, PK_STATUS_ENUM_SETUP);
-
if (pk_network_is_online (network) == FALSE) {
/* free allocated memory */
if (data)
More information about the PackageKit
mailing list