[packagekit] packagekit: Branch 'master'

Richard Hughes hughsient at kemper.freedesktop.org
Sat Oct 13 16:50:09 PDT 2007


 TODO                                    |    1 
 backends/alpm/pk-backend-alpm.c         |    5 ++-
 backends/apt/pk-backend-apt.cpp         |    5 ++-
 backends/box/pk-backend-box.c           |    5 ++-
 backends/conary/pk-backend-conary.c     |    5 ++-
 backends/dummy/pk-backend-dummy.c       |   53 +++++++++++++++++++++++++++++++-
 backends/test/pk-backend-test-fail.c    |    5 ++-
 backends/test/pk-backend-test-nop.c     |    5 ++-
 backends/test/pk-backend-test-spawn.c   |    5 ++-
 backends/test/pk-backend-test-succeed.c |   35 ++++++++++++++++++++-
 backends/test/pk-backend-test-thread.c  |    5 ++-
 backends/yum/pk-backend-yum.c           |    5 ++-
 src/pk-backend.c                        |   15 +++++++++
 src/pk-backend.h                        |   15 +++++++--
 src/pk-engine.c                         |    8 ++--
 src/pk-engine.h                         |    4 +-
 src/pk-interface.xml                    |    6 +--
 17 files changed, 159 insertions(+), 23 deletions(-)

New commits:
commit 78db09e76438ad761c6ab8efab51f8a5ca6b9db7
Author: Richard Hughes <richard at hughsie.com>
Date:   Sun Oct 14 00:47:50 2007 +0100

    Add stubs in the backends for the new repo stuff

diff --git a/TODO b/TODO
index 6ae5561..d8f3ef7 100644
--- a/TODO
+++ b/TODO
@@ -6,7 +6,6 @@ TimeRemaining()
 *** the backends will have repo controls ***
 Add the callback and methods in PkBackend
 Add details to the help file
-Add stubs in the backends
 Add methods and signals to the client library
 
 *** Prepare download to refresh system ***
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 2d2b721..863bf52 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -758,6 +758,9 @@ PK_BACKEND_OPTIONS (
 	NULL,						/* search_group */
 	backend_search_name,				/* search_name */
 	NULL,						/* update_package */
-	NULL						/* update_system */
+	NULL,						/* update_system */
+	NULL,						/* get_repo_list */
+	NULL,						/* repo_enable */
+	NULL						/* repo_set_data */
 );
 
diff --git a/backends/apt/pk-backend-apt.cpp b/backends/apt/pk-backend-apt.cpp
index 2b72d65..985fea8 100644
--- a/backends/apt/pk-backend-apt.cpp
+++ b/backends/apt/pk-backend-apt.cpp
@@ -152,6 +152,9 @@ extern "C" PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	sqlite_search_name,			/* search_name */
 	NULL,					/* update_package */
-	NULL					/* update_system */
+	NULL,					/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 4314db6..61847d9 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -518,6 +518,9 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	NULL					/* update_system */
+	NULL,					/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 90c6623..a31df43 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -222,6 +222,9 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	backend_update_system			/* update_system */
+	backend_update_system,			/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 5efd320..26078d4 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -377,6 +377,54 @@ backend_update_system (PkBackend *backend)
 	g_timeout_add (1000, backend_update_system_timeout, backend);
 }
 
