[packagekit] packagekit: Branch 'master' - 10 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Oct 23 23:33:09 PDT 2007
backends/BACKENDS | 4
backends/conary/helpers/conaryBackend.py | 4
backends/conary/pk-backend-conary.c | 153 -------------------
backends/pisi/helpers/Makefile.am | 10 -
backends/pisi/helpers/get-depends.py | 19 ++
backends/pisi/helpers/get-requires.py | 19 ++
backends/pisi/helpers/get-updates.py | 2
backends/pisi/helpers/pisiBackend.py | 89 +++++++----
backends/pisi/helpers/remove.py | 2
backends/pisi/helpers/resolve.py | 2
backends/pisi/pk-backend-pisi.c | 118 +-------------
backends/smart/pk-backend-smart.c | 47 -----
backends/yum/pk-backend-yum.c | 249 ++-----------------------------
client/pk-console.c | 40 ++++
src/Makefile.am | 5
src/pk-backend-python.c | 231 ++++++++++++++++++++++++++++
src/pk-backend-python.h | 88 ++++++++++
src/pk-engine.h | 4
src/pk-time.c | 6
19 files changed, 520 insertions(+), 572 deletions(-)
New commits:
commit dfb6b800114c382d25186429c6898c40b9a0d340
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 08:36:47 2007 -0400
pisi: use pk-python-backend functions
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 748a794..2366036 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -20,124 +20,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <gmodule.h>
-#include <glib.h>
-#include <string.h>
#include <pk-backend.h>
-
-/**
- * backend_get_depends:
- */
-static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
-}
-
-/**
- * backend_get_requires:
- */
-static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-requires.py", package_id, NULL);
-}
-
-/**
- * backend_get_updates:
- */
-static void
-backend_get_updates (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-updates.py", NULL);
-}
-
-/**
- * backend_install_package:
- */
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "install.py", package_id, NULL);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
-}
-
-/**
- * backend_remove_package:
- */
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
- g_return_if_fail (backend != NULL);
- const gchar *deps;
- if (allow_deps == TRUE) {
- deps = "yes";
- } else {
- deps = "no";
- }
- pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
-}
-
-/**
- * backend_resolve:
- */
-static void
-backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
-}
-
-/**
- * backend_update_package:
- */
-static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
-}
-
-/**
- * backend_get_repo_list:
- */
-static void
-backend_get_repo_list (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-repo-list.py", NULL);
-}
+#include <pk-backend-python.h>
PK_BACKEND_OPTIONS (
"PiSi", /* description */
@@ -148,24 +32,24 @@ PK_BACKEND_OPTIONS (
NULL, /* get_groups */
NULL, /* get_filters */
NULL, /* cancel */
- backend_get_depends, /* get_depends */
+ pk_backend_python_get_depends, /* get_depends */
NULL, /* get_description */
- backend_get_requires, /* get_requires */
+ pk_backend_python_get_requires, /* get_requires */
NULL, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_package, /* install_package */
+ pk_backend_python_get_updates, /* get_updates */
+ pk_backend_python_install_package, /* install_package */
NULL, /* install_file */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_package, /* remove_package */
- backend_resolve, /* resolve */
+ pk_backend_python_refresh_cache, /* refresh_cache */
+ pk_backend_python_remove_package, /* remove_package */
+ pk_backend_python_resolve, /* resolve */
NULL, /* rollback */
NULL, /* search_details */
NULL, /* search_file */
NULL, /* search_group */
NULL, /* search_name */
- backend_update_package, /* update_package */
+ pk_backend_python_update_package, /* update_package */
NULL, /* update_system */
- backend_get_repo_list, /* get_repo_list */
+ pk_backend_python_get_repo_list, /* get_repo_list */
NULL, /* repo_enable */
NULL /* repo_set_data */
);
commit c8093b888b393842325e94e378754f53c4b7dddd
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 01:38:33 2007 -0400
conary: use pk-python-backend functions
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 6e7a7de..710c11b 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -20,10 +20,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <gmodule.h>
#include <glib.h>
-#include <string.h>
#include <pk-backend.h>
+#include <pk-backend-python.h>
/**
* backend_get_groups:
@@ -61,136 +60,6 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
-1);
}
-/**
- * backend_get_description:
- */
-/**
-static void
-backend_get_description (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-description.py", package_id, NULL);
-}
- */
-
-/**
- * backend_get_updates:
- */
-static void
-backend_get_updates (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-updates.py", NULL);
-}
-
-/**
- * backend_install_package:
- */
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "install.py", package_id, NULL);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
-}
-
-/**
- * backend_remove_package:
- */
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
- g_return_if_fail (backend != NULL);
- const gchar *deps;
- if (allow_deps == TRUE) {
- deps = "yes";
- } else {
- deps = "no";
- }
- pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
-}
-
-/**
- * backend_search_details:
- */
-/**
-static void
-backend_search_details (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-details.py", filter, search, NULL);
-}
- */
-
-/**
- * backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-name.py", filter, search, NULL);
-}
-
-/**
- * backend_update_package:
- */
-static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
-}
-
-/**
- * backend_update_system:
- */
-static void
-backend_update_system (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "update-system.py", NULL);
-}
-
-/**
- * backend_get_depends:
- */
-/**
-static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
-}
- */
-
PK_BACKEND_OPTIONS (
"Conary", /* description */
"0.0.1", /* version */
@@ -204,19 +73,19 @@ PK_BACKEND_OPTIONS (
NULL, /* get_description */
NULL, /* get_requires */
NULL, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_package, /* install_package */
+ pk_backend_python_get_updates, /* get_updates */
+ pk_backend_python_install_package, /* install_package */
NULL, /* install_file */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_package, /* remove_package */
+ pk_backend_python_refresh_cache, /* refresh_cache */
+ pk_backend_python_remove_package, /* remove_package */
NULL, /* resolve */
NULL, /* search_details */
NULL, /* rollback */
NULL, /* search_file */
NULL, /* search_group */
- backend_search_name, /* search_name */
- backend_update_package, /* update_package */
- backend_update_system, /* update_system */
+ pk_backend_python_search_name, /* search_name */
+ pk_backend_python_update_package, /* update_package */
+ pk_backend_python_update_system, /* update_system */
NULL, /* get_repo_list */
NULL, /* repo_enable */
NULL /* repo_set_data */
commit 4c404e054ab0ef53920bc57b8899209397289a7c
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 01:32:42 2007 -0400
conary: move allow-interrupt into python
diff --git a/backends/conary/helpers/conaryBackend.py b/backends/conary/helpers/conaryBackend.py
index 4ecc816..69877a7 100644
--- a/backends/conary/helpers/conaryBackend.py
+++ b/backends/conary/helpers/conaryBackend.py
@@ -130,6 +130,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Implement the {backend}-search-name functionality
'''
+ self.allow_interrupt(True)
+ self.percentage(None)
+
self._do_search(searchlist, options)
def search_details(self, opt, key):
@@ -271,6 +274,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return INFO_NORMAL
def get_updates(self):
+ self.allow_interrupt(True)
self.percentage()
try:
updateItems = self.client.fullUpdateItemList()
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index a31df43..6e7a7de 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -69,7 +69,6 @@ static void
backend_get_description (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
- pk_backend_allow_interrupt (backend, TRUE);
pk_backend_spawn_helper (backend, "get-description.py", package_id, NULL);
}
*/
@@ -81,7 +80,6 @@ static void
backend_get_updates (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_backend_allow_interrupt (backend, TRUE);
pk_backend_spawn_helper (backend, "get-updates.py", NULL);
}
@@ -141,7 +139,6 @@ static void
backend_search_details (PkBackend *backend, const gchar *filter, const gchar *search)
{
g_return_if_fail (backend != NULL);
- pk_backend_allow_interrupt (backend, TRUE);
pk_backend_spawn_helper (backend, "search-details.py", filter, search, NULL);
}
*/
@@ -153,8 +150,6 @@ static void
backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
{
g_return_if_fail (backend != NULL);
- pk_backend_allow_interrupt (backend, TRUE);
- pk_backend_no_percentage_updates (backend);
pk_backend_spawn_helper (backend, "search-name.py", filter, search, NULL);
}
@@ -192,7 +187,6 @@ static void
backend_get_depends (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
- pk_backend_allow_interrupt (backend, TRUE);
pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
}
*/
commit 037cdc891befd6ffbaf9f6c79217364542e9fe50
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 18:20:46 2007 -0400
smart: use pk-backend-python functions
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index 53112f8..7e7e072 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -20,46 +20,9 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <gmodule.h>
-#include <glib.h>
-#include <string.h>
-#include <pk-backend.h>
-
-/**
- * backend_remove_package:
- */
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
- g_return_if_fail (backend != NULL);
- const gchar *deps;
- if (allow_deps == TRUE) {
- deps = "yes";
- } else {
- deps = "no";
- }
- pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
-}
-/**
- * backend_resolve:
- */
-static void
-backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
-}
-
-/**
- * backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-name.py", filter, search, NULL);
-}
+#include <pk-backend.h>
+#include <pk-backend-python.h>
PK_BACKEND_OPTIONS (
"SMART", /* description */
@@ -78,13 +41,13 @@ PK_BACKEND_OPTIONS (
NULL, /* install_package */
NULL, /* install_file */
NULL, /* refresh_cache */
- backend_remove_package, /* remove_package */
- backend_resolve, /* resolve */
+ pk_backend_python_remove_package, /* remove_package */
+ pk_backend_python_resolve, /* resolve */
NULL, /* rollback */
NULL, /* search_details */
NULL, /* search_file */
NULL, /* search_group */
- backend_search_name, /* search_name */
+ pk_backend_python_search_name, /* search_name */
NULL, /* update_package */
NULL, /* update_system */
NULL, /* get_repo_list */
commit 116af60350bf7b59bd0ca5ff7b5818d9533769ea
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 18:13:21 2007 -0400
yum: use pk-backend-python functions
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index cf7e016..c69c37b 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -19,10 +19,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-#include <gmodule.h>
-#include <glib.h>
-#include <string.h>
#include <pk-backend.h>
+#include <pk-backend-python.h>
/**
* backend_get_groups:
@@ -52,217 +50,6 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
-1);
}
-/**
- * backend_cancel:
- */
-static void
-backend_cancel (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- /* this feels bad... */
- pk_backend_spawn_kill (backend);
-}
-
-/**
- * backend_get_depends:
- */
-static void
-backend_get_depends (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
-}
-
-/**
- * backend_get_description:
- */
-static void
-backend_get_description (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-description.py", package_id, NULL);
-}
-
-/**
- * backend_get_requires:
- */
-static void
-backend_get_requires (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-requires.py", package_id, NULL);
-}
-
-/**
- * backend_get_updates:
- */
-static void
-backend_get_updates (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-updates.py", NULL);
-}
-
-/**
- * backend_install_package:
- */
-static void
-backend_install_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "install.py", package_id, NULL);
-}
-
-/**
- * backend_install_file:
- */
-static void
-backend_install_file (PkBackend *backend, const gchar *full_path)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "install-file.py", full_path, NULL);
-}
-
-/**
- * backend_refresh_cache:
- */
-static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
-}
-
-/**
- * backend_remove_package:
- */
-static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
-{
- g_return_if_fail (backend != NULL);
- const gchar *deps;
- if (allow_deps == TRUE) {
- deps = "yes";
- } else {
- deps = "no";
- }
- pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
-}
-
-/**
- * backend_search_details:
- */
-static void
-backend_search_details (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-details.py", filter, search, NULL);
-}
-
-/**
- * backend_search_file:
- */
-static void
-backend_search_file (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-file.py", filter, search, NULL);
-}
-
-#if 0
-/**
- * backend_search_group:
- */
-static void
-backend_search_group (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
-}
-#endif
-
-/**
- * backend_search_name:
- */
-static void
-backend_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "search-name.py", filter, search, NULL);
-}
-
-/**
- * backend_update_package:
- */
-static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- /* check network state */
- if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
- pk_backend_finished (backend);
- return;
- }
- pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
-}
-
-/**
- * backend_update_system:
- */
-static void
-backend_update_system (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "update-system.py", NULL);
-}
-
-/**
- * backend_resolve:
- */
-static void
-backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
-}
-
-/**
- * backend_get_repo_list:
- */
-static void
-backend_get_repo_list (PkBackend *backend)
-{
- g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-repo-list.py", NULL);
-}
-
-/**
- * backend_repo_enable:
- */
-static void
-backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
-{
- g_return_if_fail (backend != NULL);
- if (enabled == TRUE) {
- pk_backend_spawn_helper (backend, "repo-enable.py", rid, "true", NULL);
- } else {
- pk_backend_spawn_helper (backend, "repo-enable.py", rid, "false", NULL);
- }
-}
-
PK_BACKEND_OPTIONS (
"YUM", /* description */
"0.0.1", /* version */
@@ -271,26 +58,26 @@ PK_BACKEND_OPTIONS (
NULL, /* destroy */
backend_get_groups, /* get_groups */
backend_get_filters, /* get_filters */
- backend_cancel, /* cancel */
- backend_get_depends, /* get_depends */
- backend_get_description, /* get_description */
- backend_get_requires, /* get_requires */
+ pk_backend_python_cancel, /* cancel */
+ pk_backend_python_get_depends, /* get_depends */
+ pk_backend_python_get_description, /* get_description */
+ pk_backend_python_get_requires, /* get_requires */
NULL, /* get_update_detail */
- backend_get_updates, /* get_updates */
- backend_install_package, /* install_package */
- backend_install_file, /* install_file */
- backend_refresh_cache, /* refresh_cache */
- backend_remove_package, /* remove_package */
- backend_resolve, /* resolve */
+ pk_backend_python_get_updates, /* get_updates */
+ pk_backend_python_install_package, /* install_package */
+ pk_backend_python_install_file, /* install_file */
+ pk_backend_python_refresh_cache, /* refresh_cache */
+ pk_backend_python_remove_package, /* remove_package */
+ pk_backend_python_resolve, /* resolve */
NULL, /* rollback */
- backend_search_details, /* search_details */
- backend_search_file, /* search_file */
+ pk_backend_python_search_details, /* search_details */
+ pk_backend_python_search_file, /* search_file */
NULL, /* search_group */
- backend_search_name, /* search_name */
- backend_update_package, /* update_package */
- backend_update_system, /* update_system */
- backend_get_repo_list, /* get_repo_list */
- backend_repo_enable, /* repo_enable */
+ pk_backend_python_search_name, /* search_name */
+ pk_backend_python_update_package, /* update_package */
+ pk_backend_python_update_system, /* update_system */
+ pk_backend_python_get_repo_list, /* get_repo_list */
+ pk_backend_python_repo_enable, /* repo_enable */
NULL /* repo_set_data */
);
commit 8690906fbbddecc1e38be312e7666880ddedc041
Author: James Bowes <jbowes at dangerouslyinc.com>
Date: Tue Oct 23 01:07:23 2007 -0400
Add pk-backend-python, for common spawning functions for python backends.
diff --git a/src/Makefile.am b/src/Makefile.am
index 16fc2c8..ef8b855 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,7 +32,8 @@ INCLUDES = \
pkbackendincludedir=$(includedir)/packagekit-backend
pkbackendinclude_HEADERS = \
- pk-backend.h
+ pk-backend.h \
+ pk-backend-python.h
sbin_PROGRAMS = \
packagekitd \
@@ -45,6 +46,8 @@ packagekitd_SOURCES = \
pk-backend-internal.h \
pk-backend.c \
pk-backend.h \
+ pk-backend-python.c \
+ pk-backend-python.h \
pk-security.h \
pk-time.h \
pk-time.c \
diff --git a/src/pk-backend-python.c b/src/pk-backend-python.c
new file mode 100644
index 0000000..da53c5d
--- /dev/null
+++ b/src/pk-backend-python.c
@@ -0,0 +1,231 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 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.
+ */
+
+#include <pk-backend-python.h>
+
+/**
+ * pk_backend_python_cancel:
+ */
+void
+pk_backend_python_cancel (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ /* this feels bad... */
+ pk_backend_spawn_kill (backend);
+}
+
+/**
+ * pk_backend_python_get_depends:
+ */
+void
+pk_backend_python_get_depends (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
+}
+
+/**
+ * pk_backend_python_get_description:
+ */
+void
+pk_backend_python_get_description (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-description.py", package_id, NULL);
+}
+
+/**
+ * pk_backend_python_get_requires:
+ */
+void
+pk_backend_python_get_requires (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-requires.py", package_id, NULL);
+}
+
+/**
+ * pk_backend_python_get_updates:
+ */
+void
+pk_backend_python_get_updates (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-updates.py", NULL);
+}
+
+/**
+ * pk_backend_python_install_package:
+ */
+void
+pk_backend_python_install_package (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ /* check network state */
+ if (pk_backend_network_is_online (backend) == FALSE) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
+ pk_backend_finished (backend);
+ return;
+ }
+ pk_backend_spawn_helper (backend, "install.py", package_id, NULL);
+}
+
+/**
+ * pk_backend_python_install_file:
+ */
+void
+pk_backend_python_install_file (PkBackend *backend, const gchar *full_path)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "install-file.py", full_path, NULL);
+}
+
+/**
+ * pk_backend_python_refresh_cache:
+ */
+void
+pk_backend_python_refresh_cache (PkBackend *backend, gboolean force)
+{
+ g_return_if_fail (backend != NULL);
+ /* check network state */
+ if (pk_backend_network_is_online (backend) == FALSE) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
+ pk_backend_finished (backend);
+ return;
+ }
+ pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
+}
+
+/**
+ * pk_backend_python_remove_package:
+ */
+void
+pk_backend_python_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
+{
+ g_return_if_fail (backend != NULL);
+ const gchar *deps;
+ if (allow_deps == TRUE) {
+ deps = "yes";
+ } else {
+ deps = "no";
+ }
+ pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
+}
+
+/**
+ * pk_backend_python_search_details:
+ */
+void
+pk_backend_python_search_details (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "search-details.py", filter, search, NULL);
+}
+
+/**
+ * pk_backend_python_search_file:
+ */
+void
+pk_backend_python_search_file (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "search-file.py", filter, search, NULL);
+}
+
+/**
+ * pk_backend_python_search_group:
+ */
+void
+pk_backend_python_search_group (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "search-group.py", filter, search, NULL);
+}
+
+/**
+ * pk_backend_python_search_name:
+ */
+void
+pk_backend_python_search_name (PkBackend *backend, const gchar *filter, const gchar *search)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "search-name.py", filter, search, NULL);
+}
+
+/**
+ * pk_backend_python_update_package:
+ */
+void
+pk_backend_python_update_package (PkBackend *backend, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ /* check network state */
+ if (pk_backend_network_is_online (backend) == FALSE) {
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
+ pk_backend_finished (backend);
+ return;
+ }
+ pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
+}
+
+/**
+ * pk_backend_python_update_system:
+ */
+void
+pk_backend_python_update_system (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "update-system.py", NULL);
+}
+
+/**
+ * pk_backend_python_resolve:
+ */
+void
+pk_backend_python_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
+}
+
+/**
+ * pk_backend_python_get_repo_list:
+ */
+void
+pk_backend_python_get_repo_list (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-repo-list.py", NULL);
+}
+
+/**
+ * pk_backend_python_repo_enable:
+ */
+void
+pk_backend_python_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+{
+ g_return_if_fail (backend != NULL);
+ if (enabled == TRUE) {
+ pk_backend_spawn_helper (backend, "repo-enable.py", rid, "true", NULL);
+ } else {
+ pk_backend_spawn_helper (backend, "repo-enable.py", rid, "false", NULL);
+ }
+}
diff --git a/src/pk-backend-python.h b/src/pk-backend-python.h
new file mode 100644
index 0000000..a9901f9
--- /dev/null
+++ b/src/pk-backend-python.h
@@ -0,0 +1,88 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
+ * 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.
+ *
+ * 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_BACKEND_PYTHON_H
+#define __PK_BACKEND_PYTHON_H
+
+#include <gmodule.h>
+#include <pk-backend.h>
+
+G_BEGIN_DECLS
+
+void pk_backend_python_cancel (PkBackend *backend);
+
+void pk_backend_python_get_depends (PkBackend *backend,
+ const gchar *package_id);
+
+void pk_backend_python_get_description (PkBackend *backend,
+ const gchar *package_id);
+
+void pk_backend_python_get_requires (PkBackend *backend,
+ const gchar *package_id);
+
+void pk_backend_python_get_updates (PkBackend *backend);
+
+void pk_backend_python_install_package (PkBackend *backend,
+ const gchar *package_id);
+
+void pk_backend_python_install_file (PkBackend *backend,
+ const gchar *full_path);
+
+void pk_backend_python_refresh_cache (PkBackend *backend,
+ gboolean force);
+
+void pk_backend_python_remove_package (PkBackend *backend,
+ const gchar *package_id,
+ gboolean allow_deps);
+
+void pk_backend_python_search_details (PkBackend *backend,
+ const gchar *filter,
+ const gchar *search);
+
+void pk_backend_python_search_file (PkBackend *backend,
+ const gchar *filter,
+ const gchar *search);
+
+void pk_backend_python_search_group (PkBackend *backend,
+ const gchar *filter,
+ const gchar *search);
+
+void pk_backend_python_search_name (PkBackend *backend,
+ const gchar *filter,
+ const gchar *search);
+
+void pk_backend_python_update_package (PkBackend *backend,
+ const gchar *package_id);
+
+void pk_backend_python_update_system (PkBackend *backend);
+
+void pk_backend_python_resolve (PkBackend *backend,
+ const gchar *filter,
+ const gchar *package_id);
+
+void pk_backend_python_get_repo_list (PkBackend *backend);
+
+void pk_backend_python_repo_enable (PkBackend *backend,
+ const gchar *rid,
+ gboolean enabled);
+
+G_END_DECLS
+
+#endif /* __PK_BACKEND_PYTHON_H */
commit 11ceb6442befb7b5607d71eb1992e43f9121a64f
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Wed Oct 24 02:21:40 2007 +0300
PiSi: Add "get depends" and "get requires" support
diff --git a/backends/BACKENDS b/backends/BACKENDS
index 3192cf5..9d28f6b 100644
--- a/backends/BACKENDS
+++ b/backends/BACKENDS
@@ -14,8 +14,8 @@ install-package | X | X | | X | X | | X |
install-file | | X | | X | | | |
remove-package | X | X | | X | X | X | X |
update-package | | | | X | | | X |
-get-depends | | X | | X | | | |
-get-requires | X | | | X | | | |
+get-depends | | X | | X | | | X |
+get-requires | X | | | X | | | X |
get-description | X | X | X | X | | | |
get-update-detail | | | | | | | |
get-repo-list | | X | | | X | | X |
diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index 6773d6c..1cd5852 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -4,12 +4,14 @@ helperdir = $(datadir)/PackageKit/helpers/pisi
NULL =
dist_helper_DATA = \
- resolve.py \
- remove.py \
- refresh-cache.py \
- get-updates.py \
+ get-depends.py \
get-repo-list.py \
+ get-requires.py \
+ get-updates.py \
install.py \
+ refresh-cache.py \
+ remove.py \
+ resolve.py \
update.py \
pisiBackend.py \
$(NULL)
diff --git a/backends/pisi/helpers/get-depends.py b/backends/pisi/helpers/get-depends.py
new file mode 100644
index 0000000..cd70da1
--- /dev/null
+++ b/backends/pisi/helpers/get-depends.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2007 S.ÃaÄlar Onur <caglar at pardus.org.tr>
+#
+# 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
+import pisiBackend
+
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend.get_depends(sys.argv[1])
+
+sys.exit()
diff --git a/backends/pisi/helpers/get-requires.py b/backends/pisi/helpers/get-requires.py
new file mode 100644
index 0000000..3c13910
--- /dev/null
+++ b/backends/pisi/helpers/get-requires.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2007 S.ÃaÄlar Onur <caglar at pardus.org.tr>
+#
+# 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
+import pisiBackend
+
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend.get_requires(sys.argv[1])
+
+sys.exit()
diff --git a/backends/pisi/helpers/get-updates.py b/backends/pisi/helpers/get-updates.py
index 5710a02..86b9ee1 100644
--- a/backends/pisi/helpers/get-updates.py
+++ b/backends/pisi/helpers/get-updates.py
@@ -13,7 +13,7 @@
import sys
import pisiBackend
-backend = pisiBackend.PackageKitPisiBackend(sys.argv[2:])
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
backend.get_updates()
sys.exit()
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index d5ebea1..caaa689 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -22,7 +22,7 @@ import pisi
from packagekit.backend import *
class PackageKitPisiBackend(PackageKitBaseBackend):
-
+
# Currently we only support i686
arch = "i686"
@@ -34,56 +34,62 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.packagedb = pisi.db.packagedb.PackageDB()
self.repodb = pisi.db.repodb.RepoDB()
- def get_package_version(self, pkg):
- if pkg.build is not None:
- version = "%s-%s-%s" % (pkg.version, pkg.release, pkg.build)
+ def __get_package_version(self, package):
+ """ Returns version string of given package """
+ # Internal FIXME: PiSi may provide this
+ if package.build is not None:
+ version = "%s-%s-%s" % (package.version, package.release, package.build)
else:
- version = "%s-%s" % (pkg.version, pkg.release)
+ version = "%s-%s" % (package.version, package.release)
return version
- def resolve(self, filter, package_id):
- """ turns a single package name into a package_id suitable for the other methods. """
-
- self.allow_interrupt(True);
- self.percentage(None)
-
- if self.installdb.has_package(package_id):
+ def __get_package(self, package):
+ """ Returns package object suitable for other methods """
+ if self.installdb.has_package(package):
status = INFO_INSTALLED
- pkg = self.installdb.get_package(package_id)
- elif self.packagedb.has_package(package_id):
+ pkg = self.installdb.get_package(package)
+ elif self.packagedb.has_package(package):
status = INFO_AVAILABLE
- pkg = self.packagedb.get_package(package_id)
+ pkg = self.packagedb.get_package(package)
else:
self.error(ERROR_INTERNAL_ERROR, "Package was not found")
- version = self.get_package_version(pkg)
+ version = self.__get_package_version(pkg)
id = self.get_package_id(pkg.name, version, self.arch, "")
- self.package(id, status, pkg.summary)
+ return self.package(id, status, pkg.summary)
- def remove(self, deps, package_id):
- """ removes given package """
- package = self.get_package_from_id(package_id)[0]
+ def resolve(self, filter, package):
+ """ Turns a single package name into a package_id suitable for the other methods """
+ self.allow_interrupt(True);
+ self.percentage(None)
+ self.__get_package(package)
+ def remove(self, deps, package_id):
+ """ Removes given package from system"""
self.allow_interrupt(False);
self.percentage(None)
+ package = self.get_package_from_id(package_id)[0]
+
if self.installdb.has_package(package):
self.status(STATE_REMOVE)
try:
pisi.api.remove([package])
except pisi.Error,e:
+ # system.base packages cannot be removed from system
self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE, e)
else:
self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is not installed")
def install(self, package_id):
- """ installs given package """
- package = self.get_package_from_id(package_id)[0]
-
+ """ Installs given package into system"""
+ # FIXME: fetch/install progress
self.allow_interrupt(False);
self.percentage(None)
+ package = self.get_package_from_id(package_id)[0]
+
if self.packagedb.has_package(package):
self.status(STATE_INSTALL)
try:
@@ -94,9 +100,10 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
def update(self, package_id):
+ """ Updates given package to its latest version """
# FIXME: fetch/install progress
self.allow_interrupt(False);
- self.percentage(0)
+ self.percentage(None)
package = self.get_package_from_id(package_id)[0]
@@ -109,20 +116,26 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
def get_repo_list(self):
+ """ Prints available repositories """
self.allow_interrupt(True);
self.percentage(None)
for repo in pisi.api.list_repos():
+ # Internal FIXME: What an ugly way to get repo uri
self.repo_detail(repo, self.repodb.get_repo(repo).indexuri.get_uri(), "true")
def get_updates(self):
+ """ Prints available updates and types """
+ self.allow_interrupt(True);
+ self.percentage(None)
+
for package in pisi.api.list_upgradable():
pkg = self.installdb.get_package(package)
- version = self.get_package_version(pkg)
+ version = self.__get_package_version(pkg)
id = self.get_package_id(pkg.name, version, self.arch, "")
-
+
# Internal FIXME: PiSi must provide this information as a single API call :(
updates = [i for i in self.packagedb.get_package(package).history if pisi.version.Version(i.release) > pisi.version.Version(pkg.release)]
if pisi.util.any(lambda i:i.type == "security", updates):
@@ -131,8 +144,8 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.package(id, INFO_NORMAL, pkg.summary)
def refresh_cache(self):
+ """ Updates repository indexes """
self.allow_interrupt(False);
-
self.percentage(0)
slice = (100/len(pisi.api.list_repos()))/2
@@ -144,3 +157,25 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.percentage(percentage)
self.percentage(100)
+
+ def get_requires(self, package_id):
+ """ Prints a list of requires for a given package """
+ self.allow_interrupt(True)
+ self.percentage(None)
+
+ package = self.get_package_from_id(package_id)[0]
+
+ # FIXME: Handle packages which is not installed from repository
+ for pkg in self.packagedb.get_rev_deps(package):
+ self.__get_package(pkg[0])
+
+ def get_depends(self, package_id):
+ """ Prints a list of depends for a given package """
+ self.allow_interrupt(True)
+ self.percentage(None)
+
+ package = self.get_package_from_id(package_id)[0]
+
+ for pkg in self.packagedb.get_package(package).runtimeDependencies():
+ # Internal FIXME: PiSi API has really inconsistent for return types and arguments!
+ self.__get_package(pkg.package)
diff --git a/backends/pisi/helpers/remove.py b/backends/pisi/helpers/remove.py
index 7e91fe1..af5010f 100644
--- a/backends/pisi/helpers/remove.py
+++ b/backends/pisi/helpers/remove.py
@@ -13,7 +13,7 @@
import sys
import pisiBackend
-backend = pisiBackend.PackageKitPisiBackend(sys.argv[2:])
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
backend.remove(sys.argv[1], sys.argv[2])
sys.exit()
diff --git a/backends/pisi/helpers/resolve.py b/backends/pisi/helpers/resolve.py
index 1627bfa..ad630a6 100644
--- a/backends/pisi/helpers/resolve.py
+++ b/backends/pisi/helpers/resolve.py
@@ -13,7 +13,7 @@
import sys
import pisiBackend
-backend = pisiBackend.PackageKitPisiBackend(sys.argv[2:])
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
backend.resolve(sys.argv[1], sys.argv[2])
sys.exit()
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 3d7dc10..748a794 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -26,29 +26,33 @@
#include <pk-backend.h>
/**
- * backend_resolve:
+ * backend_get_depends:
*/
static void
-backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
+backend_get_depends (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
+ pk_backend_spawn_helper (backend, "get-depends.py", package_id, NULL);
}
/**
- * backend_remove_package:
+ * backend_get_requires:
*/
static void
-backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
+backend_get_requires (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
- const gchar *deps;
- if (allow_deps == TRUE) {
- deps = "yes";
- } else {
- deps = "no";
- }
- pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
+ pk_backend_spawn_helper (backend, "get-requires.py", package_id, NULL);
+}
+
+/**
+ * backend_get_updates:
+ */
+static void
+backend_get_updates (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "get-updates.py", NULL);
}
/**
@@ -58,7 +62,6 @@ static void
backend_install_package (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
-
/* check network state */
if (pk_backend_network_is_online (backend) == FALSE) {
pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot install when offline");
@@ -69,58 +72,73 @@ backend_install_package (PkBackend *backend, const gchar *package_id)
}
/**
- * backend_update_package:
+ * backend_refresh_cache:
*/
static void
-backend_update_package (PkBackend *backend, const gchar *package_id)
+backend_refresh_cache (PkBackend *backend, gboolean force)
{
g_return_if_fail (backend != NULL);
/* check network state */
if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
pk_backend_finished (backend);
return;
}
- pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
+ pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
}
/**
- * backend_get_repo_list:
+ * backend_remove_package:
*/
static void
-backend_get_repo_list (PkBackend *backend)
+backend_remove_package (PkBackend *backend, const gchar *package_id, gboolean allow_deps)
{
g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-repo-list.py", NULL);
+ const gchar *deps;
+ if (allow_deps == TRUE) {
+ deps = "yes";
+ } else {
+ deps = "no";
+ }
+ pk_backend_spawn_helper (backend, "remove.py", deps, package_id, NULL);
}
/**
- * backend_refresh_cache:
+ * backend_resolve:
*/
static void
-backend_refresh_cache (PkBackend *backend, gboolean force)
+backend_resolve (PkBackend *backend, const gchar *filter, const gchar *package_id)
+{
+ g_return_if_fail (backend != NULL);
+ pk_backend_spawn_helper (backend, "resolve.py", filter, package_id, NULL);
+}
+
+/**
+ * backend_update_package:
+ */
+static void
+backend_update_package (PkBackend *backend, const gchar *package_id)
{
g_return_if_fail (backend != NULL);
/* check network state */
if (pk_backend_network_is_online (backend) == FALSE) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
+ pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot update when offline");
pk_backend_finished (backend);
return;
}
- pk_backend_spawn_helper (backend, "refresh-cache.py", NULL);
+ pk_backend_spawn_helper (backend, "update.py", package_id, NULL);
}
/**
- * backend_get_updates:
+ * backend_get_repo_list:
*/
static void
-backend_get_updates (PkBackend *backend)
+backend_get_repo_list (PkBackend *backend)
{
g_return_if_fail (backend != NULL);
- pk_backend_spawn_helper (backend, "get-updates.py", NULL);
+ pk_backend_spawn_helper (backend, "get-repo-list.py", NULL);
}
-
PK_BACKEND_OPTIONS (
"PiSi", /* description */
"0.0.1", /* version */
@@ -130,9 +148,9 @@ PK_BACKEND_OPTIONS (
NULL, /* get_groups */
NULL, /* get_filters */
NULL, /* cancel */
- NULL, /* get_depends */
+ backend_get_depends, /* get_depends */
NULL, /* get_description */
- NULL, /* get_requires */
+ backend_get_requires, /* get_requires */
NULL, /* get_update_detail */
backend_get_updates, /* get_updates */
backend_install_package, /* install_package */
commit ef7690c7070d0ef3c92aba5f6e323f7d775bd9ed
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Wed Oct 24 00:53:49 2007 +0300
Add resolve support to "pkcon get depends/requires"
diff --git a/client/pk-console.c b/client/pk-console.c
index 8805194..79d869e 100644
--- a/client/pk-console.c
+++ b/client/pk-console.c
@@ -475,6 +475,42 @@ pk_console_update_package (PkClient *client, const gchar *package)
}
/**
+ * pk_console_get_requires:
+ **/
+static gboolean
+pk_console_get_requires(PkClient *client, const gchar *package)
+{
+ gboolean ret;
+ gchar *package_id;
+ package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
+ if (package_id == NULL) {
+ g_print ("Could not find a package with that name to get requires\n");
+ return FALSE;
+ }
+ ret = pk_client_get_requires (client, package_id);
+ g_free (package_id);
+ return ret;
+}
+
+/**
+ * pk_console_get_depends:
+ **/
+static gboolean
+pk_console_get_depends(PkClient *client, const gchar *package)
+{
+ gboolean ret;
+ gchar *package_id;
+ package_id = pk_console_perhaps_resolve (client, PK_FILTER_ENUM_INSTALLED, package);
+ if (package_id == NULL) {
+ g_print ("Could not find a package with that name to get depends\n");
+ return FALSE;
+ }
+ ret = pk_client_get_depends (client, package_id);
+ g_free (package_id);
+ return ret;
+}
+
+/**
* pk_console_process_commands:
**/
static gboolean
@@ -580,7 +616,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
g_set_error (error, 0, 0, "you need to specify a search term");
return FALSE;
} else {
- wait = pk_client_get_depends (client, details);
+ wait = pk_console_get_depends (client, details);
}
} else if (strcmp (value, "updatedetail") == 0) {
if (details == NULL) {
@@ -594,7 +630,7 @@ pk_console_process_commands (PkClient *client, int argc, char *argv[], gboolean
g_set_error (error, 0, 0, "you need to specify a search term");
return FALSE;
} else {
- wait = pk_client_get_requires (client, details);
+ wait = pk_console_get_requires (client, details);
}
} else if (strcmp (value, "description") == 0) {
if (details == NULL) {
commit d59edf7818aed5ea48d03e8a18e2af66229dd045
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 23 22:18:13 2007 +0100
remove an unused prototype
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 57b3002..f9c5cb0 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -201,10 +201,6 @@ gboolean pk_engine_get_progress (PkEngine *engine,
guint *elapsed,
guint *remaining,
GError **error);
-gboolean pk_engine_get_sub_percentage (PkEngine *engine,
- const gchar *tid,
- guint *percentage,
- GError **error);
gboolean pk_engine_get_package (PkEngine *engine,
const gchar *tid,
gchar **package,
commit 02fddf92b1f1f9ccb1e7dcab260cf947ad79a9fe
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 23 22:14:58 2007 +0100
tweak some of the time defines
diff --git a/src/pk-time.c b/src/pk-time.c
index 0773754..990f352 100644
--- a/src/pk-time.c
+++ b/src/pk-time.c
@@ -48,9 +48,9 @@ static void pk_time_init (PkTime *time);
static void pk_time_finalize (GObject *object);
#define PK_TIME_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_TIME, PkTimePrivate))
-#define PK_TIME_AVERAGE_MIN 2
-#define PK_TIME_AVERAGE_MAX 5
-#define PK_TIME_VALUE_MIN 2
+#define PK_TIME_AVERAGE_MIN 4
+#define PK_TIME_AVERAGE_MAX 10
+#define PK_TIME_VALUE_MIN 5
#define PK_TIME_VALUE_MAX 60*60
struct PkTimePrivate
More information about the PackageKit
mailing list