[PackageKit-commit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Wed Sep 17 02:32:19 PDT 2008
backends/smart/helpers/smartBackend.py | 2
backends/yum/yumBackend.py | 4
data/tests/pk-spawn-dispatcher.py | 8 -
libpackagekit/README | 4
libpackagekit/pk-bitfield.c | 3
libpackagekit/pk-client.c | 159 ++++++++------------------
libpackagekit/pk-common.c | 3
src/pk-backend.c | 195 +++++++++++----------------------
src/pk-conf.c | 27 +---
src/pk-engine.c | 19 +--
src/pk-spawn.c | 32 ++++-
src/pk-transaction-db.c | 20 +--
12 files changed, 178 insertions(+), 298 deletions(-)
New commits:
commit 0f2fa1f265aa0e7922d5acf03e1266081345df58
Author: Richard Hughes <hughsie at localhost.localdomain>
Date: Wed Sep 17 10:28:13 2008 +0100
yum: bugfix: don't try and upgrade kernel when we want to upgrade the preupgrade package
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index e3f07c1..cfbc17d 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1397,7 +1397,7 @@ class PackageKitYumBackend(PackageKitBaseBackend,PackagekitPackage):
elif len(pkgs) == 1:
# check if there are any updates to the preupgrade package
po = pkgs[0]
- pkgs = self.yumbase.pkgSack.returnNewestByName(name='kernel')
+ pkgs = self.yumbase.pkgSack.returnNewestByName(name='preupgrade')
if pkgs:
newest = pkgs[0]
if newest.EVR > po.EVR:
commit 76a6827e5d1930756ddd0fb19393a881ed7163ed
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 10:24:33 2008 +0100
bugfix: split the dispatcher commands using tab else we don't handle filenames with spaces in them correctly
diff --git a/backends/smart/helpers/smartBackend.py b/backends/smart/helpers/smartBackend.py
index a84e3f7..ebcd0ae 100755
--- a/backends/smart/helpers/smartBackend.py
+++ b/backends/smart/helpers/smartBackend.py
@@ -1190,7 +1190,7 @@ def main():
if line == 'exit':
break
backend.reset()
- args = line.split(' ')
+ args = line.split('\t')
backend.dispatch_command(args[0],args[1:])
if __name__ == "__main__":
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 59a1880..e3f07c1 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1955,7 +1955,7 @@ def main():
line = raw_input('')
if line == 'exit':
break
- args = line.split(' ')
+ args = line.split('\t')
backend.dispatch_command(args[0],args[1:])
if __name__ == "__main__":
diff --git a/data/tests/pk-spawn-dispatcher.py b/data/tests/pk-spawn-dispatcher.py
index fb43190..75469bb 100755
--- a/data/tests/pk-spawn-dispatcher.py
+++ b/data/tests/pk-spawn-dispatcher.py
@@ -17,8 +17,10 @@ import sys
def dispatch(args):
if args[0] == 'search-name':
- print 'package\tavailable\tpolkit;0.0.1;i386;data\tPolicyKit daemon'
- sys.stdout.flush()
+ # check we escape spaces properly
+ if args[2] == 'power manager':
+ print 'package\tavailable\tpolkit;0.0.1;i386;data\tPolicyKit daemon'
+ sys.stdout.flush()
def main():
args = sys.argv[1:]
@@ -27,7 +29,7 @@ def main():
line = raw_input('')
if line == 'exit':
break
- args = line.split(' ')
+ args = line.split('\t')
dispatch(args)
if __name__ == "__main__":
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index f3fee87..4714e3f 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -391,9 +391,10 @@ pk_spawn_argv (PkSpawn *spawn, gchar **argv, gchar **envp)
} else if (!egg_strvequal (spawn->priv->last_envp, envp)) {
egg_debug ("envp did not match, not reusing");
} else {
+ /* join with tabs, as spaces could be in file name */
+ command = g_strjoinv ("\t", &argv[1]);
+
/* reuse instance */
- //TODO: escape spaces
- command = g_strjoinv (" ", &argv[1]);
egg_debug ("reusing instance");
ret = pk_spawn_send_stdin (spawn, command);
g_free (command);
@@ -782,8 +783,8 @@ pk_spawn_test (EggTest *test)
egg_test_title (test, "run the dispatcher");
mexit = BAD_EXIT;
file = egg_test_get_data_file ("pk-spawn-dispatcher.py");
- path = g_strdup_printf ("%s search-name none power", file);
- argv = g_strsplit (path, " ", 0);
+ path = g_strdup_printf ("%s\tsearch-name\tnone\tpower manager", file);
+ argv = g_strsplit (path, "\t", 0);
ret = pk_spawn_argv (spawn, argv, NULL);
g_free (file);
g_free (path);
commit 33d411503f1dd6b4ce74398b322d176d43312673
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 09:27:46 2008 +0100
bugfix, trivial: after code review, protect pk_spawn_exit() from being called twice in one instance
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 3df7cd7..f3fee87 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -337,6 +337,15 @@ gboolean
pk_spawn_exit (PkSpawn *spawn)
{
gboolean ret;
+
+ g_return_val_if_fail (PK_IS_SPAWN (spawn), FALSE);
+
+ /* check if already sending exit */
+ if (spawn->priv->is_sending_exit) {
+ egg_warning ("already sending exit, ignoring");
+ return FALSE;
+ }
+
spawn->priv->is_sending_exit = TRUE;
ret = pk_spawn_send_stdin (spawn, "exit");
return ret;
@@ -833,6 +842,14 @@ pk_spawn_test (EggTest *test)
else
egg_test_failed (test, "failed to close dispatcher");
+ /************************************************************/
+ egg_test_title (test, "ask dispatcher to close (again, should be closing)");
+ ret = pk_spawn_exit (spawn);
+ if (!ret)
+ egg_test_success (test, NULL);
+ else
+ egg_test_failed (test, "attempted to close twice");
+
/* this may take a while */
egg_test_loop_wait (test, 100);
commit 81320d132683de4f4b6d632bf926b5c0ab0340d4
Author: Richard Hughes <richard at hughsie.com>
Date: Wed Sep 17 09:03:09 2008 +0100
trivial: whitespace changes
diff --git a/libpackagekit/pk-bitfield.c b/libpackagekit/pk-bitfield.c
index cfe774f..1f47399 100644
--- a/libpackagekit/pk-bitfield.c
+++ b/libpackagekit/pk-bitfield.c
@@ -70,9 +70,8 @@ pk_bitfield_contain_priority (PkBitfield values, gint value, ...)
break;
}
/* end of the list */
- if (value_temp == -1) {
+ if (value_temp == -1)
break;
- }
}
va_end (args);
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index c3266e1..cc710d6 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -1188,9 +1188,8 @@ pk_client_get_updates (PkClient *client, PkBitfield filters, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_UPDATES;
@@ -1211,9 +1210,8 @@ pk_client_get_updates (PkClient *client, PkBitfield filters, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1266,9 +1264,8 @@ pk_client_update_system (PkClient *client, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_UPDATE_SYSTEM;
@@ -1303,9 +1300,8 @@ pk_client_update_system (PkClient *client, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -1334,9 +1330,8 @@ pk_client_search_name (PkClient *client, PkBitfield filters, const gchar *search
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_SEARCH_NAME;
@@ -1359,9 +1354,8 @@ pk_client_search_name (PkClient *client, PkBitfield filters, const gchar *search
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1391,9 +1385,8 @@ pk_client_search_details (PkClient *client, PkBitfield filters, const gchar *sea
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_SEARCH_DETAILS;
@@ -1416,9 +1409,8 @@ pk_client_search_details (PkClient *client, PkBitfield filters, const gchar *sea
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1446,9 +1438,8 @@ pk_client_search_group (PkClient *client, PkBitfield filters, const gchar *searc
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_SEARCH_GROUP;
@@ -1471,9 +1462,8 @@ pk_client_search_group (PkClient *client, PkBitfield filters, const gchar *searc
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1501,9 +1491,8 @@ pk_client_search_file (PkClient *client, PkBitfield filters, const gchar *search
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_SEARCH_FILE;
@@ -1526,9 +1515,8 @@ pk_client_search_file (PkClient *client, PkBitfield filters, const gchar *search
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1569,9 +1557,8 @@ pk_client_get_depends (PkClient *client, PkBitfield filters, gchar **package_ids
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_DEPENDS;
@@ -1596,9 +1583,8 @@ pk_client_get_depends (PkClient *client, PkBitfield filters, gchar **package_ids
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1687,9 +1673,8 @@ pk_client_get_packages (PkClient *client, PkBitfield filters, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_PACKAGES;
@@ -1710,9 +1695,8 @@ pk_client_get_packages (PkClient *client, PkBitfield filters, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1786,9 +1770,8 @@ pk_client_get_requires (PkClient *client, PkBitfield filters, gchar **package_id
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_REQUIRES;
@@ -1813,9 +1796,8 @@ pk_client_get_requires (PkClient *client, PkBitfield filters, gchar **package_id
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1850,9 +1832,8 @@ pk_client_what_provides (PkClient *client, PkBitfield filters, PkProvidesEnum pr
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_WHAT_PROVIDES;
@@ -1879,9 +1860,8 @@ pk_client_what_provides (PkClient *client, PkBitfield filters, PkProvidesEnum pr
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1920,9 +1900,8 @@ pk_client_get_update_detail (PkClient *client, gchar **package_ids, GError **err
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_UPDATE_DETAIL;
@@ -1941,9 +1920,8 @@ pk_client_get_update_detail (PkClient *client, gchar **package_ids, GError **err
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -1970,9 +1948,8 @@ pk_client_rollback (PkClient *client, const gchar *transaction_id, GError **erro
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_ROLLBACK;
@@ -1991,9 +1968,8 @@ pk_client_rollback (PkClient *client, const gchar *transaction_id, GError **erro
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -2024,9 +2000,8 @@ pk_client_resolve (PkClient *client, PkBitfield filters, gchar **packages, GErro
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_RESOLVE;
@@ -2049,9 +2024,8 @@ pk_client_resolve (PkClient *client, PkBitfield filters, gchar **packages, GErro
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -2090,9 +2064,8 @@ pk_client_get_details (PkClient *client, gchar **package_ids, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_DETAILS;
@@ -2111,9 +2084,8 @@ pk_client_get_details (PkClient *client, gchar **package_ids, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -2139,9 +2111,8 @@ pk_client_get_distro_upgrades (PkClient *client, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_DISTRO_UPGRADES;
@@ -2158,9 +2129,8 @@ pk_client_get_distro_upgrades (PkClient *client, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -2198,9 +2168,8 @@ pk_client_get_files (PkClient *client, gchar **package_ids, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_FILES;
@@ -2219,9 +2188,8 @@ pk_client_get_files (PkClient *client, gchar **package_ids, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
pk_client_error_fixup (error);
return ret;
@@ -2292,9 +2260,8 @@ pk_client_remove_packages (PkClient *client, gchar **package_ids, gboolean allow
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_REMOVE_PACKAGES;
@@ -2326,9 +2293,8 @@ pk_client_remove_packages (PkClient *client, gchar **package_ids, gboolean allow
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -2381,9 +2347,8 @@ pk_client_refresh_cache (PkClient *client, gboolean force, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_REFRESH_CACHE;
@@ -2413,9 +2378,8 @@ pk_client_refresh_cache (PkClient *client, gboolean force, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -2477,9 +2441,8 @@ pk_client_install_packages (PkClient *client, gchar **package_ids, GError **erro
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_INSTALL_PACKAGES;
@@ -2509,9 +2472,8 @@ pk_client_install_packages (PkClient *client, gchar **package_ids, GError **erro
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -2578,9 +2540,8 @@ pk_client_install_signature (PkClient *client, PkSigTypeEnum type, const gchar *
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_INSTALL_SIGNATURE;
@@ -2611,9 +2572,8 @@ pk_client_install_signature (PkClient *client, PkSigTypeEnum type, const gchar *
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -2675,9 +2635,8 @@ pk_client_update_packages (PkClient *client, gchar **package_ids, GError **error
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_UPDATE_PACKAGES;
@@ -2711,9 +2670,8 @@ pk_client_update_packages (PkClient *client, gchar **package_ids, GError **error
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -2799,9 +2757,8 @@ pk_client_install_files (PkClient *client, gboolean trusted, gchar **files_rel,
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* convert all the relative paths to absolute ones */
files = g_strdupv (files_rel);
@@ -2847,9 +2804,8 @@ pk_client_install_files (PkClient *client, gboolean trusted, gchar **files_rel,
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
g_strfreev (files);
@@ -2876,9 +2832,8 @@ pk_client_get_repo_list (PkClient *client, PkBitfield filters, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_GET_REPO_LIST;
@@ -2900,9 +2855,8 @@ pk_client_get_repo_list (PkClient *client, PkBitfield filters, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
}
@@ -2952,9 +2906,8 @@ pk_client_accept_eula (PkClient *client, const gchar *eula_id, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_ACCEPT_EULA;
@@ -2983,9 +2936,8 @@ pk_client_accept_eula (PkClient *client, const gchar *eula_id, GError **error)
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -3038,9 +2990,8 @@ pk_client_repo_enable (PkClient *client, const gchar *repo_id, gboolean enabled,
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_REPO_ENABLE;
@@ -3069,9 +3020,8 @@ pk_client_repo_enable (PkClient *client, const gchar *repo_id, gboolean enabled,
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -3133,9 +3083,8 @@ pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *pa
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* save this so we can re-issue it */
client->priv->role = PK_ROLE_ENUM_REPO_SET_DATA;
@@ -3164,9 +3113,8 @@ pk_client_repo_set_data (PkClient *client, const gchar *repo_id, const gchar *pa
pk_client_change_status (client, PK_STATUS_ENUM_WAIT);
/* spin until finished */
- if (client->priv->synchronous) {
+ if (client->priv->synchronous)
g_main_loop_run (client->priv->loop);
- }
}
return ret;
@@ -3225,9 +3173,8 @@ pk_client_get_old_transactions (PkClient *client, guint number, GError **error)
/* get and set a new ID */
ret = pk_client_allocate_transaction_id (client, error);
- if (!ret) {
+ if (!ret)
return FALSE;
- }
/* check to see if we have a valid proxy */
if (client->priv->proxy == NULL) {
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 2d5c6ca..ce6f7f8 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -61,9 +61,8 @@ pk_get_machine_type (void)
struct utsname buf;
retval = uname (&buf);
- if (retval != 0) {
+ if (retval != 0)
return g_strdup ("unknown");
- }
return g_strdup (buf.machine);
}
diff --git a/src/pk-backend.c b/src/pk-backend.c
index ed5ccb9..016a338 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -148,9 +148,8 @@ pk_backend_get_groups (PkBackend *backend)
g_return_val_if_fail (backend->priv->locked != FALSE, PK_GROUP_ENUM_UNKNOWN);
/* not compulsory */
- if (backend->desc->get_groups == NULL) {
+ if (backend->desc->get_groups == NULL)
return PK_GROUP_ENUM_UNKNOWN;
- }
return backend->desc->get_groups (backend);
}
@@ -164,9 +163,8 @@ pk_backend_get_filters (PkBackend *backend)
g_return_val_if_fail (backend->priv->locked != FALSE, PK_FILTER_ENUM_UNKNOWN);
/* not compulsory */
- if (backend->desc->get_filters == NULL) {
+ if (backend->desc->get_filters == NULL)
return PK_FILTER_ENUM_UNKNOWN;
- }
return backend->desc->get_filters (backend);
}
@@ -184,84 +182,58 @@ pk_backend_get_actions (PkBackend *backend)
/* lets reduce pointer dereferences... */
desc = backend->desc;
- if (desc->cancel != NULL) {
+ if (desc->cancel != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_CANCEL);
- }
- if (desc->get_depends != NULL) {
+ if (desc->get_depends != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_DEPENDS);
- }
- if (desc->get_details != NULL) {
+ if (desc->get_details != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_DETAILS);
- }
- if (desc->get_files != NULL) {
+ if (desc->get_files != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_FILES);
- }
- if (desc->get_requires != NULL) {
+ if (desc->get_requires != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_REQUIRES);
- }
- if (desc->get_packages != NULL) {
+ if (desc->get_packages != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_PACKAGES);
- }
- if (desc->what_provides != NULL) {
+ if (desc->what_provides != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_WHAT_PROVIDES);
- }
- if (desc->get_updates != NULL) {
+ if (desc->get_updates != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_UPDATES);
- }
- if (desc->get_update_detail != NULL) {
+ if (desc->get_update_detail != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_UPDATE_DETAIL);
- }
- if (desc->install_packages != NULL) {
+ if (desc->install_packages != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_INSTALL_PACKAGES);
- }
- if (desc->install_files != NULL) {
+ if (desc->install_files != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_INSTALL_FILES);
- }
- if (desc->refresh_cache != NULL) {
+ if (desc->refresh_cache != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_REFRESH_CACHE);
- }
- if (desc->remove_packages != NULL) {
+ if (desc->remove_packages != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_REMOVE_PACKAGES);
- }
- if (desc->download_packages != NULL) {
+ if (desc->download_packages != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_DOWNLOAD_PACKAGES);
- }
- if (desc->resolve != NULL) {
+ if (desc->resolve != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_RESOLVE);
- }
- if (desc->rollback != NULL) {
+ if (desc->rollback != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_ROLLBACK);
- }
- if (desc->search_details != NULL) {
+ if (desc->search_details != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_SEARCH_DETAILS);
- }
- if (desc->search_file != NULL) {
+ if (desc->search_file != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_SEARCH_FILE);
- }
- if (desc->search_group != NULL) {
+ if (desc->search_group != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_SEARCH_GROUP);
- }
- if (desc->search_name != NULL) {
+ if (desc->search_name != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_SEARCH_NAME);
- }
- if (desc->update_packages != NULL) {
+ if (desc->update_packages != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_UPDATE_PACKAGES);
- }
- if (desc->update_system != NULL) {
+ if (desc->update_system != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_UPDATE_SYSTEM);
- }
- if (desc->get_repo_list != NULL) {
+ if (desc->get_repo_list != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_REPO_LIST);
- }
- if (desc->repo_enable != NULL) {
+ if (desc->repo_enable != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_REPO_ENABLE);
- }
- if (desc->repo_set_data != NULL) {
+ if (desc->repo_set_data != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_REPO_SET_DATA);
- }
- if (desc->get_distro_upgrades != NULL) {
+ if (desc->get_distro_upgrades != NULL)
pk_bitfield_add (roles, PK_ROLE_ENUM_GET_DISTRO_UPGRADES);
- }
return roles;
}
@@ -276,9 +248,8 @@ pk_backend_set_string (PkBackend *backend, const gchar *key, const gchar *data)
g_return_val_if_fail (key != NULL, FALSE);
/* valid, but do nothing */
- if (data == NULL) {
+ if (data == NULL)
return FALSE;
- }
/* does already exist? */
value = g_hash_table_lookup (backend->priv->hash_string, (gpointer) key);
@@ -302,9 +273,8 @@ pk_backend_set_strv (PkBackend *backend, const gchar *key, gchar **data)
g_return_val_if_fail (key != NULL, FALSE);
/* valid, but do nothing */
- if (data == NULL) {
+ if (data == NULL)
return FALSE;
- }
/* does already exist? */
value = g_hash_table_lookup (backend->priv->hash_strv, (gpointer) key);
@@ -328,9 +298,8 @@ pk_backend_set_array (PkBackend *backend, const gchar *key, GPtrArray *data)
g_return_val_if_fail (key != NULL, FALSE);
/* valid, but do nothing */
- if (data == NULL) {
+ if (data == NULL)
return FALSE;
- }
/* does already exist? */
value = g_hash_table_lookup (backend->priv->hash_array, (gpointer) key);
@@ -698,9 +667,8 @@ pk_backend_unlock (PkBackend *backend)
egg_warning ("not yet loaded backend, try pk_backend_lock()");
return FALSE;
}
- if (backend->desc->destroy != NULL) {
+ if (backend->desc->destroy != NULL)
backend->desc->destroy (backend);
- }
backend->priv->locked = FALSE;
return TRUE;
}
@@ -731,9 +699,8 @@ pk_backend_emit_progress_changed (PkBackend *backend)
percentage = backend->priv->last_percentage;
/* have not ever set any value? */
- if (percentage == PK_BACKEND_PERCENTAGE_DEFAULT) {
+ if (percentage == PK_BACKEND_PERCENTAGE_DEFAULT)
percentage = PK_BACKEND_PERCENTAGE_INVALID;
- }
subpercentage = backend->priv->last_subpercentage;
elapsed = pk_time_get_elapsed (backend->priv->time);
remaining = backend->priv->last_remaining;
@@ -1541,9 +1508,8 @@ pk_backend_finished_delay (gpointer data)
PkBackend *backend = PK_BACKEND (data);
/* this wasn't set otherwise, assume success */
- if (backend->priv->exit == PK_EXIT_ENUM_UNKNOWN) {
+ if (backend->priv->exit == PK_EXIT_ENUM_UNKNOWN)
pk_backend_set_exit_code (backend, PK_EXIT_ENUM_SUCCESS);
- }
g_hash_table_remove_all (backend->priv->hash_pointer);
g_hash_table_remove_all (backend->priv->hash_string);
@@ -1644,9 +1610,8 @@ pk_backend_not_implemented_yet (PkBackend *backend, const gchar *method)
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
/* this function is only valid when we have a running transaction */
- if (backend->priv->c_tid != NULL) {
+ if (backend->priv->c_tid != NULL)
egg_warning ("only valid when we have a running transaction");
- }
pk_backend_error_code (backend, PK_ERROR_ENUM_NOT_SUPPORTED, "the method '%s' is not implemented yet", method);
/* don't wait, do this now */
pk_backend_finished_delay (backend);
@@ -1700,12 +1665,10 @@ pk_backend_get_backend_detail (PkBackend *backend, gchar **name, gchar **author)
g_return_val_if_fail (backend->desc != NULL, FALSE);
g_return_val_if_fail (backend->priv->locked != FALSE, FALSE);
- if (name != NULL && backend->desc->description != NULL) {
+ if (name != NULL && backend->desc->description != NULL)
*name = g_strdup (backend->desc->description);
- }
- if (author != NULL && backend->desc->author != NULL) {
+ if (author != NULL && backend->desc->author != NULL)
*author = g_strdup (backend->desc->author);
- }
return TRUE;
}
@@ -1768,9 +1731,8 @@ pk_backend_is_eula_valid (PkBackend *backend, const gchar *eula_id)
g_return_val_if_fail (eula_id != NULL, FALSE);
present = g_hash_table_lookup (backend->priv->eulas, eula_id);
- if (present != NULL) {
+ if (present != NULL)
return TRUE;
- }
return FALSE;
}
@@ -1836,9 +1798,8 @@ pk_backend_finalize (GObject *object)
g_hash_table_unref (backend->priv->hash_pointer);
g_hash_table_unref (backend->priv->hash_array);
- if (backend->priv->handle != NULL) {
+ if (backend->priv->handle != NULL)
g_module_close (backend->priv->handle);
- }
egg_debug ("parent_class->finalize");
G_OBJECT_CLASS (pk_backend_parent_class)->finalize (object);
}
@@ -1958,9 +1919,8 @@ pk_backend_reset (PkBackend *backend)
}
/* if we set an error code notifier, clear */
- if (backend->priv->signal_error_timeout != 0) {
+ if (backend->priv->signal_error_timeout != 0)
g_source_remove (backend->priv->signal_error_timeout);
- }
pk_package_obj_free (backend->priv->last_package);
backend->priv->set_error = FALSE;
@@ -2147,27 +2107,24 @@ pk_backend_test (EggTest *test)
data_string = pk_backend_get_string (backend, "dave2");
if (egg_strequal (data_string, ""))
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %s", data_string);
- }
/************************************************************/
egg_test_title (test, "get a ~bool");
data_bool = pk_backend_get_bool (backend, "roger2");
if (!data_bool)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %i", data_bool);
- }
/************************************************************/
egg_test_title (test, "get a zero uint");
data_uint = pk_backend_get_uint (backend, "linda2");
if (data_uint == 0)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %i", data_uint);
- }
/************************************************************/
egg_test_title (test, "set a string");
@@ -2198,27 +2155,24 @@ pk_backend_test (EggTest *test)
data_string = pk_backend_get_string (backend, "dave");
if (egg_strequal (data_string, "ania"))
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %s", data_string);
- }
/************************************************************/
egg_test_title (test, "get a bool");
data_bool = pk_backend_get_bool (backend, "roger");
if (data_bool)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %i", data_bool);
- }
/************************************************************/
egg_test_title (test, "get a uint");
data_uint = pk_backend_get_uint (backend, "linda");
if (data_uint == 999)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "data was %i", data_uint);
- }
/************************************************************/
egg_test_title (test, "create a config file");
@@ -2234,9 +2188,8 @@ pk_backend_test (EggTest *test)
ret = pk_backend_watch_file (backend, filename, pk_backend_test_watch_file_cb, test);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "eula valid");
- }
/************************************************************/
egg_test_title (test, "change the config file");
@@ -2266,45 +2219,40 @@ pk_backend_test (EggTest *test)
ret = pk_backend_is_eula_valid (backend, "license_foo");
if (!ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "eula valid");
- }
/************************************************************/
egg_test_title (test, "accept eula");
ret = pk_backend_accept_eula (backend, "license_foo");
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "eula was not accepted");
- }
/************************************************************/
egg_test_title (test, "get eula that does exist");
ret = pk_backend_is_eula_valid (backend, "license_foo");
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "eula valid");
- }
/************************************************************/
egg_test_title (test, "accept eula (again)");
ret = pk_backend_accept_eula (backend, "license_foo");
if (!ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "eula was accepted twice");
- }
/************************************************************/
egg_test_title (test, "get backend name");
text = pk_backend_get_name (backend);
if (text == NULL)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "invalid name %s (test suite needs to unref backend?)", text);
- }
g_free (text);
/************************************************************/
@@ -2328,44 +2276,39 @@ pk_backend_test (EggTest *test)
ret = pk_backend_set_name (backend, "dummy");
if (ret == FALSE)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "loaded twice");
- }
/************************************************************/
egg_test_title (test, "lock an valid backend");
ret = pk_backend_lock (backend);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "failed to lock");
- }
/************************************************************/
egg_test_title (test, "lock a backend again");
ret = pk_backend_lock (backend);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "locked twice should succeed");
- }
/************************************************************/
egg_test_title (test, "check we are out of init");
if (backend->priv->during_initialize == FALSE)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "not out of init");
- }
/************************************************************/
egg_test_title (test, "get backend name");
text = pk_backend_get_name (backend);
if (egg_strequal(text, "dummy"))
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "invalid name %s", text);
- }
g_free (text);
/************************************************************/
@@ -2373,52 +2316,46 @@ pk_backend_test (EggTest *test)
ret = pk_backend_unlock (backend);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "failed to unlock");
- }
/************************************************************/
egg_test_title (test, "unlock an valid backend again");
ret = pk_backend_unlock (backend);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "unlocked twice, should succeed");
- }
/************************************************************/
egg_test_title (test, "check we are not finished");
if (backend->priv->finished == FALSE)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "we did not clear finish!");
- }
/************************************************************/
egg_test_title (test, "check we have no error");
if (backend->priv->set_error == FALSE)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "an error has already been set");
- }
/************************************************************/
egg_test_title (test, "lock again");
ret = pk_backend_lock (backend);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "failed to unlock");
- }
/************************************************************/
egg_test_title (test, "wait for a thread to return true");
ret = pk_backend_thread_create (backend, pk_backend_test_func_true);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "wait for a thread failed");
- }
/* wait for Finished */
egg_test_loop_wait (test, 2000);
@@ -2432,9 +2369,8 @@ pk_backend_test (EggTest *test)
ret = pk_backend_thread_create (backend, pk_backend_test_func_immediate_false);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "returned false!");
- }
/* wait for Finished */
egg_test_loop_wait (test, PK_BACKEND_FINISHED_TIMEOUT_GRACE + 100);
@@ -2451,9 +2387,8 @@ pk_backend_test (EggTest *test)
egg_test_title (test, "check we enforce finished after error_code");
if (number_messages == 1)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "we messaged %i times!", number_messages);
- }
g_object_unref (backend);
diff --git a/src/pk-conf.c b/src/pk-conf.c
index 61be525..226934c 100644
--- a/src/pk-conf.c
+++ b/src/pk-conf.c
@@ -181,17 +181,15 @@ pk_conf_init (PkConf *conf)
conf->priv = PK_CONF_GET_PRIVATE (conf);
path = pk_conf_get_filename ();
- if (path == NULL) {
+ if (path == NULL)
egg_error ("config file not found");
- }
egg_debug ("using config file '%s'", path);
conf->priv->keyfile = g_key_file_new ();
ret = g_key_file_load_from_file (conf->priv->keyfile, path,
G_KEY_FILE_NONE, NULL);
g_free (path);
- if (!ret) {
+ if (!ret)
egg_error ("failed to parse config file!");
- }
}
/**
@@ -226,7 +224,6 @@ pk_conf_test (EggTest *test)
if (!egg_test_start (test, "PkConf"))
return;
-
/************************************************************/
egg_test_title (test, "get an instance");
conf = pk_conf_new ();
@@ -238,40 +235,36 @@ pk_conf_test (EggTest *test)
/************************************************************/
egg_test_title (test, "get the default backend");
text = pk_conf_get_string (conf, "DefaultBackend");
- if (text != PK_CONF_VALUE_STRING_MISSING) {
+ if (text != PK_CONF_VALUE_STRING_MISSING)
egg_test_success (test, "got default backend '%s'", text);
- } else {
+ else
egg_test_failed (test, "got NULL!");
- }
g_free (text);
/************************************************************/
egg_test_title (test, "get a string that doesn't exist");
text = pk_conf_get_string (conf, "FooBarBaz");
- if (text == PK_CONF_VALUE_STRING_MISSING) {
+ if (text == PK_CONF_VALUE_STRING_MISSING)
egg_test_success (test, "got NULL", text);
- } else {
+ else
egg_test_failed (test, "got return value '%s'", text);
- }
g_free (text);
/************************************************************/
egg_test_title (test, "get the shutdown timeout");
value = pk_conf_get_int (conf, "ShutdownTimeout");
- if (value != PK_CONF_VALUE_INT_MISSING) {
+ if (value != PK_CONF_VALUE_INT_MISSING)
egg_test_success (test, "got ShutdownTimeout '%i'", value);
- } else {
+ else
egg_test_failed (test, "got %i", value);
- }
/************************************************************/
egg_test_title (test, "get an int that doesn't exist");
value = pk_conf_get_int (conf, "FooBarBaz");
- if (value == PK_CONF_VALUE_INT_MISSING) {
+ if (value == PK_CONF_VALUE_INT_MISSING)
egg_test_success (test, "got %i", value);
- } else {
+ else
egg_test_failed (test, "got return value '%i'", value);
- }
g_object_unref (conf);
diff --git a/src/pk-engine.c b/src/pk-engine.c
index adf2b17..90aa0b4 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -110,7 +110,7 @@ struct PkEnginePrivate
PkFileMonitor *file_monitor;
PkBitfield actions;
PkBitfield groups;
- PkBitfield filters;
+ PkBitfield filters;
guint signal_state_priority_timeout;
guint signal_state_normal_timeout;
};
@@ -361,9 +361,8 @@ pk_engine_state_has_changed (PkEngine *engine, const gchar *reason, GError **err
}
/* don't bombard the user 10 seconds after resuming */
- if (egg_strequal (reason, "resume")) {
+ if (egg_strequal (reason, "resume"))
is_priority = FALSE;
- }
/* are we normal, and already scheduled normal? */
if (!is_priority && engine->priv->signal_state_normal_timeout != 0) {
@@ -380,13 +379,12 @@ pk_engine_state_has_changed (PkEngine *engine, const gchar *reason, GError **err
engine->priv->signal_state_normal_timeout = 0; }
/* wait a little delay in case we get multiple requests */
- if (is_priority) {
+ if (is_priority)
engine->priv->signal_state_priority_timeout = g_timeout_add_seconds (PK_ENGINE_STATE_CHANGED_PRIORITY_TIMEOUT,
pk_engine_state_changed_cb, engine);
- } else {
+ else
engine->priv->signal_state_normal_timeout = g_timeout_add_seconds (PK_ENGINE_STATE_CHANGED_NORMAL_TIMEOUT,
pk_engine_state_changed_cb, engine);
- }
return TRUE;
}
@@ -651,9 +649,8 @@ pk_engine_init (PkEngine *engine)
/* lock database */
ret = pk_backend_lock (engine->priv->backend);
- if (!ret) {
+ if (!ret)
egg_error ("could not lock backend, you need to restart the daemon");
- }
/* we dont need this, just don't keep creating and destroying it */
engine->priv->security = pk_security_new ();
@@ -680,9 +677,8 @@ pk_engine_init (PkEngine *engine)
/* get another connection */
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, NULL);
- if (connection == NULL) {
+ if (connection == NULL)
egg_error ("no connection");
- }
/* add the interface */
engine->priv->notify = pk_notify_new ();
@@ -739,9 +735,8 @@ pk_engine_finalize (GObject *object)
/* unlock if we locked this */
ret = pk_backend_unlock (engine->priv->backend);
- if (!ret) {
+ if (!ret)
egg_warning ("couldn't unlock the backend");
- }
/* if we set an state changed notifier, clear */
if (engine->priv->signal_state_priority_timeout != 0) {
diff --git a/src/pk-spawn.c b/src/pk-spawn.c
index 09a44c8..3df7cd7 100644
--- a/src/pk-spawn.c
+++ b/src/pk-spawn.c
@@ -113,9 +113,8 @@ pk_spawn_emit_whole_lines (PkSpawn *spawn, GString *string)
guint bytes_processed;
/* if nothing then don't emit */
- if (egg_strzero (string->str)) {
+ if (egg_strzero (string->str))
return FALSE;
- }
/* split into lines - the last line may be incomplete */
lines = g_strsplit (string->str, "\n", 0);
@@ -160,7 +159,7 @@ pk_spawn_check_child (PkSpawn *spawn)
pk_spawn_emit_whole_lines (spawn, spawn->priv->stdout_buf);
/* Only print one in twenty times to avoid filling the screen */
- if (limit_printing++ % 20 ==0)
+ if (limit_printing++ % 20 == 0)
egg_debug ("polling child_pid=%i (1/20)", spawn->priv->child_pid);
/* check if the child exited */
@@ -243,6 +242,7 @@ pk_spawn_sigkill_cb (PkSpawn *spawn)
return FALSE;
}
+ /* never repeat */
return FALSE;
}
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 69585b7..a0eb8be 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -216,11 +216,10 @@ pk_time_action_sqlite_callback (void *data, gint argc, gchar **argv, gchar **col
for (i=0; i<argc; i++) {
col = col_name[i];
value = argv[i];
- if (egg_strequal (col, "timespec")) {
+ if (egg_strequal (col, "timespec"))
*timespec = g_strdup (value);
- } else {
+ else
egg_warning ("%s = %s\n", col, value);
- }
}
return 0;
}
@@ -309,13 +308,13 @@ pk_transaction_db_get_list (PkTransactionDb *tdb, guint limit)
g_return_val_if_fail (PK_IS_TRANSACTION_DB (tdb), FALSE);
- if (limit == 0) {
+ if (limit == 0)
statement = g_strdup ("SELECT transaction_id, timespec, succeeded, duration, role, data "
"FROM transactions ORDER BY timespec DESC");
- } else {
+ else
statement = g_strdup_printf ("SELECT transaction_id, timespec, succeeded, duration, role, data "
"FROM transactions ORDER BY timespec DESC LIMIT %i", limit);
- }
+
pk_transaction_db_sql_statement (tdb, statement);
g_free (statement);
@@ -578,23 +577,20 @@ pk_transaction_db_test (EggTest *test)
ret = pk_transaction_db_action_time_reset (db, PK_ROLE_ENUM_REFRESH_CACHE);
if (ret)
egg_test_success (test, NULL);
- else {
+ else
egg_test_failed (test, "failed to reset value");
- }
g_usleep (2*1000*1000);
/************************************************************/
egg_test_title (test, "do we get the correct time");
value = pk_transaction_db_action_time_since (db, PK_ROLE_ENUM_REFRESH_CACHE);
- if (value > 1 && value <= 4) {
+ if (value > 1 && value <= 4)
egg_test_success (test, "failed to get correct time");
- } else {
+ else
egg_test_failed (test, "failed to get correct time, %i", value);
- }
g_object_unref (db);
-
egg_test_end (test);
}
#endif
commit 7e71c81cc3757c64e0ee974255ab483d5e202ddd
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Sep 16 20:14:19 2008 +0100
trivial: remove obsolete file
diff --git a/libpackagekit/README b/libpackagekit/README
deleted file mode 100644
index 1ca01bb..0000000
--- a/libpackagekit/README
+++ /dev/null
@@ -1,4 +0,0 @@
-PkClient Watch a single job for changes
-PkJobList Watch the job list for changes (list of jobs)
-PkTaskList Watch the job list and emit signals for tasks in job list
-
More information about the PackageKit-commit
mailing list