[packagekit] packagekit: Branch 'master' - 19 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Sun Nov 4 15:30:26 PST 2007
.gitignore | 2
Makefile.am | 22 +++++
acinclude.m4 | 33 ++++++++
client/Makefile.am | 7 +
configure.ac | 57 ++++++++++----
data/tests/Makefile.am | 1
data/tests/pk-spawn-test-profiling.sh | 18 ++++
libpackagekit/.gitignore | 3
libpackagekit/Makefile.am | 50 +++++++-----
src/.gitignore | 3
src/Makefile.am | 63 ++++++++-------
src/pk-backend.c | 124 ++++++++++++++++++++++++++++++-
src/pk-engine.c | 74 +++++++++++++++++-
src/pk-main.c | 6 +
src/pk-security-polkit.c | 135 +++++++++++++++++++++++++++++-----
src/pk-self-test.c | 6 +
src/pk-spawn-test.sh | 31 -------
src/pk-spawn.c | 12 +++
tools/create-coverage-report.sh | 2
19 files changed, 525 insertions(+), 124 deletions(-)
New commits:
commit ba01ccc139c6eec521dbda6cbfa5ec714e17899f
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 23:28:49 2007 +0000
add some PkBackend unit tests
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 920f519..8ee1b6a 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -148,7 +148,7 @@ pk_backend_load (PkBackend *backend, const gchar *backend_name)
g_return_val_if_fail (backend_name != NULL, FALSE);
if (backend->priv->handle != NULL) {
- pk_warning ("pk_backend_load called multiple times. This is bad");
+ pk_warning ("pk_backend_load called multiple times");
return FALSE;
}
@@ -194,11 +194,15 @@ pk_backend_load (PkBackend *backend, const gchar *backend_name)
gboolean
pk_backend_unload (PkBackend *backend)
{
+ g_return_val_if_fail (backend != NULL, FALSE);
if (backend->priv->handle == NULL) {
return FALSE;
}
g_module_close (backend->priv->handle);
+ backend->desc = NULL;
backend->priv->handle = NULL;
+ g_free (backend->priv->name);
+ backend->priv->name = NULL;
return TRUE;
}
@@ -209,7 +213,6 @@ const gchar *
pk_backend_get_name (PkBackend *backend)
{
g_return_val_if_fail (backend != NULL, NULL);
-
return backend->priv->name;
}
@@ -219,6 +222,7 @@ pk_backend_get_name (PkBackend *backend)
gboolean
pk_backend_thread_create (PkBackend *backend, PkBackendThreadFunc func, gpointer data)
{
+ g_return_val_if_fail (backend != NULL, FALSE);
return pk_thread_list_create (backend->priv->thread_list, (PkThreadFunc) func, backend, data);
}
@@ -1924,7 +1928,8 @@ void
libst_backend (LibSelfTest *test)
{
PkBackend *backend;
-// gboolean ret;
+ const gchar *text;
+ gboolean ret;
if (libst_start (test, "PkBackend", CLASS_AUTO) == FALSE) {
return;
@@ -1938,32 +1943,88 @@ libst_backend (LibSelfTest *test)
} else {
libst_failed (test, NULL);
}
-#if 0
+
+ /************************************************************/
+ libst_title (test, "get backend name");
+ text = pk_backend_get_name (backend);
+ if (text == NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "invalid name %s", text);
+ }
+
/************************************************************/
- libst_title (test, "check connection");
- if (backend->priv->connection != NULL) {
+ libst_title (test, "load an invalid backend");
+ ret = pk_backend_load (backend, "yum2");
+ if (ret == FALSE) {
libst_success (test, NULL);
} else {
libst_failed (test, NULL);
}
/************************************************************/
- libst_title (test, "check PolKit context");
- if (backend->priv->pk_context != NULL) {
+ libst_title (test, "try to load a valid backend");
+ ret = pk_backend_load (backend, "yum");
+ if (ret == TRUE) {
libst_success (test, NULL);
} else {
libst_failed (test, NULL);
}
/************************************************************/
- libst_title (test, "map valid role to action");
- action = pk_backend_role_to_action (backend, PK_ROLE_ENUM_UPDATE_PACKAGE);
- if (pk_strequal (action, "org.freedesktop.packagekit.update") == TRUE) {
- libst_success (test, NULL, error);
+ libst_title (test, "load an valid backend again");
+ ret = pk_backend_load (backend, "yum");
+ if (ret == FALSE) {
+ libst_success (test, NULL);
} else {
- libst_failed (test, "did not get correct action '%s'", action);
+ libst_failed (test, "loaded twice");
}
-#endif
+
+ /************************************************************/
+ libst_title (test, "check we are out of init");
+ if (backend->priv->during_initialize == FALSE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "not out of init");
+ }
+
+ /************************************************************/
+ libst_title (test, "get backend name");
+ text = pk_backend_get_name (backend);
+ if (pk_strequal(text, "yum") == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "invalid name %s", text);
+ }
+
+/*************/
+ /************************************************************/
+ libst_title (test, "unload an valid backend");
+ ret = pk_backend_unload (backend);
+ if (ret == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "failed to unload");
+ }
+
+ /************************************************************/
+ libst_title (test, "unload an valid backend again");
+ ret = pk_backend_unload (backend);
+ if (ret == FALSE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "unloaded twice");
+ }
+
+ /************************************************************/
+ libst_title (test, "get blank backend name");
+ text = pk_backend_get_name (backend);
+ if (text == NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "invalid name %s", text);
+ }
+
g_object_unref (backend);
libst_end (test);
commit 117159aaf4e8d495952912d7242ca8ca2e1a1b6e
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 23:28:27 2007 +0000
don't unref the PkEnumLists if we never loaded a backend
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 0cf93cf..427859f 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2544,6 +2544,9 @@ pk_engine_init (PkEngine *engine)
engine->priv = PK_ENGINE_GET_PRIVATE (engine);
engine->priv->timer = g_timer_new ();
engine->priv->backend = NULL;
+ engine->priv->actions = NULL;
+ engine->priv->groups = NULL;
+ engine->priv->filters = NULL;
/* we save a cache of the latest update lists sowe can do cached responses */
engine->priv->updates_cache = NULL;
@@ -2590,14 +2593,20 @@ pk_engine_finalize (GObject *object)
g_object_unref (engine->priv->inhibit);
g_object_unref (engine->priv->transaction_list);
g_object_unref (engine->priv->transaction_db);
- g_object_unref (engine->priv->actions);
- g_object_unref (engine->priv->groups);
- g_object_unref (engine->priv->filters);
g_object_unref (engine->priv->network);
g_object_unref (engine->priv->security);
+ /* optional gobjects */
+ if (engine->priv->actions != NULL) {
+ g_object_unref (engine->priv->actions);
+ }
+ if (engine->priv->groups != NULL) {
+ g_object_unref (engine->priv->groups);
+ }
+ if (engine->priv->filters != NULL) {
+ g_object_unref (engine->priv->filters);
+ }
if (engine->priv->updates_cache != NULL) {
- pk_debug ("unreffing updates cache");
g_object_unref (engine->priv->updates_cache);
}
commit 5b7754ae42de54c4ee59fde527a8d4b8f35a641f
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 22:54:05 2007 +0000
add PkBackend and PkEngine unit test stubs
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 8313622..920f519 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -202,6 +202,9 @@ pk_backend_unload (PkBackend *backend)
return TRUE;
}
+/**
+ * pk_backend_get_name:
+ **/
const gchar *
pk_backend_get_name (PkBackend *backend)
{
@@ -1911,3 +1914,59 @@ pk_backend_new (void)
return PK_BACKEND (backend);
}
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef PK_BUILD_TESTS
+#include <libselftest.h>
+
+void
+libst_backend (LibSelfTest *test)
+{
+ PkBackend *backend;
+// gboolean ret;
+
+ if (libst_start (test, "PkBackend", CLASS_AUTO) == FALSE) {
+ return;
+ }
+
+ /************************************************************/
+ libst_title (test, "get an instance");
+ backend = pk_backend_new ();
+ if (backend != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+#if 0
+ /************************************************************/
+ libst_title (test, "check connection");
+ if (backend->priv->connection != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "check PolKit context");
+ if (backend->priv->pk_context != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "map valid role to action");
+ action = pk_backend_role_to_action (backend, PK_ROLE_ENUM_UPDATE_PACKAGE);
+ if (pk_strequal (action, "org.freedesktop.packagekit.update") == TRUE) {
+ libst_success (test, NULL, error);
+ } else {
+ libst_failed (test, "did not get correct action '%s'", action);
+ }
+#endif
+ g_object_unref (backend);
+
+ libst_end (test);
+}
+#endif
+
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 5ad0c2f..0cf93cf 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2616,3 +2616,60 @@ pk_engine_new (void)
engine = g_object_new (PK_TYPE_ENGINE, NULL);
return PK_ENGINE (engine);
}
+
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef PK_BUILD_TESTS
+#include <libselftest.h>
+
+void
+libst_engine (LibSelfTest *test)
+{
+ PkEngine *engine;
+// gboolean ret;
+
+ if (libst_start (test, "PkEngine", CLASS_AUTO) == FALSE) {
+ return;
+ }
+
+ /************************************************************/
+ libst_title (test, "get an instance");
+ engine = pk_engine_new ();
+ if (engine != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+#if 0
+ /************************************************************/
+ libst_title (test, "check connection");
+ if (engine->priv->connection != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "check PolKit context");
+ if (engine->priv->pk_context != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "map valid role to action");
+ action = pk_engine_role_to_action (engine, PK_ROLE_ENUM_UPDATE_PACKAGE);
+ if (pk_strequal (action, "org.freedesktop.packagekit.update") == TRUE) {
+ libst_success (test, NULL, error);
+ } else {
+ libst_failed (test, "did not get correct action '%s'", action);
+ }
+#endif
+ g_object_unref (engine);
+
+ libst_end (test);
+}
+#endif
+
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 944e298..5adbac1 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -32,6 +32,8 @@ void libst_thread_list (LibSelfTest *test);
void libst_transaction_list (LibSelfTest *test);
void libst_security (LibSelfTest *test);
void libst_time (LibSelfTest *test);
+void libst_backend (LibSelfTest *test);
+void libst_engine (LibSelfTest *test);
int
main (int argc, char **argv)
@@ -46,6 +48,8 @@ main (int argc, char **argv)
pk_debug_init (TRUE);
/* tests go here */
+ libst_backend (&test);
+ libst_engine (&test);
libst_security (&test);
libst_time (&test);
libst_conf (&test);
commit f3319a0b28120dd8133c8be23678bab677165d96
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 22:44:16 2007 +0000
add soem unit tests for PkSecurity
diff --git a/src/pk-security-polkit.c b/src/pk-security-polkit.c
index 48b1377..15816ff 100644
--- a/src/pk-security-polkit.c
+++ b/src/pk-security-polkit.c
@@ -19,6 +19,10 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,6 +37,7 @@
#include <polkit-dbus/polkit-dbus.h>
#include <pk-enum.h>
+#include <pk-common.h>
#include "pk-debug.h"
#include "pk-security.h"
@@ -60,6 +65,10 @@ pk_security_can_do_action (PkSecurity *security, const gchar *dbus_sender, const
/* set action */
pk_action = polkit_action_new ();
+ if (pk_action == NULL) {
+ pk_warning ("error: polkit_action_new failed");
+ return POLKIT_RESULT_NO;
+ }
polkit_action_set_action_id (pk_action, action);
/* set caller */
@@ -68,9 +77,10 @@ pk_security_can_do_action (PkSecurity *security, const gchar *dbus_sender, const
pk_caller = polkit_caller_new_from_dbus_name (security->priv->connection, dbus_sender, &dbus_error);
if (pk_caller == NULL) {
if (dbus_error_is_set (&dbus_error)) {
- pk_error ("error: polkit_caller_new_from_dbus_name(): %s: %s\n",
- dbus_error.name, dbus_error.message);
+ pk_warning ("error: polkit_caller_new_from_dbus_name(): %s: %s\n",
+ dbus_error.name, dbus_error.message);
}
+ return POLKIT_RESULT_NO;
}
pk_result = polkit_context_can_caller_do_action (security->priv->pk_context, pk_action, pk_caller);
@@ -83,22 +93,16 @@ pk_security_can_do_action (PkSecurity *security, const gchar *dbus_sender, const
}
/**
- * pk_security_action_is_allowed:
- *
- * Only valid from an async caller, which is fine, as we won't prompt the user
- * when not async.
+ * pk_security_role_to_action:
**/
-gboolean
-pk_security_action_is_allowed (PkSecurity *security, const gchar *dbus_sender,
- PkRoleEnum role, gchar **error_detail)
+static const gchar *
+pk_security_role_to_action (PkSecurity *security, PkRoleEnum role)
{
- PolKitResult pk_result;
const gchar *policy = NULL;
- g_return_val_if_fail (security != NULL, FALSE);
- g_return_val_if_fail (PK_IS_SECURITY (security), FALSE);
+ g_return_val_if_fail (security != NULL, NULL);
+ g_return_val_if_fail (PK_IS_SECURITY (security), NULL);
- /* map the roles to policykit rules */
if (role == PK_ROLE_ENUM_UPDATE_PACKAGE ||
role == PK_ROLE_ENUM_UPDATE_SYSTEM) {
policy = "org.freedesktop.packagekit.update";
@@ -116,8 +120,29 @@ pk_security_action_is_allowed (PkSecurity *security, const gchar *dbus_sender,
} else if (role == PK_ROLE_ENUM_REFRESH_CACHE) {
policy = "org.freedesktop.packagekit.refresh-cache";
} else {
- pk_error ("policykit type required for '%s'", pk_role_enum_to_text (role));
+ pk_warning ("policykit type required for '%s'", pk_role_enum_to_text (role));
}
+ return policy;
+}
+
+/**
+ * pk_security_action_is_allowed:
+ *
+ * Only valid from an async caller, which is fine, as we won't prompt the user
+ * when not async.
+ **/
+gboolean
+pk_security_action_is_allowed (PkSecurity *security, const gchar *dbus_sender,
+ PkRoleEnum role, gchar **error_detail)
+{
+ PolKitResult pk_result;
+ const gchar *policy;
+
+ g_return_val_if_fail (security != NULL, FALSE);
+ g_return_val_if_fail (PK_IS_SECURITY (security), FALSE);
+
+ /* map the roles to policykit rules */
+ policy = pk_security_role_to_action (security, role);
/* get the dbus sender */
pk_result = pk_security_can_do_action (security, dbus_sender, policy);
@@ -180,7 +205,7 @@ pk_security_init (PkSecurity *security)
dbus_error_init (&dbus_error);
security->priv->connection = dbus_bus_get (DBUS_BUS_SYSTEM, &dbus_error);
if (security->priv->connection == NULL) {
- pk_error ("failed to get system connection %s: %s\n", dbus_error.name, dbus_error.message);
+ pk_warning ("failed to get system connection %s: %s\n", dbus_error.name, dbus_error.message);
}
/* get PolicyKit context */
@@ -188,7 +213,7 @@ pk_security_init (PkSecurity *security)
pk_error = NULL;
retval = polkit_context_init (security->priv->pk_context, &pk_error);
if (retval == FALSE) {
- pk_error ("Could not init PolicyKit context: %s", polkit_error_get_error_message (pk_error));
+ pk_warning ("Could not init PolicyKit context: %s", polkit_error_get_error_message (pk_error));
polkit_error_free (pk_error);
}
}
@@ -205,3 +230,81 @@ pk_security_new (void)
return PK_SECURITY (security);
}
+/***************************************************************************
+ *** MAKE CHECK TESTS ***
+ ***************************************************************************/
+#ifdef PK_BUILD_TESTS
+#include <libselftest.h>
+
+void
+libst_security (LibSelfTest *test)
+{
+ PkSecurity *security;
+ const gchar *action;
+ gboolean ret;
+ gchar *error;
+
+ if (libst_start (test, "PkSecurity", CLASS_AUTO) == FALSE) {
+ return;
+ }
+
+ /************************************************************/
+ libst_title (test, "get an instance");
+ security = pk_security_new ();
+ if (security != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "check connection");
+ if (security->priv->connection != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "check PolKit context");
+ if (security->priv->pk_context != NULL) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, NULL);
+ }
+
+ /************************************************************/
+ libst_title (test, "map valid role to action");
+ action = pk_security_role_to_action (security, PK_ROLE_ENUM_UPDATE_PACKAGE);
+ if (pk_strequal (action, "org.freedesktop.packagekit.update") == TRUE) {
+ libst_success (test, NULL, error);
+ } else {
+ libst_failed (test, "did not get correct action '%s'", action);
+ }
+
+ /************************************************************/
+ libst_title (test, "map invalid role to action");
+ action = pk_security_role_to_action (security, PK_ROLE_ENUM_SEARCH_NAME);
+ if (action == NULL) {
+ libst_success (test, NULL, error);
+ } else {
+ libst_failed (test, "did not get correct action '%s'", action);
+ }
+
+ /************************************************************/
+ libst_title (test, "get the default backend");
+ error = NULL;
+ ret = pk_security_action_is_allowed (security, ":0", PK_ROLE_ENUM_UPDATE_PACKAGE, &error);
+ if (ret == FALSE) {
+ libst_success (test, "did not authenticate update-package, error '%s'", error);
+ } else {
+ libst_failed (test, "authenticated update-package!");
+ }
+ g_free (error);
+
+ g_object_unref (security);
+
+ libst_end (test);
+}
+#endif
+
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index b8fa478..944e298 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -30,6 +30,7 @@ void libst_inhibit (LibSelfTest *test);
void libst_spawn (LibSelfTest *test);
void libst_thread_list (LibSelfTest *test);
void libst_transaction_list (LibSelfTest *test);
+void libst_security (LibSelfTest *test);
void libst_time (LibSelfTest *test);
int
@@ -45,6 +46,7 @@ main (int argc, char **argv)
pk_debug_init (TRUE);
/* tests go here */
+ libst_security (&test);
libst_time (&test);
libst_conf (&test);
libst_inhibit (&test);
commit fac6d1902c4ea9db2d0f72452b13e1a71369db15
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 22:17:53 2007 +0000
split out the file lists for the self test program
diff --git a/src/Makefile.am b/src/Makefile.am
index a369d67..c4dbfc1 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,12 +35,7 @@ pkbackendinclude_HEADERS = \
pk-backend.h \
pk-backend-python.h
-sbin_PROGRAMS = \
- packagekitd \
- $(NULL)
-
-packagekitd_SOURCES = \
- pk-main.c \
+shared_SOURCES = \
pk-marshal.c \
pk-marshal.h \
pk-backend-internal.h \
@@ -70,13 +65,22 @@ packagekitd_SOURCES = \
$(NULL)
if SECURITY_TYPE_POLKIT
-packagekitd_SOURCES += pk-security-polkit.c
+shared_SOURCES += pk-security-polkit.c
endif
if SECURITY_TYPE_DUMMY
-packagekitd_SOURCES += pk-security-dummy.c
+shared_SOURCES += pk-security-dummy.c
endif
+sbin_PROGRAMS = \
+ packagekitd \
+ $(NULL)
+
+packagekitd_SOURCES = \
+ pk-main.c \
+ $(shared_SOURCES) \
+ $(NULL)
+
packagekitd_LDADD = \
$(GLIB_LIBS) \
$(GMODULE_LIBS) \
@@ -130,23 +134,8 @@ noinst_PROGRAMS = \
pk-self-test
pk_self_test_SOURCES = \
- pk-inhibit.h \
- pk-inhibit.c \
- pk-backend.h \
- pk-backend.c \
- pk-time.h \
- pk-time.c \
- pk-spawn.h \
- pk-spawn.c \
- pk-conf.h \
- pk-conf.c \
- pk-thread-list.h \
- pk-thread-list.c \
- pk-transaction-id.h \
- pk-transaction-id.c \
- pk-transaction-list.h \
- pk-transaction-list.c \
pk-self-test.c \
+ $(shared_SOURCES) \
$(NULL)
pk_self_test_LDADD = \
@@ -154,6 +143,7 @@ pk_self_test_LDADD = \
$(GMODULE_LIBS) \
$(DBUS_LIBS) \
$(SELFTEST_LIBS) \
+ $(SQLITE_LIBS) \
$(LIBNM_LIBS) \
$(PK_LIBS) \
$(POLKIT_LIBS) \
commit 8607e9b9e302b27473f0966e8dc6e87b32dfcac8
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 22:05:13 2007 +0000
add a make gprof target to identify hot spots
diff --git a/Makefile.am b/Makefile.am
index 58d6b59..76d52ab 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -54,9 +54,18 @@ if PK_BUILD_GCOV
gcov:
make -C src gcov
make -C libpackagekit gcov
- cat src/coverage-report.txt > coverage-report.txt
- cat libpackagekit/coverage-report.txt >> coverage-report.txt
- cat coverage-report.txt
+ cat src/gcov.txt > gcov.txt
+ cat libpackagekit/gcov.txt >> gcov.txt
+ cat gcov.txt
+endif
+
+if PK_BUILD_GPROF
+gprof:
+ make -C src gprof
+ make -C libpackagekit gprof
+ cat src/gprof.txt > gprof.txt
+ cat libpackagekit/gprof.txt >> gprof.txt
+ cat gprof.txt
endif
DISTCLEANFILES = \
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index a627b50..f836225 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -139,7 +139,14 @@ if PK_BUILD_GCOV
clean-gcov:
rm -f *.gcov *.gcda
gcov: clean-gcov all check
- $(top_srcdir)/tools/create-coverage-report.sh libpackagekit $(filter %.c,$(libpackagekit_la_SOURCES)) > coverage-report.txt
+ $(top_srcdir)/tools/create-coverage-report.sh libpackagekit $(filter %.c,$(libpackagekit_la_SOURCES)) > gcov.txt
+endif
+
+if PK_BUILD_GPROF
+clean-gprof:
+ rm -f *.out
+gprof: clean-gprof all check
+ gprof .libs/pk-self-test > gprof.txt
endif
CLEANFILES = *~ $(BUILT_SOURCES) *.bb *.bbg *.da *.gcov *.gcda
diff --git a/src/Makefile.am b/src/Makefile.am
index 4a850f2..a369d67 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -166,8 +166,14 @@ if PK_BUILD_GCOV
clean-gcov:
rm -f *.gcov *.gcda
gcov: clean-gcov all check
- $(top_srcdir)/tools/create-coverage-report.sh packagekit $(filter %.c,$(packagekitd_SOURCES)) > coverage-report.txt
-TESTS = pk-self-test
+ $(top_srcdir)/tools/create-coverage-report.sh packagekit $(filter %.c,$(packagekitd_SOURCES)) > gcov.txt
+endif
+
+if PK_BUILD_GPROF
+clean-gprof:
+ rm -f *.out
+gprof: clean-gprof all check
+ gprof .libs/pk-self-test > gprof.txt
endif
EXTRA_DIST = \
diff --git a/tools/create-coverage-report.sh b/tools/create-coverage-report.sh
index 9fc2d55..c25626e 100755
--- a/tools/create-coverage-report.sh
+++ b/tools/create-coverage-report.sh
@@ -19,7 +19,7 @@ process ()
return
fi
if [ ! -e $1.gcov ]; then
- NOT_TESTED="$1.gcov,$NOT_TESTED"
+ NOT_TESTED="$1,$NOT_TESTED"
return
fi
SOURCE=`cat $1 |wc -l`
commit 502733f3a153e22d352d4adcf8c09875706e6155
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:53:27 2007 +0000
add more to gitignore
diff --git a/.gitignore b/.gitignore
index c36b60f..ee3ffc5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -51,5 +51,5 @@ py-compile
tags
*.patch
NEWS.new
-coverage-report.txt
+*.txt
diff --git a/libpackagekit/.gitignore b/libpackagekit/.gitignore
index fede20f..ec55faa 100644
--- a/libpackagekit/.gitignore
+++ b/libpackagekit/.gitignore
@@ -10,5 +10,6 @@ pk-self-test
*.gcov
*.gcda
*.gcno
-coverage-report.txt
+*.txt
+*.out
diff --git a/src/.gitignore b/src/.gitignore
index 71f0f74..dc4a293 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -10,6 +10,6 @@ debug.log
*.gcov
*.gcda
*.gcno
-coverage-report.txt
+*.txt
*.out
commit 0de1221726eaf2539c958ba5bb1d1edee8bd4ec0
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:50:15 2007 +0000
add support for gcov
diff --git a/Makefile.am b/Makefile.am
index 3516ca8..58d6b59 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -45,11 +45,20 @@ EXTRA_DIST = \
$(NULL)
clean-local :
- rm -f *~
+ rm -f *~ *.bb *.bbg *.da *.gcov .libs/*.da .libs/*.bbg
security-check:
flawfinder `find -name "*.c"`
+if PK_BUILD_GCOV
+gcov:
+ make -C src gcov
+ make -C libpackagekit gcov
+ cat src/coverage-report.txt > coverage-report.txt
+ cat libpackagekit/coverage-report.txt >> coverage-report.txt
+ cat coverage-report.txt
+endif
+
DISTCLEANFILES = \
PackageKit-*.tar.gz \
packagekit.pc \
diff --git a/configure.ac b/configure.ac
index 8101653..951e858 100755
--- a/configure.ac
+++ b/configure.ac
@@ -42,14 +42,6 @@ if test "$GCC" = "yes"; then
fi
dnl ---------------------------------------------------------------------------
-dnl - Extra verbose warning switches
-dnl ---------------------------------------------------------------------------
-#if test "$GCC" = "yes"; then
-# CPPFLAGS="$CPPFLAGS -pg"
-# LDFLAGS="$LDFLAGS -pg"
-#fi
-
-dnl ---------------------------------------------------------------------------
dnl - gettext stuff
dnl ---------------------------------------------------------------------------
GETTEXT_PACKAGE=PackageKit
@@ -145,17 +137,40 @@ AC_DEFINE_UNQUOTED(PACKAGEKIT_USER,"$PACKAGEKIT_USER", [User for running the Pac
dnl ---------------------------------------------------------------------------
dnl - Build self tests
dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(tests, [ --enable-tests Build self tests],enable_tests=$enableval,enable_tests=no)
-AC_MSG_CHECKING([whether to support tests])
-have_tests=no
-if test x$enable_tests = xyes ; then
- have_tests=yes
- AC_MSG_RESULT([yes])
- AC_DEFINE(PK_BUILD_TESTS, 1, [Define if we want to use the self tests])
-else
- AC_MSG_RESULT([no])
+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)
+
+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
+
+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])
+
+ AC_MSG_CHECKING([for gcc 3.3 version of gcov file format])
+ have_gcc33_gcov=no
+ AC_RUN_IFELSE( [AC_LANG_PROGRAM( , [[ if (__GNUC__ >=3 && __GNUC_MINOR__ >= 3) exit (0); else exit (1); ]])],
+ have_gcc33_gcov=yes)
+ if test x$have_gcc33_gcov = xyes ; then
+ AC_DEFINE_UNQUOTED(PK_HAVE_GCC33_GCOV, 1, [Defined if we have gcc 3.3 and thus the new gcov format])
+ fi
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ AC_MSG_RESULT($have_gcc33_gcov)
+fi
+AM_CONDITIONAL(PK_BUILD_GCOV, test x$enable_gcov = xyes)
+
+if test x$enable_gprof = xyes; then
+ ## so that config.h changes when you toggle gprof support
+ AC_DEFINE_UNQUOTED(PK_BUILD_GPROF, 1, [Defined if gprof is enabled to force a rebuild due to config.h changing])
+ CPPFLAGS="$CPPFLAGS -pg"
+ LDFLAGS="$LDFLAGS -pg"
+ CFLAGS="$CFLAGS -fprofile-arcs -ftest-coverage"
+ AC_MSG_RESULT($enable_gprof)
fi
-AM_CONDITIONAL([PK_BUILD_TESTS], [test $have_tests = yes])
+AM_CONDITIONAL(PK_BUILD_GPROF, test x$enable_gprof = xyes)
dnl ---------------------------------------------------------------------------
dnl - Are we specifying a different dbus root ?
@@ -460,6 +475,9 @@ echo "
datadir: ${datadir}
compiler: ${CC}
cflags: ${CFLAGS}
+ Building unit tests: ${enable_tests}
+ GCC coverage profiling: ${enable_gcov}
+ GCC time profiling: ${enable_gprof}
Default backend: ${with_default_backend}
Security Framework: ${with_security_framework}
Networking stack: ${with_networking_stack}
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index f70f2a3..a627b50 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -135,9 +135,15 @@ pk-marshal.c: pk-marshal.list
pk-marshal.h: pk-marshal.list
@GLIB_GENMARSHAL@ $< --prefix=pk_marshal --header > $@
-clean-local:
- rm -f *~
- rm -f pk-marshal.c pk-marshal.h
+if PK_BUILD_GCOV
+clean-gcov:
+ rm -f *.gcov *.gcda
+gcov: clean-gcov all check
+ $(top_srcdir)/tools/create-coverage-report.sh libpackagekit $(filter %.c,$(libpackagekit_la_SOURCES)) > coverage-report.txt
+endif
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = *~ $(BUILT_SOURCES) *.bb *.bbg *.da *.gcov *.gcda
+
+clean-local:
+ rm -f $(CLEANFILES)
diff --git a/src/Makefile.am b/src/Makefile.am
index dc6b059..4a850f2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -162,6 +162,14 @@ pk_self_test_LDADD = \
TESTS = pk-self-test
endif
+if PK_BUILD_GCOV
+clean-gcov:
+ rm -f *.gcov *.gcda
+gcov: clean-gcov all check
+ $(top_srcdir)/tools/create-coverage-report.sh packagekit $(filter %.c,$(packagekitd_SOURCES)) > coverage-report.txt
+TESTS = pk-self-test
+endif
+
EXTRA_DIST = \
pk-marshal.list \
pk-security-polkit.c \
@@ -173,7 +181,7 @@ clean-local:
rm -f *~
rm -f pk-marshal.c pk-marshal.h
-CLEANFILES = $(BUILT_SOURCES)
+CLEANFILES = *~ $(BUILT_SOURCES) *.bb *.bbg *.da *.gcov *.gcda
MAINTAINERCLEANFILES = \
*~ \
commit 4798f16579a38f398fe5536986a139082d649289
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:11:28 2007 +0000
fix build
diff --git a/configure.ac b/configure.ac
index 6640a6d..8101653 100755
--- a/configure.ac
+++ b/configure.ac
@@ -44,10 +44,10 @@ fi
dnl ---------------------------------------------------------------------------
dnl - Extra verbose warning switches
dnl ---------------------------------------------------------------------------
-if test "$GCC" = "yes"; then
+#if test "$GCC" = "yes"; then
# CPPFLAGS="$CPPFLAGS -pg"
# LDFLAGS="$LDFLAGS -pg"
-fi
+#fi
dnl ---------------------------------------------------------------------------
dnl - gettext stuff
commit f59dc379129e6edf3852083ec5ebc5f871475eb1
Merge: 5eec5d4... 5b5c80f...
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:02:38 2007 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
diff --cc configure.ac
index 92c37e4,1785921..6640a6d
mode 100644,100755..100755
--- a/configure.ac
+++ b/configure.ac
commit 5eec5d4ff69cbc33c0e99d6c764fc89547608429
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:02:30 2007 +0000
use better build constants
diff --git a/configure.ac b/configure.ac
index 6098fd9..92c37e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -42,6 +42,14 @@ if test "$GCC" = "yes"; then
fi
dnl ---------------------------------------------------------------------------
+dnl - Extra verbose warning switches
+dnl ---------------------------------------------------------------------------
+if test "$GCC" = "yes"; then
+# CPPFLAGS="$CPPFLAGS -pg"
+# LDFLAGS="$LDFLAGS -pg"
+fi
+
+dnl ---------------------------------------------------------------------------
dnl - gettext stuff
dnl ---------------------------------------------------------------------------
GETTEXT_PACKAGE=PackageKit
@@ -92,16 +100,16 @@ AC_SUBST(DBUS_LIBS)
dnl ---------------------------------------------------------------------------
dnl - Is NetworkManager available?
dnl ---------------------------------------------------------------------------
-PKG_CHECK_MODULES(LIBNM, libnm_glib >= $LIBNM_GLIB_REQUIRED, HAVE_NETWORKMANAGER="yes", HAVE_NETWORKMANAGER="no")
-if test "x$HAVE_NETWORKMANAGER" = "xyes"; then
+PKG_CHECK_MODULES(LIBNM, libnm_glib >= $LIBNM_GLIB_REQUIRED, PK_BUILD_NETWORKMANAGER="yes", PK_BUILD_NETWORKMANAGER="no")
+if test "x$PK_BUILD_NETWORKMANAGER" = "xyes"; then
with_networking_stack="NetworkManager"
- AC_DEFINE(HAVE_NETWORKMANAGER, 1, [define if NetworkManager is installed])
+ AC_DEFINE(PK_BUILD_NETWORKMANAGER, 1, [define if NetworkManager is installed])
else
with_networking_stack="dummy"
- HAVE_NETWORKMANAGER=no
+ PK_BUILD_NETWORKMANAGER=no
fi
-AM_CONDITIONAL(HAVE_NETWORKMANAGER, test x$HAVE_NETWORKMANAGER = xyes)
+AM_CONDITIONAL(PK_BUILD_NETWORKMANAGER, test x$PK_BUILD_NETWORKMANAGER = xyes)
AC_SUBST(LIBNM_CFLAGS)
AC_SUBST(LIBNM_LIBS)
@@ -143,11 +151,11 @@ have_tests=no
if test x$enable_tests = xyes ; then
have_tests=yes
AC_MSG_RESULT([yes])
- AC_DEFINE(HAVE_TESTS, 1, [Define if we want to use the self tests])
+ AC_DEFINE(PK_BUILD_TESTS, 1, [Define if we want to use the self tests])
else
AC_MSG_RESULT([no])
fi
-AM_CONDITIONAL([HAVE_TESTS], [test $have_tests = yes])
+AM_CONDITIONAL([PK_BUILD_TESTS], [test $have_tests = yes])
dnl ---------------------------------------------------------------------------
dnl - Are we specifying a different dbus root ?
commit db4e95730692743abe2f3145ead4b2598f0c833e
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:02:00 2007 +0000
only include the selftest code when we compile in support
diff --git a/client/Makefile.am b/client/Makefile.am
index 57fb4ed..c1b95a0 100644
--- a/client/Makefile.am
+++ b/client/Makefile.am
@@ -14,6 +14,11 @@ INCLUDES = \
-DVERSION="\"$(VERSION)\"" \
-DPK_DATA=\"$(pkgdatadir)\" \
-I$(top_srcdir)/libpackagekit \
+ -I$(top_srcdir)/libselftest \
+ $(NULL)
+
+SELFTEST_LIBS = \
+ $(top_builddir)/libselftest/libselftest.la \
$(NULL)
PK_LIBS = \
@@ -33,6 +38,7 @@ pkcon_LDADD = \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(PK_LIBS) \
+ $(SELFTEST_LIBS) \
$(NULL)
pkmon_SOURCES = \
@@ -43,6 +49,7 @@ pkmon_LDADD = \
$(GLIB_LIBS) \
$(DBUS_LIBS) \
$(PK_LIBS) \
+ $(SELFTEST_LIBS) \
$(NULL)
clean-local:
diff --git a/libpackagekit/Makefile.am b/libpackagekit/Makefile.am
index a52e405..f70f2a3 100644
--- a/libpackagekit/Makefile.am
+++ b/libpackagekit/Makefile.am
@@ -19,6 +19,10 @@ SELFTEST_LIBS = \
$(top_builddir)/libselftest/libselftest.la \
$(NULL)
+PK_LIBS = \
+ $(top_builddir)/libpackagekit/libpackagekit.la \
+ $(NULL)
+
lib_LTLIBRARIES = \
libpackagekit.la \
$(NULL)
@@ -68,7 +72,7 @@ libpackagekit_la_SOURCES = \
pk-polkit-client.h \
$(NULL)
-if HAVE_NETWORKMANAGER
+if PK_BUILD_NETWORKMANAGER
libpackagekit_la_SOURCES += \
pk-network-nm.c \
$(NULL)
@@ -85,10 +89,17 @@ libpackagekit_la_LIBADD = \
$(LIBNM_LIBS) \
$(NULL)
+if PK_BUILD_TESTS
+libpackagekit_la_LIBADD += \
+ $(SELFTEST_LIBS) \
+ $(NULL)
+endif
+
libpackagekit_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \
$(NULL)
+if PK_BUILD_TESTS
check_PROGRAMS = \
pk-self-test
@@ -96,18 +107,6 @@ noinst_PROGRAMS = \
pk-self-test
pk_self_test_SOURCES = \
- pk-debug.c \
- pk-debug.h \
- pk-enum.h \
- pk-enum.c \
- pk-common.h \
- pk-common.c \
- pk-enum-list.h \
- pk-enum-list.c \
- pk-package-id.h \
- pk-package-id.c \
- pk-package-list.h \
- pk-package-list.c \
pk-self-test.c \
$(NULL)
@@ -118,8 +117,8 @@ pk_self_test_LDADD = \
$(PK_LIBS) \
$(NULL)
-pk_self_test_CPPFLAGS= \
- -DPK_BUILD_TESTS
+TESTS = pk-self-test
+endif
EXTRA_DIST = \
pk-marshal.list
@@ -142,5 +141,3 @@ clean-local:
CLEANFILES = $(BUILT_SOURCES)
-TESTS = pk-self-test
-
diff --git a/src/Makefile.am b/src/Makefile.am
index ef8b855..dc6b059 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -84,6 +84,7 @@ packagekitd_LDADD = \
$(SQLITE_LIBS) \
$(PK_LIBS) \
$(POLKIT_LIBS) \
+ $(SELFTEST_LIBS) \
$(NULL)
if BACKEND_TYPE_BOX
@@ -120,6 +121,8 @@ pk-interface.h: pk-interface.xml
--output=pk-interface.h \
$(srcdir)/pk-interface.xml
+if PK_BUILD_TESTS
+
check_PROGRAMS = \
pk-self-test
@@ -156,8 +159,8 @@ pk_self_test_LDADD = \
$(POLKIT_LIBS) \
$(NULL)
-pk_self_test_CPPFLAGS= \
- -DPK_BUILD_TESTS
+TESTS = pk-self-test
+endif
EXTRA_DIST = \
pk-marshal.list \
@@ -172,8 +175,6 @@ clean-local:
CLEANFILES = $(BUILT_SOURCES)
-TESTS = pk-self-test
-
MAINTAINERCLEANFILES = \
*~ \
Makefile.in \
commit 2bf60238ceda29b285e6243c0591b20a9ab3c84f
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 21:00:07 2007 +0000
run a large spawn for a lot of data
diff --git a/data/tests/Makefile.am b/data/tests/Makefile.am
index a6bc194..d15dd6c 100644
--- a/data/tests/Makefile.am
+++ b/data/tests/Makefile.am
@@ -6,6 +6,7 @@ NULL =
TEST_FILES = \
pk-spawn-test.sh \
pk-spawn-test-sigquit.sh \
+ pk-spawn-test-profiling.sh \
$(NULL)
EXTRA_DIST = \
diff --git a/data/tests/pk-spawn-test-profiling.sh b/data/tests/pk-spawn-test-profiling.sh
new file mode 100755
index 0000000..ace475d
--- /dev/null
+++ b/data/tests/pk-spawn-test-profiling.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+# 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.
+
+time=0.01
+
+for i in `seq 1 100`
+do
+ echo -e "percentage\t$i" > /dev/stderr
+ echo -e "package:1\tpolkit\tPolicyKit daemon"
+ echo -e "package:0\tpolkit-gnome\tPolicyKit helper for GNOME"
+ sleep ${time}
+done
+
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 6ced0ba..f4246b9 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -645,6 +645,18 @@ libst_spawn (LibSelfTest *test)
libst_failed (test, "finish %i!", mexit);
}
+ g_free (path);
+
+ /************************************************************/
+ libst_title (test, "run lots of data for profiling");
+ path = pk_test_get_data ("pk-spawn-test-profiling.sh");
+ ret = pk_spawn_command (spawn, path);
+ if (ret == TRUE) {
+ libst_success (test, NULL);
+ } else {
+ libst_failed (test, "did not run profiling helper");
+ }
+
g_object_unref (spawn);
g_free (path);
commit e2b087f380ca8e5811f879e1a097a62573c9a48f
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 20:58:43 2007 +0000
update gitignore
diff --git a/src/.gitignore b/src/.gitignore
index bfc46dd..71f0f74 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -11,4 +11,5 @@ debug.log
*.gcda
*.gcno
coverage-report.txt
+*.out
commit ed372296e37995415342ea0461a17cc95f5c6d7b
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 20:58:04 2007 +0000
disable tests when doing make distcheck until we sort the libselftest problem£
diff --git a/Makefile.am b/Makefile.am
index 6ca218d..3516ca8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -76,3 +76,5 @@ MAINTAINERCLEANFILES = \
aclocal.m4 \
$(NULL)
+DISTCHECK_CONFIGURE_FLAGS = --disable-tests --disable-gcov
+
commit cf7992443daffe27575801d92753c5ed646fffae
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 20:37:49 2007 +0000
remove unused file
diff --git a/src/pk-spawn-test.sh b/src/pk-spawn-test.sh
deleted file mode 100755
index 1c8fc4f..0000000
--- a/src/pk-spawn-test.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-
-time=0.30
-
-echo -e "percentage\t0" > /dev/stderr
-echo -e "percentage\t10" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t20" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t30" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t40" > /dev/stderr
-sleep ${time}
-echo -e "package:1\tpolkit\tPolicyKit daemon"
-echo -e "package:0\tpolkit-gnome\tPolicyKit helper for GNOME"
-sleep ${time}
-echo -e -n "package:0\tConsoleKit"
-sleep ${time}
-echo -e "\tSystem console checker"
-echo -e "percentage\t50" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t60" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t70" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t80" > /dev/stderr
-sleep ${time}
-echo -e "percentage\t90" > /dev/stderr
-echo -e "package:0\tgnome-power-manager\tMore useless software"
-sleep ${time}
-echo -e "percentage\t100" > /dev/stderr
-
commit 04bf8c78e4a8213b869265e6e104fae2b70442ee
Author: Richard Hughes <richard at hughsie.com>
Date: Sun Nov 4 20:16:47 2007 +0000
immediate exit has to wait 50ms for dbus to register
diff --git a/src/pk-main.c b/src/pk-main.c
index 9804d68..c5fd1f9 100644
--- a/src/pk-main.c
+++ b/src/pk-main.c
@@ -241,10 +241,12 @@ main (int argc, char *argv[])
g_timeout_add_seconds (5, (GSourceFunc) pk_main_timeout_check_cb, engine);
}
- if (immediate_exit == FALSE) {
- g_main_loop_run (loop);
+ /* immediatly exit */
+ if (immediate_exit == TRUE) {
+ g_timeout_add (50, (GSourceFunc) timed_exit_cb, loop);
}
+ g_main_loop_run (loop);
g_main_loop_unref (loop);
g_object_unref (conf);
g_object_unref (engine);
commit 5b5c80fe9add11c00c615c71e2b93f193ab0e1f9
Merge: 5431af7... 7d95ae7...
Author: Tom Parker <palfrey at tevp.net>
Date: Sun Nov 4 20:49:44 2007 +0100
Merge branch 'master' of git+ssh://palfrey@git.packagekit.org/srv/git/PackageKit
commit 5431af76a2b448feaee5f36ef6f6ff112b7867c4
Author: Tom Parker <palfrey at scrumpy.(none)>
Date: Sun Nov 4 17:31:15 2007 +0100
Check for existance of apt_pkg python module with apt backend
diff --git a/acinclude.m4 b/acinclude.m4
new file mode 100755
index 0000000..df95cb1
--- /dev/null
+++ b/acinclude.m4
@@ -0,0 +1,33 @@
+dnl Macros to help with configuring Python extensions via autoconf.
+dnl Copyright (C) 1998, James Henstridge <james at daa.com.au>
+dnl
+dnl Distribute under the same rules as Autoconf itself.
+dnl
+dnl Used similar to AC_CHECK_LIB and associates.
+dnl Swiped from http://www.initd.org/svn/psycopg/psycopg1/trunk/aclocal.m4
+
+dnl PY_CHECK_MOD(MODNAME [,SYMBOL [,ACTION-IF-FOUND [,ACTION-IF-NOT-FOUND]]])
+dnl Check if a module containing a given symbol is visible to python.
+AC_DEFUN(PY_CHECK_MOD,
+[AC_REQUIRE([AM_PATH_PYTHON])
+py_mod_var=`echo $1['_']$2 | sed 'y%./+-%__p_%'`
+AC_MSG_CHECKING(for ifelse([$3],[],,[$2 in ])python module $1)
+AC_CACHE_VAL(py_cv_mod_$py_mod_var, [
+if $PYTHON -c 'import $1 ifelse([$2],[],,[; $1.$2])' 1>&AC_FD_CC 2>&AC_FD_CC; then
+ eval "py_cv_mod_$py_mod_var=yes"
+else
+ eval "py_cv_mod_$py_mod_var=no"
+fi
+])
+py_val=`eval "echo \`echo '$py_cv_mod_'$py_mod_var\`"`
+if test "x$py_val" != xno; then
+ AC_MSG_RESULT(yes)
+ ifelse([$3], [],, [$3
+])dnl
+else
+ AC_MSG_RESULT(no)
+ ifelse([$4], [],, [$4
+])dnl
+fi
+])
+
diff --git a/configure.ac b/configure.ac
old mode 100644
new mode 100755
index 6098fd9..1785921
--- a/configure.ac
+++ b/configure.ac
@@ -308,6 +308,7 @@ AC_DEFUN([APT_BACKEND],
])
if test x$with_default_backend = xapt; then
+ PY_CHECK_MOD([apt_pkg],,,AC_MSG_ERROR([Apt backend needs python-apt]))
AC_ARG_WITH(libapt-pkg-lib,
AC_HELP_STRING([--with-libapt-pkg-lib=DIR],[look for the libapt-pkg library in DIR]),
More information about the PackageKit
mailing list