[packagekit] packagekit: Branch 'master' - 4 commits

Richard Hughes hughsient at kemper.freedesktop.org
Fri Nov 2 16:31:56 PDT 2007


 Makefile.am                        |    4 -
 PackageKit.conf.in                 |   33 ----------
 backends/smart/helpers/Makefile.am |   12 +++
 configure.ac                       |    2 
 libpackagekit/pk-common.c          |  116 +++++++++++++++++++++++++++++++++++++
 libpackagekit/pk-common.h          |    2 
 libpackagekit/pk-enum.h            |    2 
 org.freedesktop.PackageKit.conf.in |   33 ++++++++++
 src/pk-backend.c                   |    6 -
 src/pk-backend.h                   |    3 
 10 files changed, 172 insertions(+), 41 deletions(-)

New commits:
commit 868da532a6db79dca401d254d01a2f35148aae62
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 2 23:31:13 2007 +0000

    remove the horrible g_strjoinv (

diff --git a/src/pk-backend.c b/src/pk-backend.c
index 87a3654..8313622 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -606,15 +606,15 @@ pk_backend_spawn_kill (PkBackend *backend)
  * pk_backend_spawn_helper:
  **/
 gboolean
-pk_backend_spawn_helper (PkBackend *backend, const gchar *script, ...)
+pk_backend_spawn_helper (PkBackend *backend, const gchar *script, const gchar *first_element, ...)
 {
 	gboolean ret;
 	va_list args;
 	gchar *arguments;
 
 	/* get the argument list */
-	va_start (args, script);
-	arguments = g_strjoinv (" ", (gchar **)(void *)args);
+	va_start (args, first_element);
+	arguments = pk_strbuild_va (first_element, &args);
 	va_end (args);
 
 	ret = pk_backend_spawn_helper_internal (backend, script, arguments);
diff --git a/src/pk-backend.h b/src/pk-backend.h
index d10f089..76dd496 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -84,7 +84,8 @@ gboolean         pk_backend_repo_signature_required     (PkBackend      *backend
 							 const gchar    *key_timestamp,
 							 PkSigTypeEnum   type);
 gboolean	 pk_backend_spawn_helper		(PkBackend	*backend,
-							 const gchar	*script, ...);
+							 const gchar	*script,
+							 const gchar	*first_element, ...);
 gboolean	 pk_backend_change_transaction_data	(PkBackend	*backend,
 							 const gchar	*data);
 gboolean	 pk_backend_spawn_kill			(PkBackend	*backend);
commit ba025940a1a967d630cf37f113a8d8643b5ee770
Author: Richard Hughes <richard at hughsie.com>
Date:   Fri Nov 2 23:22:22 2007 +0000

    add a new method pk_strbuild_va to append a va_list in a sane way

diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index dc076cd..9b1061c 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -390,12 +390,68 @@ pk_strpad_extra (const gchar *data, guint length, guint *extra)
 	return text;
 }
 
+/**
+ * pk_strbuild_va:
+ **/
+gchar *
+pk_strbuild_va (const gchar *first_element, va_list *args)
+{
+	const gchar *element;
+	GString *string;
+
+	/* shortcut */
+	if (pk_strzero (first_element) == TRUE) {
+		return NULL;
+	}
+
+	/* set the first entry and a space */
+	string = g_string_new (first_element);
+	g_string_append_c (string, ' ');
+
+	/* do all elements */
+	while (TRUE) {
+		element = va_arg (*args, const gchar *);
+
+		/* are we at the end? Is this safe? */
+		if (element == NULL) {
+			break;
+		}
+
+		/* Ignore empty elements */
+		if (*element == '\0') {
+			continue;
+		}
+
+		g_string_append (string, element);
+		g_string_append_c (string, ' ');
+	}
+
+	/* remove last char */
+	g_string_set_size (string, string->len - 1);
+
+	return g_string_free (string, FALSE);
+}
+
 /***************************************************************************
  ***                          MAKE CHECK TESTS                           ***
  ***************************************************************************/
 #ifdef PK_BUILD_TESTS
 #include <libselftest.h>
 