+/**
+ * backend_get_repo_list:
+ */
+static void
+backend_get_repo_list (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	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);
+	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);
+	pk_backend_finished (backend);
+}
+
+/**
+ * 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_warning ("REPO ENABLE '%s'", rid);
+	} else {
+		pk_warning ("REPO DISABLE '%s'", rid);
+	}
+	pk_backend_finished (backend);
+}
+
+/**
+ * backend_repo_set_data:
+ */
+static void
+backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value)
+{
+	g_return_if_fail (backend != NULL);
+	pk_warning ("REPO '%s' PARAMETER '%s' TO '%s'", rid, parameter, value);
+	pk_backend_finished (backend);
+}
+
 PK_BACKEND_OPTIONS (
 	"Dummy",				/* description */
 	"0.0.1",				/* version */
@@ -402,6 +450,9 @@ PK_BACKEND_OPTIONS (
 	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	backend_update_system			/* update_system */
+	backend_update_system,			/* update_system */
+	backend_get_repo_list,			/* get_repo_list */
+	backend_repo_enable,			/* repo_enable */
+	backend_repo_set_data			/* repo_set_data */
 );
 
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index 1ce3e10..8f03df2 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -285,6 +285,9 @@ PK_BACKEND_OPTIONS (
 	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	backend_update_system			/* update_system */
+	backend_update_system,			/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index 8266b8f..52e5b83 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -48,6 +48,9 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	NULL,					/* search_name */
 	NULL,					/* update_package */
-	NULL					/* update_system */
+	NULL,					/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 84f2291..032c46b 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -61,6 +61,9 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	backend_search_name,			/* search_name */
 	NULL,					/* update_package */
-	NULL					/* update_system */
+	NULL,					/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index 7d179d0..fa87fa3 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -264,6 +264,36 @@ backend_update_system (PkBackend *backend)
 	pk_backend_finished (backend);
 }
 
+/**
+ * backend_get_repo_list:
+ */
+static void
+backend_get_repo_list (PkBackend *backend)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_finished (backend);
+}
+
+/**
+ * backend_repo_enable:
+ */
+static void
+backend_repo_enable (PkBackend *backend, const gchar *rid, gboolean enabled)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_finished (backend);
+}
+
+/**
+ * backend_repo_set_data:
+ */
+static void
+backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value)
+{
+	g_return_if_fail (backend != NULL);
+	pk_backend_finished (backend);
+}
+
 PK_BACKEND_OPTIONS (
 	"Test Succeed",				/* description */
 	"0.0.1",				/* version */
@@ -289,6 +319,9 @@ PK_BACKEND_OPTIONS (
 	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	backend_update_system			/* update_system */
+	backend_update_system,			/* update_system */
+	backend_get_repo_list,			/* get_repo_list */
+	backend_repo_enable,			/* repo_enable */
+	backend_repo_set_data			/* repo_set_data */
 );
 
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index 47810dc..aec1b56 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -108,6 +108,9 @@ PK_BACKEND_OPTIONS (
 	backend_search_group,			/* search_group */
 	backend_search_name,			/* search_name */
 	NULL,					/* update_package */
-	NULL					/* update_system */
+	NULL,					/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index de183b0..71cba29 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -252,6 +252,9 @@ PK_BACKEND_OPTIONS (
 	NULL,					/* search_group */
 	backend_search_name,			/* search_name */
 	backend_update_package,			/* update_package */
-	backend_update_system			/* update_system */
+	backend_update_system,			/* update_system */
+	NULL,					/* get_repo_list */
+	NULL,					/* repo_enable */
+	NULL					/* repo_set_data */
 );
 
diff --git a/src/pk-backend.c b/src/pk-backend.c
index ce9e323..7ab4f86 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -942,6 +942,21 @@ pk_backend_finished (PkBackend *backend)
 }
 
 /**
+ * pk_backend_repo_detail:
+ **/
+gboolean
+pk_backend_repo_detail (PkBackend *backend, const gchar *repo_id,
+			const gchar *description, gboolean enabled)
+{
+	g_return_val_if_fail (backend != NULL, FALSE);
+	g_return_val_if_fail (PK_IS_BACKEND (backend), FALSE);
+
+	pk_debug ("emit repo-detail %s, %s, %i", repo_id, description, enabled);
+//	g_signal_emit (backend, signals [PK_BACKEND_REPO_DETAIL], 0, repo_id, description, enabled);
+	return TRUE;
+}
+
+/**
  * pk_backend_no_percentage_updates:
  **/
 gboolean
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 457c464..8a51269 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -46,6 +46,10 @@ gboolean	 pk_backend_package			(PkBackend	*backend,
 							 PkInfoEnum	 info,
 							 const gchar	*package_id,
 							 const gchar	*summary);
+gboolean	 pk_backend_repo_detail			(PkBackend	*backend,
+							 const gchar	*repo_id,
+							 const gchar	*description,
+							 gboolean	 enabled);
 gboolean	 pk_backend_update_detail		(PkBackend	*backend,
 							 const gchar	*package_id,
 							 const gchar	*updates,
@@ -123,6 +127,10 @@ struct _PkBackendDesc {
 	void		(*search_name)		(PkBackend *backend, const gchar *filter, const gchar *search);
 	void		(*update_package)	(PkBackend *backend, const gchar *package_id);
 	void		(*update_system)	(PkBackend *backend);
+	/* repo stuff */
+	void		(*get_repo_list)	(PkBackend *backend);
+	void		(*repo_enable)		(PkBackend *backend, const gchar *rid, gboolean enabled);
+	void		(*repo_set_data)	(PkBackend *backend, const gchar *rid, const gchar *parameter, const gchar *value);
 	gpointer	padding[12];
 };
 
@@ -130,8 +138,8 @@ struct _PkBackendDesc {
 			   get_groups, get_filters, cancel, get_depends, get_description, \
 			   get_requires, get_update_detail, get_updates, install_package, install_file, \
 			   refresh_cache, remove_package, resolve, rollback, search_details, \
-			   search_file, search_group, search_name, \
-			   update_package, update_system) \
+			   search_file, search_group, search_name, update_package, update_system, \
+			   get_repo_list, repo_enable, repo_set_data) \
 	G_MODULE_EXPORT const PkBackendDesc pk_backend_desc = { \
 		description, \
 		version, \
@@ -158,6 +166,9 @@ struct _PkBackendDesc {
 		search_name, \
 		update_package, \
 		update_system, \
+		get_repo_list, \
+		repo_enable, \
+		repo_set_data, \
 		{0} \
 	}
 
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 30f8bac..9bdc835 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -1766,7 +1766,7 @@ pk_engine_get_repo_list (PkEngine *engine, const gchar *tid, GError **error)
  * pk_engine_repo_enable:
  **/
 void
-pk_engine_repo_enable (PkEngine	*engine, const gchar *rid, gboolean enabled,
+pk_engine_repo_enable (PkEngine	*engine, const gchar *repo_id, gboolean enabled,
 		       DBusGMethodInvocation *context, GError **old_error)
 {
 	gboolean ret;
@@ -1792,7 +1792,7 @@ pk_engine_repo_enable (PkEngine	*engine, const gchar *rid, gboolean enabled,
 		return;
 	}
 
-	//ret = pk_backend_repo_enable (item->backend, rid, enabled);
+	//ret = pk_backend_repo_enable (item->backend, repo_id, enabled);
 	ret = FALSE;
 	if (ret == FALSE) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
@@ -1807,7 +1807,7 @@ pk_engine_repo_enable (PkEngine	*engine, const gchar *rid, gboolean enabled,
  * pk_engine_repo_set_data:
  **/
 void
-pk_engine_repo_set_data (PkEngine *engine, const gchar *rid,
+pk_engine_repo_set_data (PkEngine *engine, const gchar *repo_id,
 			 const gchar *parameter, const gchar *value,
 			 DBusGMethodInvocation *context, GError **old_error)
 {
@@ -1834,7 +1834,7 @@ pk_engine_repo_set_data (PkEngine *engine, const gchar *rid,
 		return;
 	}
 
-	//ret = pk_backend_repo_set_data (item->backend, rid, parameter, value);
+	//ret = pk_backend_repo_set_data (item->backend, repo_id, parameter, value);
 	ret = FALSE;
 	if (ret == FALSE) {
 		error = g_error_new (PK_ENGINE_ERROR, PK_ENGINE_ERROR_NOT_SUPPORTED,
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 15d3507..b235a39 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -210,12 +210,12 @@ gboolean	 pk_engine_get_repo_list		(PkEngine	*engine,
 							 const gchar	*tid,
 							 GError		**error);
 void		 pk_engine_repo_enable			(PkEngine	*engine,
-							 const gchar	*rid,
+							 const gchar	*repo_id,
 							 gboolean	 enabled,
 							 DBusGMethodInvocation *context,
 							 GError		**error);
 void		 pk_engine_repo_set_data		(PkEngine	*engine,
-							 const gchar	*rid,
+							 const gchar	*repo_id,
 							 const gchar	*parameter,
 							 const gchar	*value,
 							 DBusGMethodInvocation *context,
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index f8fa632..9782057 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -167,17 +167,17 @@
       <arg type="s" name="tid" direction="in"/>
     </method>
     <method name="RepoEnable">
-      <arg type="s" name="rid" direction="in"/>
+      <arg type="s" name="repo_id" direction="in"/>
       <arg type="b" name="enabled" direction="in"/>
     </method>
     <method name="RepoSetData">
-      <arg type="s" name="rid" direction="in"/>
+      <arg type="s" name="repo_id" direction="in"/>
       <arg type="s" name="parameter" direction="in"/>
       <arg type="s" name="value" direction="in"/>
     </method>
     <signal name="RepoDetail">
       <arg type="s" name="tid" direction="out"/>
-      <arg type="s" name="rid" direction="out"/>
+      <arg type="s" name="repo_id" direction="out"/>
       <arg type="s" name="description" direction="out"/>
       <arg type="b" name="enabled" direction="out"/>
     </signal>



More information about the PackageKit mailing list