+static gchar *
+pk_strbuild_test (const gchar *first_element, ...)
+{
+	va_list args;
+	gchar *text;
+
+	/* get the argument list */
+	va_start (args, first_element);
+	text = pk_strbuild_va (first_element, &args);
+	va_end (args);
+
+	return text;
+}
+
 void
 libst_common (LibSelfTest *test)
 {
@@ -410,6 +466,66 @@ libst_common (LibSelfTest *test)
 	}
 
 	/************************************************************
+	 ****************        build var args        **************
+	 ************************************************************/
+	libst_title (test, "build_va NULL");
+	text_safe = pk_strbuild_test (NULL);
+	if (text_safe == NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, NULL);
+	}
+
+	/************************************************************/
+	libst_title (test, "build_va blank");
+	text_safe = pk_strbuild_test ("", NULL);
+	if (text_safe == NULL) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "incorrect ret '%s'", text_safe);
+	}
+
+	/************************************************************/
+	libst_title (test, "build_va single");
+	text_safe = pk_strbuild_test ("richard", NULL);
+	if (pk_strequal (text_safe, "richard") == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "incorrect ret '%s'", text_safe);
+	}
+	g_free (text_safe);
+
+	/************************************************************/
+	libst_title (test, "build_va double");
+	text_safe = pk_strbuild_test ("richard", "hughes", NULL);
+	if (pk_strequal (text_safe, "richard hughes") == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "incorrect ret '%s'", text_safe);
+	}
+	g_free (text_safe);
+
+	/************************************************************/
+	libst_title (test, "build_va double with space");
+	text_safe = pk_strbuild_test ("richard", "", "hughes", NULL);
+	if (pk_strequal (text_safe, "richard hughes") == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "incorrect ret '%s'", text_safe);
+	}
+	g_free (text_safe);
+
+	/************************************************************/
+	libst_title (test, "build_va triple");
+	text_safe = pk_strbuild_test ("richard", "phillip", "hughes", NULL);
+	if (pk_strequal (text_safe, "richard phillip hughes") == TRUE) {
+		libst_success (test, NULL);
+	} else {
+		libst_failed (test, "incorrect ret '%s'", text_safe);
+	}
+	g_free (text_safe);
+
+	/************************************************************
 	 ****************        validate text         **************
 	 ************************************************************/
 	libst_title (test, "validate correct char 1");
diff --git a/libpackagekit/pk-common.h b/libpackagekit/pk-common.h
index 36e9d66..098c096 100644
--- a/libpackagekit/pk-common.h
+++ b/libpackagekit/pk-common.h
@@ -44,6 +44,8 @@ gchar		*pk_strpad_extra			(const gchar	*data,
 gchar		*pk_strsafe				(const gchar	*text);
 gchar		**pk_strsplit				(const gchar	*id,
 							 guint		 parts);
+gchar		*pk_strbuild_va				(const gchar	*first_element,
+							 va_list	*args);
 gboolean	 pk_strcmp_sections			(const gchar	*id1,
 							 const gchar	*id2,
 							 guint		 parts,
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index f14ffbc..f0fec67 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -59,7 +59,7 @@ typedef enum {
 	PK_ROLE_ENUM_UNKNOWN
 } PkRoleEnum;
 
-/* what we are actually doing */
+/* if you add to this, make sure you add filenames in pk-watch */
 typedef enum {
 	PK_STATUS_ENUM_SETUP,
 	PK_STATUS_ENUM_WAIT,
commit 3a5ed6ed48cf4a83aa63684c6a41ece24eacaa69
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Fri Nov 2 15:39:52 2007 -0400

    smart: Add helpers to Makefile.am, so they actually get installed.

diff --git a/backends/smart/helpers/Makefile.am b/backends/smart/helpers/Makefile.am
index fceff8a..6d1d835 100644
--- a/backends/smart/helpers/Makefile.am
+++ b/backends/smart/helpers/Makefile.am
@@ -4,9 +4,21 @@ helperdir = $(datadir)/PackageKit/helpers/smart
 NULL =
 
 dist_helper_DATA = 			\
+	get-depends.py			\
+	get-description.py		\
+	get-files.py			\
+	get-repo-list.py		\
+	get-updates.py			\
+	install-file.py			\
+	install.py			\
+	refresh-cache.py		\
 	remove.py			\
+	repo-enable.py			\
 	resolve.py			\
+	search-name.py			\
 	smartBackend.py			\
+	update.py			\
+	update-system.py		\
 	$(NULL)
 
 install-data-hook:
commit 2299ad6249fe80b62bd2d5908c6b46b3966f2b2a
Author: Robin Norwood <rnorwood at redhat.com>
Date:   Fri Nov 2 14:59:46 2007 -0400

    Move /etc/dbus-1/system.d/PackageKit.conf to /etc/dbus-1/system.d/org.freedesktop.PackageKit.conf based upon feedback from David Zeuthen.

diff --git a/Makefile.am b/Makefile.am
index 74331df..6ca218d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = packagekit.pc
 
 dbusdir = ${SYSCONFDIR}/dbus-1/system.d
-dist_dbus_DATA = PackageKit.conf
+dist_dbus_DATA = org.freedesktop.PackageKit.conf
 
 packagekitpythondir = ${PYTHON_PACKAGE_DIR}
 packagekitpython_PYTHON =				\
@@ -32,7 +32,7 @@ packagekitpython_PYTHON =				\
 	
 
 EXTRA_DIST =						\
-	PackageKit.conf.in				\
+	org.freedesktop.PackageKit.conf.in		\
 	packagekit.pc.in				\
 	COPYING						\
 	MAINTAINERS					\
diff --git a/PackageKit.conf.in b/PackageKit.conf.in
deleted file mode 100644
index 708f2eb..0000000
--- a/PackageKit.conf.in
+++ /dev/null
@@ -1,33 +0,0 @@
-<!DOCTYPE busconfig PUBLIC
- "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
- "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
-
-  <!-- This configuration file specifies the required security policies
-       for the PackageKit to work. -->
-
-  <!-- Only root or user @PACKAGEKIT_USER@ can own the PackageKit service -->
-  <policy user="@PACKAGEKIT_USER@">
-    <allow own="org.freedesktop.PackageKit"/>
-  </policy>
-  <policy user="root">
-    <allow own="org.freedesktop.PackageKit"/>
-  </policy>
-
-  <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
-  <policy context="default">
-    <deny send_interface="org.freedesktop.PackageKit"/>
-  </policy>
-
-  <!-- This will not work if pam_console support is not enabled -->
-  <policy at_console="true">
-    <allow send_interface="org.freedesktop.PackageKit"/>
-  </policy>
-
-  <!-- You can change this to a more suitable user, or make per-group -->
-  <policy user="0">
-    <allow send_interface="org.freedesktop.PackageKit"/>
-  </policy>
-
-</busconfig>
-
diff --git a/configure.ac b/configure.ac
index 769c708..6098fd9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -439,7 +439,7 @@ libpackagekit/Makefile
 policy/Makefile
 src/Makefile
 client/Makefile
-PackageKit.conf
+org.freedesktop.PackageKit.conf
 ])
 
 dnl ==========================================================================
diff --git a/org.freedesktop.PackageKit.conf.in b/org.freedesktop.PackageKit.conf.in
new file mode 100644
index 0000000..708f2eb
--- /dev/null
+++ b/org.freedesktop.PackageKit.conf.in
@@ -0,0 +1,33 @@
+<!DOCTYPE busconfig PUBLIC
+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+
+  <!-- This configuration file specifies the required security policies
+       for the PackageKit to work. -->
+
+  <!-- Only root or user @PACKAGEKIT_USER@ can own the PackageKit service -->
+  <policy user="@PACKAGEKIT_USER@">
+    <allow own="org.freedesktop.PackageKit"/>
+  </policy>
+  <policy user="root">
+    <allow own="org.freedesktop.PackageKit"/>
+  </policy>
+
+  <!-- Allow anyone to invoke methods on the Manager and Device interfaces -->
+  <policy context="default">
+    <deny send_interface="org.freedesktop.PackageKit"/>
+  </policy>
+
+  <!-- This will not work if pam_console support is not enabled -->
+  <policy at_console="true">
+    <allow send_interface="org.freedesktop.PackageKit"/>
+  </policy>
+
+  <!-- You can change this to a more suitable user, or make per-group -->
+  <policy user="0">
+    <allow send_interface="org.freedesktop.PackageKit"/>
+  </policy>
+
+</busconfig>
+



More information about the PackageKit mailing list