From fidencio at redhat.com Thu Jan 7 13:33:10 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 14:33:10 +0100 Subject: [Libosinfo] [PATCH 1/2] Use GTask instead of GSimpleAsyncResult Message-ID: <1452173591-30001-1-git-send-email-fidencio@redhat.com> Instead of using GSimpleAsyncResult, use the new GTask API, which is much more straightforward. For using the new GTask API, let's bump GLib depency version to 2.36, what is safe based on major distro support: - Debian Jessie: glib-2.42 - RHEL-7.1: glib-2.40 - SLES12: glib-2.38 - Ubuntu LTS 14.04: glib-2.40 --- configure.ac | 1 + osinfo/osinfo_install_script.c | 46 +++++++++++++++++------------------------- osinfo/osinfo_media.c | 32 +++++++++++------------------ osinfo/osinfo_tree.c | 26 +++++++++--------------- 4 files changed, 41 insertions(+), 64 deletions(-) diff --git a/configure.ac b/configure.ac index 4154134..ff3eed3 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) PKG_CHECK_MODULES([GIO], [gio-2.0]) +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.36]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 9ded116..6e2e581 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript } struct _OsinfoInstallScriptGenerateData { - GSimpleAsyncResult *res; + GTask *res; OsinfoOs *os; OsinfoMedia *media; OsinfoInstallConfig *config; @@ -551,7 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate } struct _OsinfoInstallScriptGenerateOutputData { - GSimpleAsyncResult *res; + GTask *res; GCancellable *cancellable; GError *error; GFile *file; @@ -882,7 +882,7 @@ static void osinfo_install_script_template_loaded(GObject *src, NULL, &error)) { g_prefix_error(&error, _("Failed to load script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } @@ -897,15 +897,13 @@ static void osinfo_install_script_template_loaded(GObject *src, data->config, &error)) { g_prefix_error(&error, _("Failed to apply script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); + g_task_return_pointer(data->res, output, NULL); cleanup: - g_simple_async_result_complete(data->res); osinfo_install_script_generate_data_free(data); g_free(uri); } @@ -934,10 +932,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->media = g_object_ref(media); data->config = g_object_ref(config); data->script = g_object_ref(script); - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); if (templateData) { GError *error = NULL; @@ -952,14 +950,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->config, &error)) { g_prefix_error(&error, "%s", _("Failed to apply script template: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); osinfo_install_script_generate_data_free(data); return; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, output, NULL); osinfo_install_script_generate_data_free(data); } else { GFile *file = g_file_new_for_uri(templateUri); @@ -1007,14 +1002,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** @@ -1132,9 +1124,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, res, &data->error); - g_simple_async_result_set_op_res_gpointer(data->res, - data->file, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, data->file, NULL); osinfo_install_script_generate_output_data_free(data); } @@ -1338,10 +1328,10 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri OsinfoInstallScriptGenerateSyncData *data_sync = user_data; - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_output_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); data->cancellable = cancellable; data->error = data_sync->error; diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index 7ff48a9..6c4ade0 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -78,7 +78,7 @@ struct _CreateFromLocationAsyncData { gint priority; GCancellable *cancellable; - GSimpleAsyncResult *res; + GTask *res; PrimaryVolumeDescriptor pvd; SupplementaryVolumeDescriptor svd; @@ -760,10 +760,9 @@ static void on_svd_read(GObject *source, EXIT: if (error != NULL) - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); else - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); - g_simple_async_result_complete(data->res); + g_task_return_pointer(data->res, media, NULL); g_object_unref(stream); create_from_location_async_data_free(data); @@ -834,8 +833,7 @@ static void on_pvd_read(GObject *source, return; ON_ERROR: - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); } @@ -857,8 +855,7 @@ static void on_location_skipped(GObject *source, OSINFO_MEDIA_ERROR, OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, _("No volume descriptors")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -889,8 +886,7 @@ static void on_location_read(GObject *source, stream = g_file_read_finish(G_FILE(source), res, &error); if (error != NULL) { g_prefix_error(&error, _("Failed to open file")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -925,11 +921,10 @@ void osinfo_media_create_from_location_async(const gchar *location, g_return_if_fail(location != NULL); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_media_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); data->file = g_file_new_for_commandline_arg(location); data->priority = priority; data->cancellable = cancellable; @@ -953,14 +948,11 @@ void osinfo_media_create_from_location_async(const gchar *location, OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 55c572e..a608edc 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -39,7 +39,7 @@ struct _CreateFromLocationAsyncData { gint priority; GCancellable *cancellable; - GSimpleAsyncResult *res; + GTask *res; OsinfoTree *tree; }; @@ -604,8 +604,7 @@ static void on_location_read(GObject *source, NULL, &error)) { g_prefix_error(&error, _("Failed to load .treeinfo file: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; } @@ -615,14 +614,13 @@ static void on_location_read(GObject *source, length, &error))) { g_prefix_error(&error, _("Failed to process keyinfo file: ")); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); + g_task_return_pointer(data->res, ret, NULL); cleanup: - g_simple_async_result_complete(data->res); create_from_location_async_data_free(data); g_free(content); } @@ -651,11 +649,10 @@ void osinfo_tree_create_from_location_async(const gchar *location, treeinfo = g_strdup_printf("%s/.treeinfo", location); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_tree_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); data->file = g_file_new_for_uri(treeinfo); data->location = g_strdup(location); data->priority = priority; @@ -685,14 +682,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** -- 2.5.0 From fidencio at redhat.com Thu Jan 7 13:33:11 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 14:33:11 +0100 Subject: [Libosinfo] [PATCH 2/2] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <1452173591-30001-1-git-send-email-fidencio@redhat.com> References: <1452173591-30001-1-git-send-email-fidencio@redhat.com> Message-ID: <1452173591-30001-2-git-send-email-fidencio@redhat.com> As now we depend on GLib 2.36, let's remove all checks/code that depend on an older version than the one we require. --- test/test-db.c | 4 ---- test/test-device.c | 4 ---- test/test-devicelist.c | 4 ---- test/test-entity.c | 4 ---- test/test-filter.c | 4 ---- test/test-install-script.c | 4 ---- test/test-isodetect.c | 4 ---- test/test-list.c | 4 ---- test/test-loader.c | 4 ---- test/test-mediauris.c | 4 ---- test/test-os.c | 4 ---- test/test-oslist.c | 4 ---- test/test-platform.c | 4 ---- test/test-platformlist.c | 4 ---- test/test-product.c | 4 ---- test/test-productfilter.c | 4 ---- test/test-treeuris.c | 4 ---- tools/osinfo-db-validate.c | 4 ---- tools/osinfo-detect.c | 4 ---- tools/osinfo-install-script.c | 4 ---- tools/osinfo-query.c | 4 ---- 21 files changed, 84 deletions(-) diff --git a/test/test-db.c b/test/test-db.c index df586f6..efb9fd4 100644 --- a/test/test-db.c +++ b/test/test-db.c @@ -422,10 +422,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-device.c b/test/test-device.c index 72f8e8c..a410e37 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -55,10 +55,6 @@ int main(void) Suite *s = device_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); diff --git a/test/test-devicelist.c b/test/test-devicelist.c index 02f0ff7..f06efcd 100644 --- a/test/test-devicelist.c +++ b/test/test-devicelist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_devicelist_get_type(); diff --git a/test/test-entity.c b/test/test-entity.c index 03dc570..3629e5b 100644 --- a/test/test-entity.c +++ b/test/test-entity.c @@ -335,10 +335,6 @@ int main(void) Suite *s = entity_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); diff --git a/test/test-filter.c b/test/test-filter.c index aa4fb72..fc50357 100644 --- a/test/test-filter.c +++ b/test/test-filter.c @@ -172,10 +172,6 @@ int main(void) Suite *s = filter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_filter_get_type(); diff --git a/test/test-install-script.c b/test/test-install-script.c index 4d994e7..08d7f76 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -327,10 +327,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-isodetect.c b/test/test-isodetect.c index 3590205..0ca00f9 100644 --- a/test/test-isodetect.c +++ b/test/test-isodetect.c @@ -481,10 +481,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-list.c b/test/test-list.c index fac27b5..007c362 100644 --- a/test/test-list.c +++ b/test/test-list.c @@ -414,10 +414,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); osinfo_dummy_list_get_type(); diff --git a/test/test-loader.c b/test/test-loader.c index 0f83b49..8f796d8 100644 --- a/test/test-loader.c +++ b/test/test-loader.c @@ -55,10 +55,6 @@ int main(void) Suite *s = loader_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-mediauris.c b/test/test-mediauris.c index b2fede2..b73dcbc 100644 --- a/test/test-mediauris.c +++ b/test/test-mediauris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-os.c b/test/test-os.c index 8ee2403..604b289 100644 --- a/test/test-os.c +++ b/test/test-os.c @@ -213,10 +213,6 @@ int main(void) Suite *s = os_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-oslist.c b/test/test-oslist.c index 765d546..71d55a4 100644 --- a/test/test-oslist.c +++ b/test/test-oslist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_os_get_type(); osinfo_oslist_get_type(); diff --git a/test/test-platform.c b/test/test-platform.c index 6f05b83..80b28db 100644 --- a/test/test-platform.c +++ b/test/test-platform.c @@ -131,10 +131,6 @@ int main(void) Suite *s = platform_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-platformlist.c b/test/test-platformlist.c index e1b1d13..ec53549 100644 --- a/test/test-platformlist.c +++ b/test/test-platformlist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_platformlist_get_type(); diff --git a/test/test-product.c b/test/test-product.c index f6b30fa..1e4e2d6 100644 --- a/test/test-product.c +++ b/test/test-product.c @@ -205,10 +205,6 @@ int main(void) Suite *s = product_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-productfilter.c b/test/test-productfilter.c index 57d6fc4..8e1fed8 100644 --- a/test/test-productfilter.c +++ b/test/test-productfilter.c @@ -243,10 +243,6 @@ int main(void) Suite *s = productfilter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_filter_get_type(); diff --git a/test/test-treeuris.c b/test/test-treeuris.c index 9176919..0ddfe4f 100644 --- a/test/test-treeuris.c +++ b/test/test-treeuris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c index f53aebe..965ed0e 100644 --- a/tools/osinfo-db-validate.c +++ b/tools/osinfo-db-validate.c @@ -256,10 +256,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - context = g_option_context_new(_("- Validate XML documents ")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c index fae7b21..2e5af97 100644 --- a/tools/osinfo-detect.c +++ b/tools/osinfo-detect.c @@ -240,10 +240,6 @@ gint main(gint argc, gchar **argv) goto EXIT; } -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - loader = osinfo_loader_new(); osinfo_loader_process_default_path(loader, &error); if (error != NULL) { diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c index b924cd9..915d07e 100644 --- a/tools/osinfo-install-script.c +++ b/tools/osinfo-install-script.c @@ -304,10 +304,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - config = osinfo_install_config_new("http://libosinfo.fedorahosted.org/config"); context = g_option_context_new(_("- Generate an OS install script")); diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c index 43ded4f..66f49e2 100644 --- a/tools/osinfo-query.c +++ b/tools/osinfo-query.c @@ -366,10 +366,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - struct OsinfoType types[] = { { "os", (osinfo_list_func)osinfo_db_get_os_list, -- 2.5.0 From cfergeau at redhat.com Thu Jan 7 14:14:12 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 7 Jan 2016 15:14:12 +0100 Subject: [Libosinfo] [PATCH 2/2] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <1452173591-30001-2-git-send-email-fidencio@redhat.com> References: <1452173591-30001-1-git-send-email-fidencio@redhat.com> <1452173591-30001-2-git-send-email-fidencio@redhat.com> Message-ID: <20160107141412.GU29984@edamame.cdg.redhat.com> On Thu, Jan 07, 2016 at 02:33:11PM +0100, Fabiano Fid?ncio wrote: > As now we depend on GLib 2.36, let's remove all checks/code that depend > on an older version than the one we require. Might be a good opportunity to also add some handling of GLIB_VERSION_MAX_ALLOWED ? Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From fidencio at redhat.com Thu Jan 7 14:20:20 2016 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 15:20:20 +0100 Subject: [Libosinfo] [PATCH 2/2] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <20160107141412.GU29984@edamame.cdg.redhat.com> References: <1452173591-30001-1-git-send-email-fidencio@redhat.com> <1452173591-30001-2-git-send-email-fidencio@redhat.com> <20160107141412.GU29984@edamame.cdg.redhat.com> Message-ID: On Thu, Jan 7, 2016 at 3:14 PM, Christophe Fergeau wrote: > On Thu, Jan 07, 2016 at 02:33:11PM +0100, Fabiano Fid?ncio wrote: >> As now we depend on GLib 2.36, let's remove all checks/code that depend >> on an older version than the one we require. > > Might be a good opportunity to also add some handling of > GLIB_VERSION_MAX_ALLOWED ? Indeed. What should be the max allowed version? Would you mind to have it in a separate patch? > > Christophe From cfergeau at redhat.com Thu Jan 7 14:25:40 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 7 Jan 2016 15:25:40 +0100 Subject: [Libosinfo] [PATCH 2/2] Remove checks/code for GLib older than 2.35.1 In-Reply-To: References: <1452173591-30001-1-git-send-email-fidencio@redhat.com> <1452173591-30001-2-git-send-email-fidencio@redhat.com> <20160107141412.GU29984@edamame.cdg.redhat.com> Message-ID: <20160107142540.GV29984@edamame.cdg.redhat.com> On Thu, Jan 07, 2016 at 03:20:20PM +0100, Fabiano Fid?ncio wrote: > On Thu, Jan 7, 2016 at 3:14 PM, Christophe Fergeau wrote: > > On Thu, Jan 07, 2016 at 02:33:11PM +0100, Fabiano Fid?ncio wrote: > >> As now we depend on GLib 2.36, let's remove all checks/code that depend > >> on an older version than the one we require. > > > > Might be a good opportunity to also add some handling of > > GLIB_VERSION_MAX_ALLOWED ? > > Indeed. What should be the max allowed version? Would you mind to have > it in a separate patch? Separate patch is fine, max version would be 2.36 at this point I guess. NB: GLIB_VERSION_MAX_ALLOWED can be a bit tricky to deal with in combination with -compat implementations of newer glib API, but so far libosinfo does not have these, so it should be fine for now. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From fidencio at redhat.com Thu Jan 7 17:54:37 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 18:54:37 +0100 Subject: [Libosinfo] [PATCH v2 1/5] Use GTask instead of GSimpleAsyncResult Message-ID: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Instead of using GSimpleAsyncResult, use the new GTask API, which is much more straightforward. For using the new GTask API, let's bump GLib depency version to 2.36, what is safe based on major distro support: - Debian Jessie: glib-2.42 - RHEL-7.1: glib-2.40 - SLES12: glib-2.38 - Ubuntu LTS 14.04: glib-2.40 --- configure.ac | 1 + osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- osinfo/osinfo_tree.c | 34 +++++++++--------------- 4 files changed, 57 insertions(+), 90 deletions(-) diff --git a/configure.ac b/configure.ac index 4154134..ff3eed3 100644 --- a/configure.ac +++ b/configure.ac @@ -38,6 +38,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) PKG_CHECK_MODULES([GIO], [gio-2.0]) +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.36]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 9ded116..7f0d863 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript } struct _OsinfoInstallScriptGenerateData { - GSimpleAsyncResult *res; + GTask *res; OsinfoOs *os; OsinfoMedia *media; OsinfoInstallConfig *config; @@ -551,8 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate } struct _OsinfoInstallScriptGenerateOutputData { - GSimpleAsyncResult *res; - GCancellable *cancellable; + GTask *res; GError *error; GFile *file; GFileOutputStream *stream; @@ -882,7 +881,7 @@ static void osinfo_install_script_template_loaded(GObject *src, NULL, &error)) { g_prefix_error(&error, _("Failed to load script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } @@ -897,15 +896,13 @@ static void osinfo_install_script_template_loaded(GObject *src, data->config, &error)) { g_prefix_error(&error, _("Failed to apply script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); + g_task_return_pointer(data->res, output, NULL); cleanup: - g_simple_async_result_complete(data->res); osinfo_install_script_generate_data_free(data); g_free(uri); } @@ -934,10 +931,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->media = g_object_ref(media); data->config = g_object_ref(config); data->script = g_object_ref(script); - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); if (templateData) { GError *error = NULL; @@ -952,14 +949,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->config, &error)) { g_prefix_error(&error, "%s", _("Failed to apply script template: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); osinfo_install_script_generate_data_free(data); return; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, output, NULL); osinfo_install_script_generate_data_free(data); } else { GFile *file = g_file_new_for_uri(templateUri); @@ -1007,14 +1001,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** @@ -1132,9 +1123,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, res, &data->error); - g_simple_async_result_set_op_res_gpointer(data->res, - data->file, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, data->file, NULL); osinfo_install_script_generate_output_data_free(data); } @@ -1309,14 +1298,14 @@ static void osinfo_install_script_generate_output_write_file(GObject *src, data->output + data->output_pos, data->output_len - data->output_pos, G_PRIORITY_DEFAULT, - data->cancellable, + g_task_get_cancellable(data->res), osinfo_install_script_generate_output_write_file, data); } else { g_output_stream_close_async(G_OUTPUT_STREAM(data->stream), G_PRIORITY_DEFAULT, - data->cancellable, + g_task_get_cancellable(data->res), osinfo_install_script_generate_output_close_file, data); } @@ -1338,12 +1327,11 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri OsinfoInstallScriptGenerateSyncData *data_sync = user_data; - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_output_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); - data->cancellable = cancellable; data->error = data_sync->error; if (media != NULL) { data->output = osinfo_install_script_generate_for_media(script, diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index 7ff48a9..d9fcba6 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -75,10 +75,7 @@ typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData; struct _CreateFromLocationAsyncData { GFile *file; - gint priority; - GCancellable *cancellable; - - GSimpleAsyncResult *res; + GTask *res; PrimaryVolumeDescriptor pvd; SupplementaryVolumeDescriptor svd; @@ -91,7 +88,6 @@ static void create_from_location_async_data_free (CreateFromLocationAsyncData *data) { g_object_unref(data->file); - g_clear_object(&data->cancellable); g_object_unref(data->res); g_slice_free(CreateFromLocationAsyncData, data); @@ -707,8 +703,8 @@ static void on_svd_read(GObject *source, g_input_stream_read_async(stream, ((gchar *)&data->svd + data->offset), data->length - data->offset, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_svd_read, data); return; @@ -760,10 +756,9 @@ static void on_svd_read(GObject *source, EXIT: if (error != NULL) - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); else - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); - g_simple_async_result_complete(data->res); + g_task_return_pointer(data->res, media, NULL); g_object_unref(stream); create_from_location_async_data_free(data); @@ -800,8 +795,8 @@ static void on_pvd_read(GObject *source, g_input_stream_read_async(stream, ((gchar*)&data->pvd) + data->offset, data->length - data->offset, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_pvd_read, data); return; @@ -827,15 +822,14 @@ static void on_pvd_read(GObject *source, g_input_stream_read_async(stream, (gchar *)&data->svd, data->length, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_svd_read, data); return; ON_ERROR: - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); } @@ -857,8 +851,7 @@ static void on_location_skipped(GObject *source, OSINFO_MEDIA_ERROR, OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, _("No volume descriptors")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -870,8 +863,8 @@ static void on_location_skipped(GObject *source, g_input_stream_read_async(stream, (gchar *)&data->pvd, data->length, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_pvd_read, data); } @@ -889,8 +882,7 @@ static void on_location_read(GObject *source, stream = g_file_read_finish(G_FILE(source), res, &error); if (error != NULL) { g_prefix_error(&error, _("Failed to open file")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -898,8 +890,8 @@ static void on_location_read(GObject *source, g_input_stream_skip_async(G_INPUT_STREAM(stream), PVD_OFFSET, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_location_skipped, data); } @@ -925,14 +917,13 @@ void osinfo_media_create_from_location_async(const gchar *location, g_return_if_fail(location != NULL); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_media_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); + g_task_set_priority(data->res, priority); + data->file = g_file_new_for_commandline_arg(location); - data->priority = priority; - data->cancellable = cancellable; g_file_read_async(data->file, priority, cancellable, @@ -953,14 +944,11 @@ void osinfo_media_create_from_location_async(const gchar *location, OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 55c572e..c80c62d 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -36,10 +36,7 @@ struct _CreateFromLocationAsyncData { GFile *file; gchar *location; - gint priority; - GCancellable *cancellable; - - GSimpleAsyncResult *res; + GTask *res; OsinfoTree *tree; }; @@ -49,7 +46,6 @@ static void create_from_location_async_data_free(CreateFromLocationAsyncData *da if (data->tree) g_object_unref(data->tree); g_object_unref(data->file); - g_clear_object(&data->cancellable); g_object_unref(data->res); g_slice_free(CreateFromLocationAsyncData, data); @@ -604,8 +600,7 @@ static void on_location_read(GObject *source, NULL, &error)) { g_prefix_error(&error, _("Failed to load .treeinfo file: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; } @@ -615,14 +610,13 @@ static void on_location_read(GObject *source, length, &error))) { g_prefix_error(&error, _("Failed to process keyinfo file: ")); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); + g_task_return_pointer(data->res, ret, NULL); cleanup: - g_simple_async_result_complete(data->res); create_from_location_async_data_free(data); g_free(content); } @@ -651,15 +645,14 @@ void osinfo_tree_create_from_location_async(const gchar *location, treeinfo = g_strdup_printf("%s/.treeinfo", location); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_tree_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); + g_task_set_priority(data->res, priority); + data->file = g_file_new_for_uri(treeinfo); data->location = g_strdup(location); - data->priority = priority; - data->cancellable = cancellable; /* XXX priority ? */ /* XXX probe other things besides just tree info */ @@ -685,14 +678,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** -- 2.5.0 From fidencio at redhat.com Thu Jan 7 17:54:38 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 18:54:38 +0100 Subject: [Libosinfo] [PATCH v2 2/5] tree: Add an identation level for the if block In-Reply-To: <1452189281-10765-1-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Message-ID: <1452189281-10765-2-git-send-email-fidencio@redhat.com> --- osinfo/osinfo_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index c80c62d..6fc62f7 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -44,7 +44,7 @@ struct _CreateFromLocationAsyncData { static void create_from_location_async_data_free(CreateFromLocationAsyncData *data) { if (data->tree) - g_object_unref(data->tree); + g_object_unref(data->tree); g_object_unref(data->file); g_object_unref(data->res); -- 2.5.0 From fidencio at redhat.com Thu Jan 7 17:54:39 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 18:54:39 +0100 Subject: [Libosinfo] [PATCH v2 3/5] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <1452189281-10765-1-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Message-ID: <1452189281-10765-3-git-send-email-fidencio@redhat.com> As now we depend on GLib 2.36, let's remove all checks/code that depend on an older version than the one we require. --- test/test-db.c | 4 ---- test/test-device.c | 4 ---- test/test-devicelist.c | 4 ---- test/test-entity.c | 4 ---- test/test-filter.c | 4 ---- test/test-install-script.c | 4 ---- test/test-isodetect.c | 4 ---- test/test-list.c | 4 ---- test/test-loader.c | 4 ---- test/test-mediauris.c | 4 ---- test/test-os.c | 4 ---- test/test-oslist.c | 4 ---- test/test-platform.c | 4 ---- test/test-platformlist.c | 4 ---- test/test-product.c | 4 ---- test/test-productfilter.c | 4 ---- test/test-treeuris.c | 4 ---- tools/osinfo-db-validate.c | 4 ---- tools/osinfo-detect.c | 4 ---- tools/osinfo-install-script.c | 4 ---- tools/osinfo-query.c | 4 ---- 21 files changed, 84 deletions(-) diff --git a/test/test-db.c b/test/test-db.c index df586f6..efb9fd4 100644 --- a/test/test-db.c +++ b/test/test-db.c @@ -422,10 +422,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-device.c b/test/test-device.c index 72f8e8c..a410e37 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -55,10 +55,6 @@ int main(void) Suite *s = device_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); diff --git a/test/test-devicelist.c b/test/test-devicelist.c index 02f0ff7..f06efcd 100644 --- a/test/test-devicelist.c +++ b/test/test-devicelist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_devicelist_get_type(); diff --git a/test/test-entity.c b/test/test-entity.c index 03dc570..3629e5b 100644 --- a/test/test-entity.c +++ b/test/test-entity.c @@ -335,10 +335,6 @@ int main(void) Suite *s = entity_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); diff --git a/test/test-filter.c b/test/test-filter.c index aa4fb72..fc50357 100644 --- a/test/test-filter.c +++ b/test/test-filter.c @@ -172,10 +172,6 @@ int main(void) Suite *s = filter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_filter_get_type(); diff --git a/test/test-install-script.c b/test/test-install-script.c index 4d994e7..08d7f76 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -327,10 +327,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-isodetect.c b/test/test-isodetect.c index 3590205..0ca00f9 100644 --- a/test/test-isodetect.c +++ b/test/test-isodetect.c @@ -481,10 +481,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-list.c b/test/test-list.c index fac27b5..007c362 100644 --- a/test/test-list.c +++ b/test/test-list.c @@ -414,10 +414,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); osinfo_dummy_list_get_type(); diff --git a/test/test-loader.c b/test/test-loader.c index 0f83b49..8f796d8 100644 --- a/test/test-loader.c +++ b/test/test-loader.c @@ -55,10 +55,6 @@ int main(void) Suite *s = loader_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-mediauris.c b/test/test-mediauris.c index b2fede2..b73dcbc 100644 --- a/test/test-mediauris.c +++ b/test/test-mediauris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-os.c b/test/test-os.c index 8ee2403..604b289 100644 --- a/test/test-os.c +++ b/test/test-os.c @@ -213,10 +213,6 @@ int main(void) Suite *s = os_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-oslist.c b/test/test-oslist.c index 765d546..71d55a4 100644 --- a/test/test-oslist.c +++ b/test/test-oslist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_os_get_type(); osinfo_oslist_get_type(); diff --git a/test/test-platform.c b/test/test-platform.c index 6f05b83..80b28db 100644 --- a/test/test-platform.c +++ b/test/test-platform.c @@ -131,10 +131,6 @@ int main(void) Suite *s = platform_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-platformlist.c b/test/test-platformlist.c index e1b1d13..ec53549 100644 --- a/test/test-platformlist.c +++ b/test/test-platformlist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_platformlist_get_type(); diff --git a/test/test-product.c b/test/test-product.c index f6b30fa..1e4e2d6 100644 --- a/test/test-product.c +++ b/test/test-product.c @@ -205,10 +205,6 @@ int main(void) Suite *s = product_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-productfilter.c b/test/test-productfilter.c index 57d6fc4..8e1fed8 100644 --- a/test/test-productfilter.c +++ b/test/test-productfilter.c @@ -243,10 +243,6 @@ int main(void) Suite *s = productfilter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_filter_get_type(); diff --git a/test/test-treeuris.c b/test/test-treeuris.c index 9176919..0ddfe4f 100644 --- a/test/test-treeuris.c +++ b/test/test-treeuris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c index f53aebe..965ed0e 100644 --- a/tools/osinfo-db-validate.c +++ b/tools/osinfo-db-validate.c @@ -256,10 +256,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - context = g_option_context_new(_("- Validate XML documents ")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c index fae7b21..2e5af97 100644 --- a/tools/osinfo-detect.c +++ b/tools/osinfo-detect.c @@ -240,10 +240,6 @@ gint main(gint argc, gchar **argv) goto EXIT; } -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - loader = osinfo_loader_new(); osinfo_loader_process_default_path(loader, &error); if (error != NULL) { diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c index b924cd9..915d07e 100644 --- a/tools/osinfo-install-script.c +++ b/tools/osinfo-install-script.c @@ -304,10 +304,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - config = osinfo_install_config_new("http://libosinfo.fedorahosted.org/config"); context = g_option_context_new(_("- Generate an OS install script")); diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c index 43ded4f..66f49e2 100644 --- a/tools/osinfo-query.c +++ b/tools/osinfo-query.c @@ -366,10 +366,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - struct OsinfoType types[] = { { "os", (osinfo_list_func)osinfo_db_get_os_list, -- 2.5.0 From fidencio at redhat.com Thu Jan 7 17:54:40 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 18:54:40 +0100 Subject: [Libosinfo] [PATCH v2 4/5] Use GLIB_VERSION_MAX_ALLOWED In-Reply-To: <1452189281-10765-1-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Message-ID: <1452189281-10765-4-git-send-email-fidencio@redhat.com> In order to avoid using a too new GLib API. --- configure.ac | 11 ++++++++++- osinfo/Makefile.am | 2 ++ test/Makefile.am | 2 ++ tools/Makefile.am | 5 +++++ 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index ff3eed3..c280b2a 100644 --- a/configure.ac +++ b/configure.ac @@ -36,13 +36,22 @@ m4_if(m4_version_compare([2.61a.100], # Use the silent-rules feature when possible. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) +# Keep these two definitions in agreement. +m4_define([glib_minimum_version], [2.36]) +m4_define([glib_encoded_version], [GLIB_VERSION_2_36]) + PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) PKG_CHECK_MODULES([GIO], [gio-2.0]) -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.36]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= glib_minimum_version]) +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=glib_encoded_version" +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=glib_encoded_version" +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + GTK_DOC_CHECK([1.10],[--flavour no-tmpl]) AC_ARG_ENABLE([tests], diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index c07d362..c4f29a4 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -34,6 +34,7 @@ libosinfo_1_0_la_CFLAGS = \ $(LIBXML_CFLAGS) \ $(LIBXSLT_CFLAGS) \ $(GOBJECT_CFLAGS) \ + $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ -DPKG_DATA_DIR='"$(pkgdatadir)"' \ -DSYS_CONF_DIR='"$(sysconfdir)"' \ @@ -44,6 +45,7 @@ libosinfo_1_0_la_LIBADD = \ $(LIBXML_LIBS) \ $(LIBXSLT_LIBS) \ $(GOBJECT_LIBS) \ + $(GLIB_LIBS) \ $(GIO_LIBS) libosinfo_1_0_la_LDFLAGS = \ diff --git a/test/Makefile.am b/test/Makefile.am index ef63154..d6504fd 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -23,6 +23,7 @@ check_PROGRAMS = \ COMMON_LDADD = \ $(COVERAGE_LDFLAGS) \ + $(GLIB_LIBS) \ $(GOBJECT_LIBS) \ $(SOUP_LIBS) \ $(CHECK_LIBS) \ @@ -30,6 +31,7 @@ COMMON_LDADD = \ COMMON_CFLAGS = \ $(WARN_CFLAGS) \ $(COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ $(GOBJECT_CFLAGS) \ $(SOUP_CFLAGS) \ -I$(top_srcdir) \ diff --git a/tools/Makefile.am b/tools/Makefile.am index a064dce..7f7249f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = $(GOBJECT_CFLAGS) \ $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(LIBXML_CFLAGS) \ -DPKGDATADIR="\"$(pkgdatadir)\"" \ -DLOCALEDIR="\"$(datadir)/locale\"" \ @@ -21,22 +22,26 @@ POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" osinfo_detect_SOURCES = osinfo-detect.c osinfo_detect_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_db_validate_SOURCES = osinfo-db-validate.c osinfo_db_validate_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_query_SOURCES = osinfo-query.c osinfo_query_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_install_script_SOURCES = osinfo-install-script.c osinfo_install_script_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la -- 2.5.0 From fidencio at redhat.com Thu Jan 7 17:54:41 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Thu, 7 Jan 2016 18:54:41 +0100 Subject: [Libosinfo] [PATCH v2 5/5] Use SOUP_VERSION_MAX_ALLOWED In-Reply-To: <1452189281-10765-1-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Message-ID: <1452189281-10765-5-git-send-email-fidencio@redhat.com> In order to avoid using a too new libsoup API. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c280b2a..c2215cf 100644 --- a/configure.ac +++ b/configure.ac @@ -40,9 +40,12 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) m4_define([glib_minimum_version], [2.36]) m4_define([glib_encoded_version], [GLIB_VERSION_2_36]) +# Keep these two definitions in agreement. +m4_define([soup_minimum_version], [2.42]) +m4_define([soup_encoded_version], [SOUP_VERSION_2_42]) + PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) PKG_CHECK_MODULES([GIO], [gio-2.0]) -PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) @@ -52,6 +55,12 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=glib_encoded_version" AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) +PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= soup_minimum_version]) +SOUP_CFLAGS="$SOUP_CFLAGS -DSOUP_VERSION_MIN_REQUIRED=soup_encoded_version" +SOUP_CFLAGS="$SOUP_CFLAGS -DSOUP_VERSION_MAX_ALLOWED=soup_encoded_version" +AC_SUBST(SOUP_CFLAGS) +AC_SUBST(SOUP_LIBS) + GTK_DOC_CHECK([1.10],[--flavour no-tmpl]) AC_ARG_ENABLE([tests], -- 2.5.0 From cfergeau at redhat.com Fri Jan 8 09:38:35 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 8 Jan 2016 10:38:35 +0100 Subject: [Libosinfo] [PATCH v2 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: <1452189281-10765-1-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> Message-ID: <20160108093835.GB29984@edamame.cdg.redhat.com> On Thu, Jan 07, 2016 at 06:54:37PM +0100, Fabiano Fid?ncio wrote: > Instead of using GSimpleAsyncResult, use the new GTask API, which is > much more straightforward. > For using the new GTask API, let's bump GLib depency version to 2.36, > what is safe based on major distro support: > - Debian Jessie: glib-2.42 > - RHEL-7.1: glib-2.40 > - SLES12: glib-2.38 > - Ubuntu LTS 14.04: glib-2.40 > --- > configure.ac | 1 + > osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- > osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- > osinfo/osinfo_tree.c | 34 +++++++++--------------- > 4 files changed, 57 insertions(+), 90 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 4154134..ff3eed3 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -38,6 +38,7 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) > > PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) > PKG_CHECK_MODULES([GIO], [gio-2.0]) > +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= 2.36]) Strictly speaking, it is gio-2.0 >= 2.36 that we want as GTask is in gio/gtask.h , but this is not going to make a difference anyway... ACK. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 8 09:38:46 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 8 Jan 2016 10:38:46 +0100 Subject: [Libosinfo] [PATCH v2 2/5] tree: Add an identation level for the if block In-Reply-To: <1452189281-10765-2-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> <1452189281-10765-2-git-send-email-fidencio@redhat.com> Message-ID: <20160108093846.GC29984@edamame.cdg.redhat.com> Acked-by: Christophe Fergeau On Thu, Jan 07, 2016 at 06:54:38PM +0100, Fabiano Fid?ncio wrote: > --- > osinfo/osinfo_tree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c > index c80c62d..6fc62f7 100644 > --- a/osinfo/osinfo_tree.c > +++ b/osinfo/osinfo_tree.c > @@ -44,7 +44,7 @@ struct _CreateFromLocationAsyncData { > static void create_from_location_async_data_free(CreateFromLocationAsyncData *data) > { > if (data->tree) > - g_object_unref(data->tree); > + g_object_unref(data->tree); > g_object_unref(data->file); > g_object_unref(data->res); > > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 8 09:39:01 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 8 Jan 2016 10:39:01 +0100 Subject: [Libosinfo] [PATCH v2 3/5] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <1452189281-10765-3-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> <1452189281-10765-3-git-send-email-fidencio@redhat.com> Message-ID: <20160108093901.GD29984@edamame.cdg.redhat.com> Acked-by: Christophe Fergeau On Thu, Jan 07, 2016 at 06:54:39PM +0100, Fabiano Fid?ncio wrote: > As now we depend on GLib 2.36, let's remove all checks/code that depend > on an older version than the one we require. > --- > test/test-db.c | 4 ---- > test/test-device.c | 4 ---- > test/test-devicelist.c | 4 ---- > test/test-entity.c | 4 ---- > test/test-filter.c | 4 ---- > test/test-install-script.c | 4 ---- > test/test-isodetect.c | 4 ---- > test/test-list.c | 4 ---- > test/test-loader.c | 4 ---- > test/test-mediauris.c | 4 ---- > test/test-os.c | 4 ---- > test/test-oslist.c | 4 ---- > test/test-platform.c | 4 ---- > test/test-platformlist.c | 4 ---- > test/test-product.c | 4 ---- > test/test-productfilter.c | 4 ---- > test/test-treeuris.c | 4 ---- > tools/osinfo-db-validate.c | 4 ---- > tools/osinfo-detect.c | 4 ---- > tools/osinfo-install-script.c | 4 ---- > tools/osinfo-query.c | 4 ---- > 21 files changed, 84 deletions(-) > > diff --git a/test/test-db.c b/test/test-db.c > index df586f6..efb9fd4 100644 > --- a/test/test-db.c > +++ b/test/test-db.c > @@ -422,10 +422,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/test/test-device.c b/test/test-device.c > index 72f8e8c..a410e37 100644 > --- a/test/test-device.c > +++ b/test/test-device.c > @@ -55,10 +55,6 @@ int main(void) > Suite *s = device_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_device_get_type(); > > diff --git a/test/test-devicelist.c b/test/test-devicelist.c > index 02f0ff7..f06efcd 100644 > --- a/test/test-devicelist.c > +++ b/test/test-devicelist.c > @@ -224,10 +224,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_device_get_type(); > osinfo_devicelist_get_type(); > diff --git a/test/test-entity.c b/test/test-entity.c > index 03dc570..3629e5b 100644 > --- a/test/test-entity.c > +++ b/test/test-entity.c > @@ -335,10 +335,6 @@ int main(void) > Suite *s = entity_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_dummy_get_type(); > > diff --git a/test/test-filter.c b/test/test-filter.c > index aa4fb72..fc50357 100644 > --- a/test/test-filter.c > +++ b/test/test-filter.c > @@ -172,10 +172,6 @@ int main(void) > Suite *s = filter_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_device_get_type(); > osinfo_filter_get_type(); > diff --git a/test/test-install-script.c b/test/test-install-script.c > index 4d994e7..08d7f76 100644 > --- a/test/test-install-script.c > +++ b/test/test-install-script.c > @@ -327,10 +327,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/test/test-isodetect.c b/test/test-isodetect.c > index 3590205..0ca00f9 100644 > --- a/test/test-isodetect.c > +++ b/test/test-isodetect.c > @@ -481,10 +481,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/test/test-list.c b/test/test-list.c > index fac27b5..007c362 100644 > --- a/test/test-list.c > +++ b/test/test-list.c > @@ -414,10 +414,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_dummy_get_type(); > osinfo_dummy_list_get_type(); > diff --git a/test/test-loader.c b/test/test-loader.c > index 0f83b49..8f796d8 100644 > --- a/test/test-loader.c > +++ b/test/test-loader.c > @@ -55,10 +55,6 @@ int main(void) > Suite *s = loader_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/test/test-mediauris.c b/test/test-mediauris.c > index b2fede2..b73dcbc 100644 > --- a/test/test-mediauris.c > +++ b/test/test-mediauris.c > @@ -128,10 +128,6 @@ int main(void) > if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) > return 77; /* Skip */ > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/test/test-os.c b/test/test-os.c > index 8ee2403..604b289 100644 > --- a/test/test-os.c > +++ b/test/test-os.c > @@ -213,10 +213,6 @@ int main(void) > Suite *s = os_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_platform_get_type(); > osinfo_device_get_type(); > diff --git a/test/test-oslist.c b/test/test-oslist.c > index 765d546..71d55a4 100644 > --- a/test/test-oslist.c > +++ b/test/test-oslist.c > @@ -224,10 +224,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_os_get_type(); > osinfo_oslist_get_type(); > diff --git a/test/test-platform.c b/test/test-platform.c > index 6f05b83..80b28db 100644 > --- a/test/test-platform.c > +++ b/test/test-platform.c > @@ -131,10 +131,6 @@ int main(void) > Suite *s = platform_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_platform_get_type(); > osinfo_device_get_type(); > diff --git a/test/test-platformlist.c b/test/test-platformlist.c > index e1b1d13..ec53549 100644 > --- a/test/test-platformlist.c > +++ b/test/test-platformlist.c > @@ -224,10 +224,6 @@ int main(void) > Suite *s = list_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_platform_get_type(); > osinfo_platformlist_get_type(); > diff --git a/test/test-product.c b/test/test-product.c > index f6b30fa..1e4e2d6 100644 > --- a/test/test-product.c > +++ b/test/test-product.c > @@ -205,10 +205,6 @@ int main(void) > Suite *s = product_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_platform_get_type(); > osinfo_device_get_type(); > diff --git a/test/test-productfilter.c b/test/test-productfilter.c > index 57d6fc4..8e1fed8 100644 > --- a/test/test-productfilter.c > +++ b/test/test-productfilter.c > @@ -243,10 +243,6 @@ int main(void) > Suite *s = productfilter_suite(); > SRunner *sr = srunner_create(s); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_filter_get_type(); > diff --git a/test/test-treeuris.c b/test/test-treeuris.c > index 9176919..0ddfe4f 100644 > --- a/test/test-treeuris.c > +++ b/test/test-treeuris.c > @@ -128,10 +128,6 @@ int main(void) > if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) > return 77; /* Skip */ > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > /* Upfront so we don't confuse valgrind */ > osinfo_entity_get_type(); > osinfo_db_get_type(); > diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c > index f53aebe..965ed0e 100644 > --- a/tools/osinfo-db-validate.c > +++ b/tools/osinfo-db-validate.c > @@ -256,10 +256,6 @@ gint main(gint argc, gchar **argv) > bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); > bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > context = g_option_context_new(_("- Validate XML documents ")); > > g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); > diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c > index fae7b21..2e5af97 100644 > --- a/tools/osinfo-detect.c > +++ b/tools/osinfo-detect.c > @@ -240,10 +240,6 @@ gint main(gint argc, gchar **argv) > goto EXIT; > } > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > loader = osinfo_loader_new(); > osinfo_loader_process_default_path(loader, &error); > if (error != NULL) { > diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c > index b924cd9..915d07e 100644 > --- a/tools/osinfo-install-script.c > +++ b/tools/osinfo-install-script.c > @@ -304,10 +304,6 @@ gint main(gint argc, gchar **argv) > bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); > bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > config = osinfo_install_config_new("http://libosinfo.fedorahosted.org/config"); > > context = g_option_context_new(_("- Generate an OS install script")); > diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c > index 43ded4f..66f49e2 100644 > --- a/tools/osinfo-query.c > +++ b/tools/osinfo-query.c > @@ -366,10 +366,6 @@ gint main(gint argc, gchar **argv) > bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); > bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); > > -#if !GLIB_CHECK_VERSION(2,35,1) > - g_type_init(); > -#endif > - > struct OsinfoType types[] = { > { "os", > (osinfo_list_func)osinfo_db_get_os_list, > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Fri Jan 8 09:44:27 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Fri, 8 Jan 2016 10:44:27 +0100 Subject: [Libosinfo] [PATCH v2 4/5] Use GLIB_VERSION_MAX_ALLOWED In-Reply-To: <1452189281-10765-4-git-send-email-fidencio@redhat.com> References: <1452189281-10765-1-git-send-email-fidencio@redhat.com> <1452189281-10765-4-git-send-email-fidencio@redhat.com> Message-ID: <20160108094427.GE29984@edamame.cdg.redhat.com> On Thu, Jan 07, 2016 at 06:54:40PM +0100, Fabiano Fid?ncio wrote: > In order to avoid using a too new GLib API. > --- > configure.ac | 11 ++++++++++- > osinfo/Makefile.am | 2 ++ > test/Makefile.am | 2 ++ > tools/Makefile.am | 5 +++++ > 4 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index ff3eed3..c280b2a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -36,13 +36,22 @@ m4_if(m4_version_compare([2.61a.100], > # Use the silent-rules feature when possible. > m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) > > +# Keep these two definitions in agreement. > +m4_define([glib_minimum_version], [2.36]) > +m4_define([glib_encoded_version], [GLIB_VERSION_2_36]) Why use m4_define rather than the more usual diff --git a/configure.ac b/configure.ac index 6d6cdd4..a307b68 100644 --- a/configure.ac +++ b/configure.ac @@ -39,6 +39,8 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) # Keep these two definitions in agreement. m4_define([glib_minimum_version], [2.36]) m4_define([glib_encoded_version], [GLIB_VERSION_2_36]) +GLIB_MINIMUM_VERSION="2.36" +GLIB_ENCODED_VERSION="GLIB_VERSION_2_36" # Keep these two definitions in agreement. m4_define([soup_minimum_version], [2.42]) @@ -49,9 +51,9 @@ PKG_CHECK_MODULES([GIO], [gio-2.0]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) -PKG_CHECK_MODULES([GLIB], [glib-2.0 >= glib_minimum_version]) -GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=glib_encoded_version" -GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=glib_encoded_version" +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_MINIMUM_VERSION]) +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_ENCODED_VERSION" +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_ENCODED_VERSION" AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) This seems to be working just as well. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From zeeshanak at gnome.org Fri Jan 8 19:06:40 2016 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 8 Jan 2016 19:06:40 +0000 Subject: [Libosinfo] [PATCH] build: fix VPATH based builds In-Reply-To: <1443180859-14407-1-git-send-email-berrange@redhat.com> References: <1443180859-14407-1-git-send-email-berrange@redhat.com> Message-ID: This patch breaks `make distcheck` here: -------------------- if test "/home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/../../docs/reference" != "/home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/docs/reference" ; then \ files=`echo Libosinfo-docs.xml Libosinfo-sections.txt Libosinfo-overrides.txt Libosinfo.types`; \ if test "x$files" != "x" ; then \ for file in $files ; do \ destdir=`dirname /home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/docs/reference/$file`; \ test -d "$destdir" || mkdir -p "$destdir"; \ test -f /home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/../../docs/reference/$file && \ cp -pf /home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/../../docs/reference/$file /home/zeenix/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/docs/reference/$file || true; \ done; \ fi; \ fi make[4]: *** No rule to make target '../../osinfo/*.c', needed by 'scan-build.stamp'. Stop. make[4]: *** Waiting for unfinished jobs.... touch setup-build.stamp make[4]: Leaving directory '/extra-data/checkout/gnome/libosinfo/libosinfo-0.3.0/_build/sub/docs/reference' ------------------- I'm reverting it for now for release. On Fri, Sep 25, 2015 at 12:34 PM, Daniel P. Berrange wrote: > The VPATH build fails because the enum generator is told to > look for two generated files in the $srcdir instead of builddir. > We should not in fact loom the generated files at all when building > enums, so they can be removed. > > The g-ir-scanner is also missing a -I$(build_dir) to let it find > the generated files. > > Finally the gtk-doc tools were not being told to look in the > $(build_dir) > > Signed-off-by: Daniel P. Berrange > --- > > Pushed to git under broken build fix rule. > > docs/reference/Makefile.am | 6 +++--- > osinfo/Makefile.am | 7 ++++--- > 2 files changed, 7 insertions(+), 6 deletions(-) > > diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am > index c7f4c7b..5b516ed 100644 > --- a/docs/reference/Makefile.am > +++ b/docs/reference/Makefile.am > @@ -3,7 +3,7 @@ DOC_MODULE=Libosinfo > > DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml > > -DOC_SOURCE_DIR=$(top_srcdir)/osinfo > +DOC_SOURCE_DIR=$(top_srcdir)/osinfo $(top_builddir)/osinfo > > SCANGOBJ_OPTIONS= > > @@ -17,8 +17,8 @@ MKHTML_OPTIONS= > > FIXXREF_OPTIONS= > > -HFILE_GLOB=$(top_srcdir)/osinfo/*.h > -CFILE_GLOB=$(top_srcdir)/osinfo/*.c > +HFILE_GLOB=$(top_srcdir)/osinfo/*.h $(top_builddir)/osinfo/*.h > +CFILE_GLOB=$(top_srcdir)/osinfo/*.c $(top_builddir)/osinfo/*.c > > IGNORE_HFILES= > > diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am > index 8f5685c..c07d362 100644 > --- a/osinfo/Makefile.am > +++ b/osinfo/Makefile.am > @@ -30,6 +30,7 @@ libosinfo_1_0_la_CFLAGS = \ > $(WARN_CFLAGS) \ > $(COVERAGE_CFLAGS) \ > -I$(top_srcdir) \ > + -I$(top_builddir) \ > $(LIBXML_CFLAGS) \ > $(LIBXSLT_CFLAGS) \ > $(GOBJECT_CFLAGS) \ > @@ -94,11 +95,11 @@ OSINFO_HEADER_FILES = \ > osinfo_resourceslist.h \ > osinfo_tree.h \ > osinfo_treelist.h \ > - osinfo_version.h \ > $(NULL) > > libosinfo_1_0_include_HEADERS = \ > $(OSINFO_HEADER_FILES) \ > + osinfo_version.h \ > osinfo_enum_types.h \ > $(NULL) > > @@ -149,10 +150,10 @@ libosinfo_1_0_la_SOURCES = \ > $(NULL) > > osinfo_enum_types.h: $(OSINFO_HEADER_FILES) osinfo_enum_types.h.template > - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ > + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ > > osinfo_enum_types.c: $(OSINFO_HEADER_FILES) osinfo_enum_types.c.template osinfo_enum_types.h > - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ > + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ > > DISTCLEANFILES += \ > osinfo_enum_types.c \ > -- > 2.4.3 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/ From zeeshanak at gnome.org Fri Jan 8 19:29:52 2016 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Fri, 8 Jan 2016 19:29:52 +0000 Subject: [Libosinfo] Libosinfo 0.3.0 Message-ID: Libosinfo 0.3.0 is out! Changes since 0.2.12: - Ditch custom udev rule since udev/blkid already expose ISO9660 properties. - New layout for database to facilitate local admin customization. Refer to docs/database-layout.txt for full details. - Many build-related fixes. - Plug many memory leaks. - Drop redundant information on PCI devices. - Fix the URI format for install scripts. - Memory corruption fixes. - Massive refactoring/cleanup of database. - Fixes to tests. - osinfo_loader_process_*() now expect a directory argument. Regular files are still supported but this support is deprecated. - Ensure Linux install scripts install qemu-guest-agent. This allows applications to do things like resyncing the clock of guest with that of host. - Add/improve/fix data on: - Alt Linux - CentOS - Debian - Fedora - FreeBSD - GNOME - KVM - Microsoft Windows 7, 8, 10 and Server 2012 - Novell Netware - OpenBSD - openSUSE - PCI and PS/2 devices - Qemu - Red Hat Enterprise Linux - Red Hat Linux - Solaris - Ubuntu - Xen - Many internal cleanups. Dependencies changed: Require libsoup >= 2.42 Release tarball available here for download: http://fedorahosted.org/releases/l/i/libosinfo/libosinfo-0.3.0.tar.gz sha256 checksum: 538a3468792e919edf5364fe102d751353ae600a92ad3a24f024424a182cefbc What is libosinfo? ================== libosinfo is a GObject based library API for managing information about operating systems, hypervisors and the (virtual) hardware devices they can support. It includes a database containing device metadata and provides APIs to match/identify optimal devices for deploying an operating system on a hypervisor. Via the magic of GObject Introspection, the API is available in all common programming languages with demos for javascript (GJS/Seed) and python (PyGObject). Also provided are Vala bindings. libosinfo is Free Software and licenced under LGPLv2+. Dependencies ============ - Required: - gobject-2.0 - gio-2.0 - libxml-2.0 - Optional: - gobject-introspection - Vala (build-time only) For further information about libosinfo please consult the project homepage http://libosinfo.org/ -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/ From fidencio at redhat.com Mon Jan 11 13:12:27 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:12:27 +0100 Subject: [Libosinfo] [PATCH 1/2] build: Don't set PKG_NAME Message-ID: <1452517948-5758-1-git-send-email-fidencio@redhat.com> The following warning was shown when running autogen.sh: ***Warning*** PKG_NAME is deprecated, you may remove it from autogen.sh --- autogen.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/autogen.sh b/autogen.sh index c496d06..ece6663 100755 --- a/autogen.sh +++ b/autogen.sh @@ -4,8 +4,6 @@ srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -PKG_NAME="libosinfo" - (test -f $srcdir/osinfo/osinfo_db.c) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level $PKG_NAME directory" -- 2.5.0 From fidencio at redhat.com Mon Jan 11 13:12:28 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:12:28 +0100 Subject: [Libosinfo] [PATCH 2/2] build: Don't use USE_GNOME2_MACROS In-Reply-To: <1452517948-5758-1-git-send-email-fidencio@redhat.com> References: <1452517948-5758-1-git-send-email-fidencio@redhat.com> Message-ID: <1452517948-5758-2-git-send-email-fidencio@redhat.com> The following warning was shown when running autogen.sh: ***Warning*** USE_GNOME2_MACROS is deprecated, you may remove it from autogen.sh --- autogen.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autogen.sh b/autogen.sh index ece6663..a833e19 100755 --- a/autogen.sh +++ b/autogen.sh @@ -20,4 +20,4 @@ which gnome-autogen.sh || { # exists at all times :-( touch ChangeLog AUTHORS -ACLOCAL_FLAGS="$ACLOCAL_FLAGS" USE_GNOME2_MACROS=1 . gnome-autogen.sh --enable-gtk-doc "$@" +ACLOCAL_FLAGS="$ACLOCAL_FLAGS" . gnome-autogen.sh --enable-gtk-doc "$@" -- 2.5.0 From cfergeau at redhat.com Mon Jan 11 13:16:33 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 11 Jan 2016 14:16:33 +0100 Subject: [Libosinfo] [PATCH 1/2] build: Don't set PKG_NAME In-Reply-To: <1452517948-5758-1-git-send-email-fidencio@redhat.com> References: <1452517948-5758-1-git-send-email-fidencio@redhat.com> Message-ID: <20160111131633.GA10330@edamame.cdg.redhat.com> On Mon, Jan 11, 2016 at 02:12:27PM +0100, Fabiano Fid?ncio wrote: > The following warning was shown when running autogen.sh: > ***Warning*** PKG_NAME is deprecated, you may remove it from autogen.sh > --- > autogen.sh | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/autogen.sh b/autogen.sh > index c496d06..ece6663 100755 > --- a/autogen.sh > +++ b/autogen.sh > @@ -4,8 +4,6 @@ > srcdir=`dirname $0` > test -z "$srcdir" && srcdir=. > > -PKG_NAME="libosinfo" > - > (test -f $srcdir/osinfo/osinfo_db.c) || { > echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" > echo " top-level $PKG_NAME directory" You need to change PKG_NAME here. ACK with that changed. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Mon Jan 11 13:16:45 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 11 Jan 2016 14:16:45 +0100 Subject: [Libosinfo] [PATCH 2/2] build: Don't use USE_GNOME2_MACROS In-Reply-To: <1452517948-5758-2-git-send-email-fidencio@redhat.com> References: <1452517948-5758-1-git-send-email-fidencio@redhat.com> <1452517948-5758-2-git-send-email-fidencio@redhat.com> Message-ID: <20160111131645.GB10330@edamame.cdg.redhat.com> On Mon, Jan 11, 2016 at 02:12:28PM +0100, Fabiano Fid?ncio wrote: > The following warning was shown when running autogen.sh: > ***Warning*** USE_GNOME2_MACROS is deprecated, you may remove it from > autogen.sh > --- > autogen.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/autogen.sh b/autogen.sh > index ece6663..a833e19 100755 > --- a/autogen.sh > +++ b/autogen.sh > @@ -20,4 +20,4 @@ which gnome-autogen.sh || { > # exists at all times :-( > touch ChangeLog AUTHORS > > -ACLOCAL_FLAGS="$ACLOCAL_FLAGS" USE_GNOME2_MACROS=1 . gnome-autogen.sh --enable-gtk-doc "$@" > +ACLOCAL_FLAGS="$ACLOCAL_FLAGS" . gnome-autogen.sh --enable-gtk-doc "$@" ACK. Christophe > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From fidencio at redhat.com Mon Jan 11 13:19:51 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:19:51 +0100 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult Message-ID: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Instead of using GSimpleAsyncResult, use the new GTask API, which is much more straightforward. For using the new GTask API, let's bump GIO (part of GLib) dependency version to 2.36. what is safe based on major distro support: - Debian Jessie: glib-2.42 - RHEL-7.1: glib-2.40 - SLES12: glib-2.38 - Ubuntu LTS 14.04: glib-2.40 --- configure.ac | 2 +- osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- osinfo/osinfo_tree.c | 34 +++++++++--------------- 4 files changed, 57 insertions(+), 91 deletions(-) diff --git a/configure.ac b/configure.ac index 4154134..5c38b96 100644 --- a/configure.ac +++ b/configure.ac @@ -37,7 +37,7 @@ m4_if(m4_version_compare([2.61a.100], m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) -PKG_CHECK_MODULES([GIO], [gio-2.0]) +PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c index 9ded116..7f0d863 100644 --- a/osinfo/osinfo_install_script.c +++ b/osinfo/osinfo_install_script.c @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript } struct _OsinfoInstallScriptGenerateData { - GSimpleAsyncResult *res; + GTask *res; OsinfoOs *os; OsinfoMedia *media; OsinfoInstallConfig *config; @@ -551,8 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate } struct _OsinfoInstallScriptGenerateOutputData { - GSimpleAsyncResult *res; - GCancellable *cancellable; + GTask *res; GError *error; GFile *file; GFileOutputStream *stream; @@ -882,7 +881,7 @@ static void osinfo_install_script_template_loaded(GObject *src, NULL, &error)) { g_prefix_error(&error, _("Failed to load script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } @@ -897,15 +896,13 @@ static void osinfo_install_script_template_loaded(GObject *src, data->config, &error)) { g_prefix_error(&error, _("Failed to apply script template %s: "), uri); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); + g_task_return_pointer(data->res, output, NULL); cleanup: - g_simple_async_result_complete(data->res); osinfo_install_script_generate_data_free(data); g_free(uri); } @@ -934,10 +931,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->media = g_object_ref(media); data->config = g_object_ref(config); data->script = g_object_ref(script); - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); if (templateData) { GError *error = NULL; @@ -952,14 +949,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr data->config, &error)) { g_prefix_error(&error, "%s", _("Failed to apply script template: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); osinfo_install_script_generate_data_free(data); return; } - g_simple_async_result_set_op_res_gpointer(data->res, - output, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, output, NULL); osinfo_install_script_generate_data_free(data); } else { GFile *file = g_file_new_for_uri(templateUri); @@ -1007,14 +1001,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** @@ -1132,9 +1123,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, res, &data->error); - g_simple_async_result_set_op_res_gpointer(data->res, - data->file, NULL); - g_simple_async_result_complete_in_idle(data->res); + g_task_return_pointer(data->res, data->file, NULL); osinfo_install_script_generate_output_data_free(data); } @@ -1309,14 +1298,14 @@ static void osinfo_install_script_generate_output_write_file(GObject *src, data->output + data->output_pos, data->output_len - data->output_pos, G_PRIORITY_DEFAULT, - data->cancellable, + g_task_get_cancellable(data->res), osinfo_install_script_generate_output_write_file, data); } else { g_output_stream_close_async(G_OUTPUT_STREAM(data->stream), G_PRIORITY_DEFAULT, - data->cancellable, + g_task_get_cancellable(data->res), osinfo_install_script_generate_output_close_file, data); } @@ -1338,12 +1327,11 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri OsinfoInstallScriptGenerateSyncData *data_sync = user_data; - data->res = g_simple_async_result_new(G_OBJECT(script), - callback, - user_data, - osinfo_install_script_generate_output_async_common); + data->res = g_task_new(G_OBJECT(script), + cancellable, + callback, + user_data); - data->cancellable = cancellable; data->error = data_sync->error; if (media != NULL) { data->output = osinfo_install_script_generate_for_media(script, diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c index 7ff48a9..d9fcba6 100644 --- a/osinfo/osinfo_media.c +++ b/osinfo/osinfo_media.c @@ -75,10 +75,7 @@ typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData; struct _CreateFromLocationAsyncData { GFile *file; - gint priority; - GCancellable *cancellable; - - GSimpleAsyncResult *res; + GTask *res; PrimaryVolumeDescriptor pvd; SupplementaryVolumeDescriptor svd; @@ -91,7 +88,6 @@ static void create_from_location_async_data_free (CreateFromLocationAsyncData *data) { g_object_unref(data->file); - g_clear_object(&data->cancellable); g_object_unref(data->res); g_slice_free(CreateFromLocationAsyncData, data); @@ -707,8 +703,8 @@ static void on_svd_read(GObject *source, g_input_stream_read_async(stream, ((gchar *)&data->svd + data->offset), data->length - data->offset, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_svd_read, data); return; @@ -760,10 +756,9 @@ static void on_svd_read(GObject *source, EXIT: if (error != NULL) - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); else - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); - g_simple_async_result_complete(data->res); + g_task_return_pointer(data->res, media, NULL); g_object_unref(stream); create_from_location_async_data_free(data); @@ -800,8 +795,8 @@ static void on_pvd_read(GObject *source, g_input_stream_read_async(stream, ((gchar*)&data->pvd) + data->offset, data->length - data->offset, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_pvd_read, data); return; @@ -827,15 +822,14 @@ static void on_pvd_read(GObject *source, g_input_stream_read_async(stream, (gchar *)&data->svd, data->length, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_svd_read, data); return; ON_ERROR: - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); } @@ -857,8 +851,7 @@ static void on_location_skipped(GObject *source, OSINFO_MEDIA_ERROR, OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, _("No volume descriptors")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -870,8 +863,8 @@ static void on_location_skipped(GObject *source, g_input_stream_read_async(stream, (gchar *)&data->pvd, data->length, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_pvd_read, data); } @@ -889,8 +882,7 @@ static void on_location_read(GObject *source, stream = g_file_read_finish(G_FILE(source), res, &error); if (error != NULL) { g_prefix_error(&error, _("Failed to open file")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; @@ -898,8 +890,8 @@ static void on_location_read(GObject *source, g_input_stream_skip_async(G_INPUT_STREAM(stream), PVD_OFFSET, - data->priority, - data->cancellable, + g_task_get_priority(data->res), + g_task_get_cancellable(data->res), on_location_skipped, data); } @@ -925,14 +917,13 @@ void osinfo_media_create_from_location_async(const gchar *location, g_return_if_fail(location != NULL); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_media_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); + g_task_set_priority(data->res, priority); + data->file = g_file_new_for_commandline_arg(location); - data->priority = priority; - data->cancellable = cancellable; g_file_read_async(data->file, priority, cancellable, @@ -953,14 +944,11 @@ void osinfo_media_create_from_location_async(const gchar *location, OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index 55c572e..c80c62d 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -36,10 +36,7 @@ struct _CreateFromLocationAsyncData { GFile *file; gchar *location; - gint priority; - GCancellable *cancellable; - - GSimpleAsyncResult *res; + GTask *res; OsinfoTree *tree; }; @@ -49,7 +46,6 @@ static void create_from_location_async_data_free(CreateFromLocationAsyncData *da if (data->tree) g_object_unref(data->tree); g_object_unref(data->file); - g_clear_object(&data->cancellable); g_object_unref(data->res); g_slice_free(CreateFromLocationAsyncData, data); @@ -604,8 +600,7 @@ static void on_location_read(GObject *source, NULL, &error)) { g_prefix_error(&error, _("Failed to load .treeinfo file: ")); - g_simple_async_result_take_error(data->res, error); - g_simple_async_result_complete(data->res); + g_task_return_error(data->res, error); create_from_location_async_data_free(data); return; } @@ -615,14 +610,13 @@ static void on_location_read(GObject *source, length, &error))) { g_prefix_error(&error, _("Failed to process keyinfo file: ")); - g_simple_async_result_take_error(data->res, error); + g_task_return_error(data->res, error); goto cleanup; } - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); + g_task_return_pointer(data->res, ret, NULL); cleanup: - g_simple_async_result_complete(data->res); create_from_location_async_data_free(data); g_free(content); } @@ -651,15 +645,14 @@ void osinfo_tree_create_from_location_async(const gchar *location, treeinfo = g_strdup_printf("%s/.treeinfo", location); data = g_slice_new0(CreateFromLocationAsyncData); - data->res = g_simple_async_result_new - (NULL, - callback, - user_data, - osinfo_tree_create_from_location_async); + data->res = g_task_new(NULL, + cancellable, + callback, + user_data); + g_task_set_priority(data->res, priority); + data->file = g_file_new_for_uri(treeinfo); data->location = g_strdup(location); - data->priority = priority; - data->cancellable = cancellable; /* XXX priority ? */ /* XXX probe other things besides just tree info */ @@ -685,14 +678,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, GError **error) { - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); + GTask *task = G_TASK(res); g_return_val_if_fail(error == NULL || *error == NULL, NULL); - if (g_simple_async_result_propagate_error(simple, error)) - return NULL; - - return g_simple_async_result_get_op_res_gpointer(simple); + return g_task_propagate_pointer(task, error); } /** -- 2.5.0 From fidencio at redhat.com Mon Jan 11 13:19:52 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:19:52 +0100 Subject: [Libosinfo] [PATCH v3 2/5] tree: Add an identation level for the if block In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: <1452518395-6211-2-git-send-email-fidencio@redhat.com> --- osinfo/osinfo_tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c index c80c62d..6fc62f7 100644 --- a/osinfo/osinfo_tree.c +++ b/osinfo/osinfo_tree.c @@ -44,7 +44,7 @@ struct _CreateFromLocationAsyncData { static void create_from_location_async_data_free(CreateFromLocationAsyncData *data) { if (data->tree) - g_object_unref(data->tree); + g_object_unref(data->tree); g_object_unref(data->file); g_object_unref(data->res); -- 2.5.0 From fidencio at redhat.com Mon Jan 11 13:19:53 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:19:53 +0100 Subject: [Libosinfo] [PATCH v3 3/5] Remove checks/code for GLib older than 2.35.1 In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: <1452518395-6211-3-git-send-email-fidencio@redhat.com> As now we depend on GLib 2.36, let's remove all checks/code that depend on an older version than the one we require. --- test/test-db.c | 4 ---- test/test-device.c | 4 ---- test/test-devicelist.c | 4 ---- test/test-entity.c | 4 ---- test/test-filter.c | 4 ---- test/test-install-script.c | 4 ---- test/test-isodetect.c | 4 ---- test/test-list.c | 4 ---- test/test-loader.c | 4 ---- test/test-mediauris.c | 4 ---- test/test-os.c | 4 ---- test/test-oslist.c | 4 ---- test/test-platform.c | 4 ---- test/test-platformlist.c | 4 ---- test/test-product.c | 4 ---- test/test-productfilter.c | 4 ---- test/test-treeuris.c | 4 ---- tools/osinfo-db-validate.c | 4 ---- tools/osinfo-detect.c | 4 ---- tools/osinfo-install-script.c | 4 ---- tools/osinfo-query.c | 4 ---- 21 files changed, 84 deletions(-) diff --git a/test/test-db.c b/test/test-db.c index df586f6..efb9fd4 100644 --- a/test/test-db.c +++ b/test/test-db.c @@ -422,10 +422,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-device.c b/test/test-device.c index 72f8e8c..a410e37 100644 --- a/test/test-device.c +++ b/test/test-device.c @@ -55,10 +55,6 @@ int main(void) Suite *s = device_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); diff --git a/test/test-devicelist.c b/test/test-devicelist.c index 02f0ff7..f06efcd 100644 --- a/test/test-devicelist.c +++ b/test/test-devicelist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_devicelist_get_type(); diff --git a/test/test-entity.c b/test/test-entity.c index 03dc570..3629e5b 100644 --- a/test/test-entity.c +++ b/test/test-entity.c @@ -335,10 +335,6 @@ int main(void) Suite *s = entity_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); diff --git a/test/test-filter.c b/test/test-filter.c index aa4fb72..fc50357 100644 --- a/test/test-filter.c +++ b/test/test-filter.c @@ -172,10 +172,6 @@ int main(void) Suite *s = filter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_device_get_type(); osinfo_filter_get_type(); diff --git a/test/test-install-script.c b/test/test-install-script.c index 4d994e7..08d7f76 100644 --- a/test/test-install-script.c +++ b/test/test-install-script.c @@ -327,10 +327,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-isodetect.c b/test/test-isodetect.c index 3590205..0ca00f9 100644 --- a/test/test-isodetect.c +++ b/test/test-isodetect.c @@ -481,10 +481,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-list.c b/test/test-list.c index fac27b5..007c362 100644 --- a/test/test-list.c +++ b/test/test-list.c @@ -414,10 +414,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_dummy_get_type(); osinfo_dummy_list_get_type(); diff --git a/test/test-loader.c b/test/test-loader.c index 0f83b49..8f796d8 100644 --- a/test/test-loader.c +++ b/test/test-loader.c @@ -55,10 +55,6 @@ int main(void) Suite *s = loader_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-mediauris.c b/test/test-mediauris.c index b2fede2..b73dcbc 100644 --- a/test/test-mediauris.c +++ b/test/test-mediauris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/test/test-os.c b/test/test-os.c index 8ee2403..604b289 100644 --- a/test/test-os.c +++ b/test/test-os.c @@ -213,10 +213,6 @@ int main(void) Suite *s = os_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-oslist.c b/test/test-oslist.c index 765d546..71d55a4 100644 --- a/test/test-oslist.c +++ b/test/test-oslist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_os_get_type(); osinfo_oslist_get_type(); diff --git a/test/test-platform.c b/test/test-platform.c index 6f05b83..80b28db 100644 --- a/test/test-platform.c +++ b/test/test-platform.c @@ -131,10 +131,6 @@ int main(void) Suite *s = platform_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-platformlist.c b/test/test-platformlist.c index e1b1d13..ec53549 100644 --- a/test/test-platformlist.c +++ b/test/test-platformlist.c @@ -224,10 +224,6 @@ int main(void) Suite *s = list_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_platformlist_get_type(); diff --git a/test/test-product.c b/test/test-product.c index f6b30fa..1e4e2d6 100644 --- a/test/test-product.c +++ b/test/test-product.c @@ -205,10 +205,6 @@ int main(void) Suite *s = product_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_platform_get_type(); osinfo_device_get_type(); diff --git a/test/test-productfilter.c b/test/test-productfilter.c index 57d6fc4..8e1fed8 100644 --- a/test/test-productfilter.c +++ b/test/test-productfilter.c @@ -243,10 +243,6 @@ int main(void) Suite *s = productfilter_suite(); SRunner *sr = srunner_create(s); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_filter_get_type(); diff --git a/test/test-treeuris.c b/test/test-treeuris.c index 9176919..0ddfe4f 100644 --- a/test/test-treeuris.c +++ b/test/test-treeuris.c @@ -128,10 +128,6 @@ int main(void) if (!g_getenv("LIBOSINFO_NETWORK_TESTS")) return 77; /* Skip */ -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - /* Upfront so we don't confuse valgrind */ osinfo_entity_get_type(); osinfo_db_get_type(); diff --git a/tools/osinfo-db-validate.c b/tools/osinfo-db-validate.c index f53aebe..965ed0e 100644 --- a/tools/osinfo-db-validate.c +++ b/tools/osinfo-db-validate.c @@ -256,10 +256,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - context = g_option_context_new(_("- Validate XML documents ")); g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE); diff --git a/tools/osinfo-detect.c b/tools/osinfo-detect.c index fae7b21..2e5af97 100644 --- a/tools/osinfo-detect.c +++ b/tools/osinfo-detect.c @@ -240,10 +240,6 @@ gint main(gint argc, gchar **argv) goto EXIT; } -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - loader = osinfo_loader_new(); osinfo_loader_process_default_path(loader, &error); if (error != NULL) { diff --git a/tools/osinfo-install-script.c b/tools/osinfo-install-script.c index b924cd9..915d07e 100644 --- a/tools/osinfo-install-script.c +++ b/tools/osinfo-install-script.c @@ -304,10 +304,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - config = osinfo_install_config_new("http://libosinfo.fedorahosted.org/config"); context = g_option_context_new(_("- Generate an OS install script")); diff --git a/tools/osinfo-query.c b/tools/osinfo-query.c index 43ded4f..66f49e2 100644 --- a/tools/osinfo-query.c +++ b/tools/osinfo-query.c @@ -366,10 +366,6 @@ gint main(gint argc, gchar **argv) bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR); bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); -#if !GLIB_CHECK_VERSION(2,35,1) - g_type_init(); -#endif - struct OsinfoType types[] = { { "os", (osinfo_list_func)osinfo_db_get_os_list, -- 2.5.0 From fidencio at redhat.com Mon Jan 11 13:19:54 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:19:54 +0100 Subject: [Libosinfo] [PATCH v3 4/5] Use GLIB_VERSION_MAX_ALLOWED In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: <1452518395-6211-4-git-send-email-fidencio@redhat.com> In order to avoid using a too new GLib API. --- configure.ac | 14 ++++++++++++-- osinfo/Makefile.am | 2 ++ test/Makefile.am | 2 ++ tools/Makefile.am | 5 +++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 5c38b96..403b4e0 100644 --- a/configure.ac +++ b/configure.ac @@ -36,12 +36,22 @@ m4_if(m4_version_compare([2.61a.100], # Use the silent-rules feature when possible. m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) -PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) +# Keep these two definitions in agreement. +GLIB_MINIMUM_VERSION="2.36" +GLIB_ENCODED_VERSION="GLIB_VERSION_2_36" + +PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= $GLIB_MINIMUM_VERSION]) +PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_MINIMUM_VERSION]) PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_MINIMUM_VERSION]) +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_ENCODED_VERSION" +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_ENCODED_VERSION" +AC_SUBST(GLIB_CFLAGS) +AC_SUBST(GLIB_LIBS) + GTK_DOC_CHECK([1.10],[--flavour no-tmpl]) AC_ARG_ENABLE([tests], diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 8f5685c..e8cec0e 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -33,6 +33,7 @@ libosinfo_1_0_la_CFLAGS = \ $(LIBXML_CFLAGS) \ $(LIBXSLT_CFLAGS) \ $(GOBJECT_CFLAGS) \ + $(GLIB_CFLAGS) \ $(GIO_CFLAGS) \ -DPKG_DATA_DIR='"$(pkgdatadir)"' \ -DSYS_CONF_DIR='"$(sysconfdir)"' \ @@ -43,6 +44,7 @@ libosinfo_1_0_la_LIBADD = \ $(LIBXML_LIBS) \ $(LIBXSLT_LIBS) \ $(GOBJECT_LIBS) \ + $(GLIB_LIBS) \ $(GIO_LIBS) libosinfo_1_0_la_LDFLAGS = \ diff --git a/test/Makefile.am b/test/Makefile.am index ef63154..d6504fd 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -23,6 +23,7 @@ check_PROGRAMS = \ COMMON_LDADD = \ $(COVERAGE_LDFLAGS) \ + $(GLIB_LIBS) \ $(GOBJECT_LIBS) \ $(SOUP_LIBS) \ $(CHECK_LIBS) \ @@ -30,6 +31,7 @@ COMMON_LDADD = \ COMMON_CFLAGS = \ $(WARN_CFLAGS) \ $(COVERAGE_CFLAGS) \ + $(GLIB_CFLAGS) \ $(GOBJECT_CFLAGS) \ $(SOUP_CFLAGS) \ -I$(top_srcdir) \ diff --git a/tools/Makefile.am b/tools/Makefile.am index a064dce..7f7249f 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,5 +1,6 @@ AM_CFLAGS = $(GOBJECT_CFLAGS) \ $(GIO_CFLAGS) \ + $(GLIB_CFLAGS) \ $(LIBXML_CFLAGS) \ -DPKGDATADIR="\"$(pkgdatadir)\"" \ -DLOCALEDIR="\"$(datadir)/locale\"" \ @@ -21,22 +22,26 @@ POD2MAN = pod2man -c "Virtualization Support" -r "$(PACKAGE)-$(VERSION)" osinfo_detect_SOURCES = osinfo-detect.c osinfo_detect_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_db_validate_SOURCES = osinfo-db-validate.c osinfo_db_validate_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_query_SOURCES = osinfo-query.c osinfo_query_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la osinfo_install_script_SOURCES = osinfo-install-script.c osinfo_install_script_LDADD = $(GOBJECT_LIBS) \ $(GIO_LIBS) \ + $(GLIB_LIBS) \ $(LIBXML_LIBS) \ $(top_builddir)/osinfo/libosinfo-1.0.la -- 2.5.0 From fidencio at redhat.com Mon Jan 11 13:19:55 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 14:19:55 +0100 Subject: [Libosinfo] [PATCH v3 5/5] Use SOUP_VERSION_MAX_ALLOWED In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: <1452518395-6211-5-git-send-email-fidencio@redhat.com> In order to avoid using a too new libsoup API. --- configure.ac | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 403b4e0..d29d639 100644 --- a/configure.ac +++ b/configure.ac @@ -40,9 +40,12 @@ m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) GLIB_MINIMUM_VERSION="2.36" GLIB_ENCODED_VERSION="GLIB_VERSION_2_36" +# Keep these two definitions in agreement. +SOUP_MINIMUM_VERSION="2.42" +SOUP_ENCODED_VERSION="SOUP_VERSION_2_42" + PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= $GLIB_MINIMUM_VERSION]) PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_MINIMUM_VERSION]) -PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) @@ -52,6 +55,12 @@ GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_ENCODED_VERSION" AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) +PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= $SOUP_MINIMUM_VERSION]) +SOUP_CFLAGS="$SOUP_CFLAGS -DSOUP_VERSION_MIN_REQUIRED=$SOUP_ENCODED_VERSION" +SOUP_CFLAGS="$SOUP_CFLAGS -DSOUP_VERSION_MAX_ALLOWED=$SOUP_ENCODED_VERSION" +AC_SUBST(SOUP_CFLAGS) +AC_SUBST(SOUP_LIBS) + GTK_DOC_CHECK([1.10],[--flavour no-tmpl]) AC_ARG_ENABLE([tests], -- 2.5.0 From cfergeau at redhat.com Mon Jan 11 13:33:47 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 11 Jan 2016 14:33:47 +0100 Subject: [Libosinfo] [PATCH v3 2/5] tree: Add an identation level for the if block In-Reply-To: <1452518395-6211-2-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> <1452518395-6211-2-git-send-email-fidencio@redhat.com> Message-ID: <20160111133347.GC10330@edamame.cdg.redhat.com> 'indentation' in the subject. Acked-by: Christophe Fergeau On Mon, Jan 11, 2016 at 02:19:52PM +0100, Fabiano Fid?ncio wrote: > --- > osinfo/osinfo_tree.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c > index c80c62d..6fc62f7 100644 > --- a/osinfo/osinfo_tree.c > +++ b/osinfo/osinfo_tree.c > @@ -44,7 +44,7 @@ struct _CreateFromLocationAsyncData { > static void create_from_location_async_data_free(CreateFromLocationAsyncData *data) > { > if (data->tree) > - g_object_unref(data->tree); > + g_object_unref(data->tree); > g_object_unref(data->file); > g_object_unref(data->res); > > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Mon Jan 11 13:36:39 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 11 Jan 2016 14:36:39 +0100 Subject: [Libosinfo] [PATCH v3 4/5] Use GLIB_VERSION_MAX_ALLOWED In-Reply-To: <1452518395-6211-4-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> <1452518395-6211-4-git-send-email-fidencio@redhat.com> Message-ID: <20160111133639.GD10330@edamame.cdg.redhat.com> On Mon, Jan 11, 2016 at 02:19:54PM +0100, Fabiano Fid?ncio wrote: > In order to avoid using a too new GLib API. > --- > configure.ac | 14 ++++++++++++-- > osinfo/Makefile.am | 2 ++ > test/Makefile.am | 2 ++ > tools/Makefile.am | 5 +++++ > 4 files changed, 21 insertions(+), 2 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 5c38b96..403b4e0 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -36,12 +36,22 @@ m4_if(m4_version_compare([2.61a.100], > # Use the silent-rules feature when possible. > m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) > > -PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) > -PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) > +# Keep these two definitions in agreement. > +GLIB_MINIMUM_VERSION="2.36" > +GLIB_ENCODED_VERSION="GLIB_VERSION_2_36" > + > +PKG_CHECK_MODULES([GOBJECT], [gobject-2.0 >= $GLIB_MINIMUM_VERSION]) > +PKG_CHECK_MODULES([GIO], [gio-2.0 >= $GLIB_MINIMUM_VERSION]) > PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) > PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) > PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) > > +PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_MINIMUM_VERSION]) > +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB_ENCODED_VERSION" > +GLIB_CFLAGS="$GLIB_CFLAGS -DGLIB_VERSION_MAX_ALLOWED=$GLIB_ENCODED_VERSION" > +AC_SUBST(GLIB_CFLAGS) > +AC_SUBST(GLIB_LIBS) > + I'd tend to merge everything in a single test PKG_CHECK_MODULES([GLIB], [glib-2.0 >= $GLIB_MINIMUM_VERSION gobject-2.0 gio-2.0]) as GOBJECT_LIBS and GIO_LIBS always go together in libosinfo Makefile.am. Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From cfergeau at redhat.com Mon Jan 11 13:37:05 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Mon, 11 Jan 2016 14:37:05 +0100 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: <20160111133705.GE10330@edamame.cdg.redhat.com> Series looks good to me apart from some minor comments, Acked-by: Christophe Fergeau Christophe On Mon, Jan 11, 2016 at 02:19:51PM +0100, Fabiano Fid?ncio wrote: > Instead of using GSimpleAsyncResult, use the new GTask API, which is > much more straightforward. > For using the new GTask API, let's bump GIO (part of GLib) dependency > version to 2.36. > what is safe based on major distro support: > - Debian Jessie: glib-2.42 > - RHEL-7.1: glib-2.40 > - SLES12: glib-2.38 > - Ubuntu LTS 14.04: glib-2.40 > --- > configure.ac | 2 +- > osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- > osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- > osinfo/osinfo_tree.c | 34 +++++++++--------------- > 4 files changed, 57 insertions(+), 91 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 4154134..5c38b96 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -37,7 +37,7 @@ m4_if(m4_version_compare([2.61a.100], > m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) > > PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) > -PKG_CHECK_MODULES([GIO], [gio-2.0]) > +PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) > PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) > PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) > PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > index 9ded116..7f0d863 100644 > --- a/osinfo/osinfo_install_script.c > +++ b/osinfo/osinfo_install_script.c > @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript > } > > struct _OsinfoInstallScriptGenerateData { > - GSimpleAsyncResult *res; > + GTask *res; > OsinfoOs *os; > OsinfoMedia *media; > OsinfoInstallConfig *config; > @@ -551,8 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate > } > > struct _OsinfoInstallScriptGenerateOutputData { > - GSimpleAsyncResult *res; > - GCancellable *cancellable; > + GTask *res; > GError *error; > GFile *file; > GFileOutputStream *stream; > @@ -882,7 +881,7 @@ static void osinfo_install_script_template_loaded(GObject *src, > NULL, > &error)) { > g_prefix_error(&error, _("Failed to load script template %s: "), uri); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > @@ -897,15 +896,13 @@ static void osinfo_install_script_template_loaded(GObject *src, > data->config, > &error)) { > g_prefix_error(&error, _("Failed to apply script template %s: "), uri); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > - g_simple_async_result_set_op_res_gpointer(data->res, > - output, NULL); > + g_task_return_pointer(data->res, output, NULL); > > cleanup: > - g_simple_async_result_complete(data->res); > osinfo_install_script_generate_data_free(data); > g_free(uri); > } > @@ -934,10 +931,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr > data->media = g_object_ref(media); > data->config = g_object_ref(config); > data->script = g_object_ref(script); > - data->res = g_simple_async_result_new(G_OBJECT(script), > - callback, > - user_data, > - osinfo_install_script_generate_async_common); > + data->res = g_task_new(G_OBJECT(script), > + cancellable, > + callback, > + user_data); > > if (templateData) { > GError *error = NULL; > @@ -952,14 +949,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr > data->config, > &error)) { > g_prefix_error(&error, "%s", _("Failed to apply script template: ")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > osinfo_install_script_generate_data_free(data); > return; > } > - g_simple_async_result_set_op_res_gpointer(data->res, > - output, NULL); > - g_simple_async_result_complete_in_idle(data->res); > + g_task_return_pointer(data->res, output, NULL); > osinfo_install_script_generate_data_free(data); > } else { > GFile *file = g_file_new_for_uri(templateUri); > @@ -1007,14 +1001,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript > GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > @@ -1132,9 +1123,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, > res, > &data->error); > > - g_simple_async_result_set_op_res_gpointer(data->res, > - data->file, NULL); > - g_simple_async_result_complete_in_idle(data->res); > + g_task_return_pointer(data->res, data->file, NULL); > > osinfo_install_script_generate_output_data_free(data); > } > @@ -1309,14 +1298,14 @@ static void osinfo_install_script_generate_output_write_file(GObject *src, > data->output + data->output_pos, > data->output_len - data->output_pos, > G_PRIORITY_DEFAULT, > - data->cancellable, > + g_task_get_cancellable(data->res), > osinfo_install_script_generate_output_write_file, > data); > > } else { > g_output_stream_close_async(G_OUTPUT_STREAM(data->stream), > G_PRIORITY_DEFAULT, > - data->cancellable, > + g_task_get_cancellable(data->res), > osinfo_install_script_generate_output_close_file, > data); > } > @@ -1338,12 +1327,11 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri > > OsinfoInstallScriptGenerateSyncData *data_sync = user_data; > > - data->res = g_simple_async_result_new(G_OBJECT(script), > - callback, > - user_data, > - osinfo_install_script_generate_output_async_common); > + data->res = g_task_new(G_OBJECT(script), > + cancellable, > + callback, > + user_data); > > - data->cancellable = cancellable; > data->error = data_sync->error; > if (media != NULL) { > data->output = osinfo_install_script_generate_for_media(script, > diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c > index 7ff48a9..d9fcba6 100644 > --- a/osinfo/osinfo_media.c > +++ b/osinfo/osinfo_media.c > @@ -75,10 +75,7 @@ typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData; > struct _CreateFromLocationAsyncData { > GFile *file; > > - gint priority; > - GCancellable *cancellable; > - > - GSimpleAsyncResult *res; > + GTask *res; > > PrimaryVolumeDescriptor pvd; > SupplementaryVolumeDescriptor svd; > @@ -91,7 +88,6 @@ static void create_from_location_async_data_free > (CreateFromLocationAsyncData *data) > { > g_object_unref(data->file); > - g_clear_object(&data->cancellable); > g_object_unref(data->res); > > g_slice_free(CreateFromLocationAsyncData, data); > @@ -707,8 +703,8 @@ static void on_svd_read(GObject *source, > g_input_stream_read_async(stream, > ((gchar *)&data->svd + data->offset), > data->length - data->offset, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_svd_read, > data); > return; > @@ -760,10 +756,9 @@ static void on_svd_read(GObject *source, > > EXIT: > if (error != NULL) > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > else > - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); > - g_simple_async_result_complete(data->res); > + g_task_return_pointer(data->res, media, NULL); > > g_object_unref(stream); > create_from_location_async_data_free(data); > @@ -800,8 +795,8 @@ static void on_pvd_read(GObject *source, > g_input_stream_read_async(stream, > ((gchar*)&data->pvd) + data->offset, > data->length - data->offset, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_pvd_read, > data); > return; > @@ -827,15 +822,14 @@ static void on_pvd_read(GObject *source, > g_input_stream_read_async(stream, > (gchar *)&data->svd, > data->length, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_svd_read, > data); > return; > > ON_ERROR: > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > } > > @@ -857,8 +851,7 @@ static void on_location_skipped(GObject *source, > OSINFO_MEDIA_ERROR, > OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, > _("No volume descriptors")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > > return; > @@ -870,8 +863,8 @@ static void on_location_skipped(GObject *source, > g_input_stream_read_async(stream, > (gchar *)&data->pvd, > data->length, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_pvd_read, > data); > } > @@ -889,8 +882,7 @@ static void on_location_read(GObject *source, > stream = g_file_read_finish(G_FILE(source), res, &error); > if (error != NULL) { > g_prefix_error(&error, _("Failed to open file")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > > return; > @@ -898,8 +890,8 @@ static void on_location_read(GObject *source, > > g_input_stream_skip_async(G_INPUT_STREAM(stream), > PVD_OFFSET, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_location_skipped, > data); > } > @@ -925,14 +917,13 @@ void osinfo_media_create_from_location_async(const gchar *location, > g_return_if_fail(location != NULL); > > data = g_slice_new0(CreateFromLocationAsyncData); > - data->res = g_simple_async_result_new > - (NULL, > - callback, > - user_data, > - osinfo_media_create_from_location_async); > + data->res = g_task_new(NULL, > + cancellable, > + callback, > + user_data); > + g_task_set_priority(data->res, priority); > + > data->file = g_file_new_for_commandline_arg(location); > - data->priority = priority; > - data->cancellable = cancellable; > g_file_read_async(data->file, > priority, > cancellable, > @@ -953,14 +944,11 @@ void osinfo_media_create_from_location_async(const gchar *location, > OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c > index 55c572e..c80c62d 100644 > --- a/osinfo/osinfo_tree.c > +++ b/osinfo/osinfo_tree.c > @@ -36,10 +36,7 @@ struct _CreateFromLocationAsyncData { > GFile *file; > gchar *location; > > - gint priority; > - GCancellable *cancellable; > - > - GSimpleAsyncResult *res; > + GTask *res; > > OsinfoTree *tree; > }; > @@ -49,7 +46,6 @@ static void create_from_location_async_data_free(CreateFromLocationAsyncData *da > if (data->tree) > g_object_unref(data->tree); > g_object_unref(data->file); > - g_clear_object(&data->cancellable); > g_object_unref(data->res); > > g_slice_free(CreateFromLocationAsyncData, data); > @@ -604,8 +600,7 @@ static void on_location_read(GObject *source, > NULL, > &error)) { > g_prefix_error(&error, _("Failed to load .treeinfo file: ")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > return; > } > @@ -615,14 +610,13 @@ static void on_location_read(GObject *source, > length, > &error))) { > g_prefix_error(&error, _("Failed to process keyinfo file: ")); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); > + g_task_return_pointer(data->res, ret, NULL); > > cleanup: > - g_simple_async_result_complete(data->res); > create_from_location_async_data_free(data); > g_free(content); > } > @@ -651,15 +645,14 @@ void osinfo_tree_create_from_location_async(const gchar *location, > treeinfo = g_strdup_printf("%s/.treeinfo", location); > > data = g_slice_new0(CreateFromLocationAsyncData); > - data->res = g_simple_async_result_new > - (NULL, > - callback, > - user_data, > - osinfo_tree_create_from_location_async); > + data->res = g_task_new(NULL, > + cancellable, > + callback, > + user_data); > + g_task_set_priority(data->res, priority); > + > data->file = g_file_new_for_uri(treeinfo); > data->location = g_strdup(location); > - data->priority = priority; > - data->cancellable = cancellable; > > /* XXX priority ? */ > /* XXX probe other things besides just tree info */ > @@ -685,14 +678,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, > OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From zeeshanak at gnome.org Mon Jan 11 13:59:39 2016 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Mon, 11 Jan 2016 13:59:39 +0000 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: <1452518395-6211-1-git-send-email-fidencio@redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: Hi fidencio, Thanks for doing this. Just some nits about commit log: On Mon, Jan 11, 2016 at 1:19 PM, Fabiano Fid?ncio wrote: > Instead of using GSimpleAsyncResult, use the new GTask API, which is > much more straightforward. > For using the new GTask API, let's bump GIO (part of GLib) dependency > version to 2.36. * I prefer to put version bump in separate patch, cause it kinda is a separate change and it makes it hard to miss when writing release notes. * Empty lines before each paragraph please. Not really your fault. Seems this very annoying habit is getting widespread. :( > what is safe based on major distro support: The last line doesn't make sense grammatically (only questions start with 'what') and "safe" IMO is vague and incorrect here. Just say "All major distros have 2.36 or higher version available:" > - Debian Jessie: glib-2.42 > - RHEL-7.1: glib-2.40 > - SLES12: glib-2.38 > - Ubuntu LTS 14.04: glib-2.40 > --- > configure.ac | 2 +- > osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- > osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- > osinfo/osinfo_tree.c | 34 +++++++++--------------- > 4 files changed, 57 insertions(+), 91 deletions(-) > > diff --git a/configure.ac b/configure.ac > index 4154134..5c38b96 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -37,7 +37,7 @@ m4_if(m4_version_compare([2.61a.100], > m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) > > PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) > -PKG_CHECK_MODULES([GIO], [gio-2.0]) > +PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) > PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) > PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) > PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) > diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c > index 9ded116..7f0d863 100644 > --- a/osinfo/osinfo_install_script.c > +++ b/osinfo/osinfo_install_script.c > @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript > } > > struct _OsinfoInstallScriptGenerateData { > - GSimpleAsyncResult *res; > + GTask *res; > OsinfoOs *os; > OsinfoMedia *media; > OsinfoInstallConfig *config; > @@ -551,8 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate > } > > struct _OsinfoInstallScriptGenerateOutputData { > - GSimpleAsyncResult *res; > - GCancellable *cancellable; > + GTask *res; > GError *error; > GFile *file; > GFileOutputStream *stream; > @@ -882,7 +881,7 @@ static void osinfo_install_script_template_loaded(GObject *src, > NULL, > &error)) { > g_prefix_error(&error, _("Failed to load script template %s: "), uri); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > @@ -897,15 +896,13 @@ static void osinfo_install_script_template_loaded(GObject *src, > data->config, > &error)) { > g_prefix_error(&error, _("Failed to apply script template %s: "), uri); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > - g_simple_async_result_set_op_res_gpointer(data->res, > - output, NULL); > + g_task_return_pointer(data->res, output, NULL); > > cleanup: > - g_simple_async_result_complete(data->res); > osinfo_install_script_generate_data_free(data); > g_free(uri); > } > @@ -934,10 +931,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr > data->media = g_object_ref(media); > data->config = g_object_ref(config); > data->script = g_object_ref(script); > - data->res = g_simple_async_result_new(G_OBJECT(script), > - callback, > - user_data, > - osinfo_install_script_generate_async_common); > + data->res = g_task_new(G_OBJECT(script), > + cancellable, > + callback, > + user_data); > > if (templateData) { > GError *error = NULL; > @@ -952,14 +949,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr > data->config, > &error)) { > g_prefix_error(&error, "%s", _("Failed to apply script template: ")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > osinfo_install_script_generate_data_free(data); > return; > } > - g_simple_async_result_set_op_res_gpointer(data->res, > - output, NULL); > - g_simple_async_result_complete_in_idle(data->res); > + g_task_return_pointer(data->res, output, NULL); > osinfo_install_script_generate_data_free(data); > } else { > GFile *file = g_file_new_for_uri(templateUri); > @@ -1007,14 +1001,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript > GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > @@ -1132,9 +1123,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, > res, > &data->error); > > - g_simple_async_result_set_op_res_gpointer(data->res, > - data->file, NULL); > - g_simple_async_result_complete_in_idle(data->res); > + g_task_return_pointer(data->res, data->file, NULL); > > osinfo_install_script_generate_output_data_free(data); > } > @@ -1309,14 +1298,14 @@ static void osinfo_install_script_generate_output_write_file(GObject *src, > data->output + data->output_pos, > data->output_len - data->output_pos, > G_PRIORITY_DEFAULT, > - data->cancellable, > + g_task_get_cancellable(data->res), > osinfo_install_script_generate_output_write_file, > data); > > } else { > g_output_stream_close_async(G_OUTPUT_STREAM(data->stream), > G_PRIORITY_DEFAULT, > - data->cancellable, > + g_task_get_cancellable(data->res), > osinfo_install_script_generate_output_close_file, > data); > } > @@ -1338,12 +1327,11 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri > > OsinfoInstallScriptGenerateSyncData *data_sync = user_data; > > - data->res = g_simple_async_result_new(G_OBJECT(script), > - callback, > - user_data, > - osinfo_install_script_generate_output_async_common); > + data->res = g_task_new(G_OBJECT(script), > + cancellable, > + callback, > + user_data); > > - data->cancellable = cancellable; > data->error = data_sync->error; > if (media != NULL) { > data->output = osinfo_install_script_generate_for_media(script, > diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c > index 7ff48a9..d9fcba6 100644 > --- a/osinfo/osinfo_media.c > +++ b/osinfo/osinfo_media.c > @@ -75,10 +75,7 @@ typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData; > struct _CreateFromLocationAsyncData { > GFile *file; > > - gint priority; > - GCancellable *cancellable; > - > - GSimpleAsyncResult *res; > + GTask *res; > > PrimaryVolumeDescriptor pvd; > SupplementaryVolumeDescriptor svd; > @@ -91,7 +88,6 @@ static void create_from_location_async_data_free > (CreateFromLocationAsyncData *data) > { > g_object_unref(data->file); > - g_clear_object(&data->cancellable); > g_object_unref(data->res); > > g_slice_free(CreateFromLocationAsyncData, data); > @@ -707,8 +703,8 @@ static void on_svd_read(GObject *source, > g_input_stream_read_async(stream, > ((gchar *)&data->svd + data->offset), > data->length - data->offset, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_svd_read, > data); > return; > @@ -760,10 +756,9 @@ static void on_svd_read(GObject *source, > > EXIT: > if (error != NULL) > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > else > - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); > - g_simple_async_result_complete(data->res); > + g_task_return_pointer(data->res, media, NULL); > > g_object_unref(stream); > create_from_location_async_data_free(data); > @@ -800,8 +795,8 @@ static void on_pvd_read(GObject *source, > g_input_stream_read_async(stream, > ((gchar*)&data->pvd) + data->offset, > data->length - data->offset, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_pvd_read, > data); > return; > @@ -827,15 +822,14 @@ static void on_pvd_read(GObject *source, > g_input_stream_read_async(stream, > (gchar *)&data->svd, > data->length, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_svd_read, > data); > return; > > ON_ERROR: > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > } > > @@ -857,8 +851,7 @@ static void on_location_skipped(GObject *source, > OSINFO_MEDIA_ERROR, > OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, > _("No volume descriptors")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > > return; > @@ -870,8 +863,8 @@ static void on_location_skipped(GObject *source, > g_input_stream_read_async(stream, > (gchar *)&data->pvd, > data->length, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_pvd_read, > data); > } > @@ -889,8 +882,7 @@ static void on_location_read(GObject *source, > stream = g_file_read_finish(G_FILE(source), res, &error); > if (error != NULL) { > g_prefix_error(&error, _("Failed to open file")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > > return; > @@ -898,8 +890,8 @@ static void on_location_read(GObject *source, > > g_input_stream_skip_async(G_INPUT_STREAM(stream), > PVD_OFFSET, > - data->priority, > - data->cancellable, > + g_task_get_priority(data->res), > + g_task_get_cancellable(data->res), > on_location_skipped, > data); > } > @@ -925,14 +917,13 @@ void osinfo_media_create_from_location_async(const gchar *location, > g_return_if_fail(location != NULL); > > data = g_slice_new0(CreateFromLocationAsyncData); > - data->res = g_simple_async_result_new > - (NULL, > - callback, > - user_data, > - osinfo_media_create_from_location_async); > + data->res = g_task_new(NULL, > + cancellable, > + callback, > + user_data); > + g_task_set_priority(data->res, priority); > + > data->file = g_file_new_for_commandline_arg(location); > - data->priority = priority; > - data->cancellable = cancellable; > g_file_read_async(data->file, > priority, > cancellable, > @@ -953,14 +944,11 @@ void osinfo_media_create_from_location_async(const gchar *location, > OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c > index 55c572e..c80c62d 100644 > --- a/osinfo/osinfo_tree.c > +++ b/osinfo/osinfo_tree.c > @@ -36,10 +36,7 @@ struct _CreateFromLocationAsyncData { > GFile *file; > gchar *location; > > - gint priority; > - GCancellable *cancellable; > - > - GSimpleAsyncResult *res; > + GTask *res; > > OsinfoTree *tree; > }; > @@ -49,7 +46,6 @@ static void create_from_location_async_data_free(CreateFromLocationAsyncData *da > if (data->tree) > g_object_unref(data->tree); > g_object_unref(data->file); > - g_clear_object(&data->cancellable); > g_object_unref(data->res); > > g_slice_free(CreateFromLocationAsyncData, data); > @@ -604,8 +600,7 @@ static void on_location_read(GObject *source, > NULL, > &error)) { > g_prefix_error(&error, _("Failed to load .treeinfo file: ")); > - g_simple_async_result_take_error(data->res, error); > - g_simple_async_result_complete(data->res); > + g_task_return_error(data->res, error); > create_from_location_async_data_free(data); > return; > } > @@ -615,14 +610,13 @@ static void on_location_read(GObject *source, > length, > &error))) { > g_prefix_error(&error, _("Failed to process keyinfo file: ")); > - g_simple_async_result_take_error(data->res, error); > + g_task_return_error(data->res, error); > goto cleanup; > } > > - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); > + g_task_return_pointer(data->res, ret, NULL); > > cleanup: > - g_simple_async_result_complete(data->res); > create_from_location_async_data_free(data); > g_free(content); > } > @@ -651,15 +645,14 @@ void osinfo_tree_create_from_location_async(const gchar *location, > treeinfo = g_strdup_printf("%s/.treeinfo", location); > > data = g_slice_new0(CreateFromLocationAsyncData); > - data->res = g_simple_async_result_new > - (NULL, > - callback, > - user_data, > - osinfo_tree_create_from_location_async); > + data->res = g_task_new(NULL, > + cancellable, > + callback, > + user_data); > + g_task_set_priority(data->res, priority); > + > data->file = g_file_new_for_uri(treeinfo); > data->location = g_strdup(location); > - data->priority = priority; > - data->cancellable = cancellable; > > /* XXX priority ? */ > /* XXX probe other things besides just tree info */ > @@ -685,14 +678,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, > OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, > GError **error) > { > - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); > + GTask *task = G_TASK(res); > > g_return_val_if_fail(error == NULL || *error == NULL, NULL); > > - if (g_simple_async_result_propagate_error(simple, error)) > - return NULL; > - > - return g_simple_async_result_get_op_res_gpointer(simple); > + return g_task_propagate_pointer(task, error); > } > > /** > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/ From fabiano at fidencio.org Mon Jan 11 14:00:14 2016 From: fabiano at fidencio.org (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 15:00:14 +0100 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: <20160111133705.GE10330@edamame.cdg.redhat.com> References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> <20160111133705.GE10330@edamame.cdg.redhat.com> Message-ID: On Mon, Jan 11, 2016 at 2:37 PM, Christophe Fergeau wrote: > Series looks good to me apart from some minor comments, Pushed both series. Thanks for the reviews. From fabiano at fidencio.org Mon Jan 11 14:05:11 2016 From: fabiano at fidencio.org (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Mon, 11 Jan 2016 15:05:11 +0100 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: Zeeshan On Mon, Jan 11, 2016 at 2:59 PM, Zeeshan Ali (Khattak) wrote: > Hi fidencio, > > Thanks for doing this. Just some nits about commit log: > > On Mon, Jan 11, 2016 at 1:19 PM, Fabiano Fid?ncio wrote: >> Instead of using GSimpleAsyncResult, use the new GTask API, which is >> much more straightforward. >> For using the new GTask API, let's bump GIO (part of GLib) dependency >> version to 2.36. > > * I prefer to put version bump in separate patch, cause it kinda is a > separate change and it makes it hard to miss when writing release > notes. > > * Empty lines before each paragraph please. Not really your fault. > Seems this very annoying habit is getting widespread. :( > >> what is safe based on major distro support: > > The last line doesn't make sense grammatically (only questions start > with 'what') and "safe" IMO is vague and incorrect here. Just say "All > major distros have 2.36 or higher version available:" I appreciate your comments but unfortunately I've already pushed the series, sorry :-\ > >> - Debian Jessie: glib-2.42 >> - RHEL-7.1: glib-2.40 >> - SLES12: glib-2.38 >> - Ubuntu LTS 14.04: glib-2.40 >> --- >> configure.ac | 2 +- >> osinfo/osinfo_install_script.c | 52 ++++++++++++++---------------------- >> osinfo/osinfo_media.c | 60 +++++++++++++++++------------------------- >> osinfo/osinfo_tree.c | 34 +++++++++--------------- >> 4 files changed, 57 insertions(+), 91 deletions(-) >> >> diff --git a/configure.ac b/configure.ac >> index 4154134..5c38b96 100644 >> --- a/configure.ac >> +++ b/configure.ac >> @@ -37,7 +37,7 @@ m4_if(m4_version_compare([2.61a.100], >> m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) >> >> PKG_CHECK_MODULES([GOBJECT], [gobject-2.0]) >> -PKG_CHECK_MODULES([GIO], [gio-2.0]) >> +PKG_CHECK_MODULES([GIO], [gio-2.0 >= 2.36]) >> PKG_CHECK_MODULES([SOUP], [libsoup-2.4 >= 2.42]) >> PKG_CHECK_MODULES([LIBXML], [libxml-2.0 >= 2.6.0]) >> PKG_CHECK_MODULES([LIBXSLT], [libxslt >= 1.0.0]) >> diff --git a/osinfo/osinfo_install_script.c b/osinfo/osinfo_install_script.c >> index 9ded116..7f0d863 100644 >> --- a/osinfo/osinfo_install_script.c >> +++ b/osinfo/osinfo_install_script.c >> @@ -531,7 +531,7 @@ OsinfoAvatarFormat *osinfo_install_script_get_avatar_format(OsinfoInstallScript >> } >> >> struct _OsinfoInstallScriptGenerateData { >> - GSimpleAsyncResult *res; >> + GTask *res; >> OsinfoOs *os; >> OsinfoMedia *media; >> OsinfoInstallConfig *config; >> @@ -551,8 +551,7 @@ static void osinfo_install_script_generate_data_free(OsinfoInstallScriptGenerate >> } >> >> struct _OsinfoInstallScriptGenerateOutputData { >> - GSimpleAsyncResult *res; >> - GCancellable *cancellable; >> + GTask *res; >> GError *error; >> GFile *file; >> GFileOutputStream *stream; >> @@ -882,7 +881,7 @@ static void osinfo_install_script_template_loaded(GObject *src, >> NULL, >> &error)) { >> g_prefix_error(&error, _("Failed to load script template %s: "), uri); >> - g_simple_async_result_take_error(data->res, error); >> + g_task_return_error(data->res, error); >> goto cleanup; >> } >> >> @@ -897,15 +896,13 @@ static void osinfo_install_script_template_loaded(GObject *src, >> data->config, >> &error)) { >> g_prefix_error(&error, _("Failed to apply script template %s: "), uri); >> - g_simple_async_result_take_error(data->res, error); >> + g_task_return_error(data->res, error); >> goto cleanup; >> } >> >> - g_simple_async_result_set_op_res_gpointer(data->res, >> - output, NULL); >> + g_task_return_pointer(data->res, output, NULL); >> >> cleanup: >> - g_simple_async_result_complete(data->res); >> osinfo_install_script_generate_data_free(data); >> g_free(uri); >> } >> @@ -934,10 +931,10 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr >> data->media = g_object_ref(media); >> data->config = g_object_ref(config); >> data->script = g_object_ref(script); >> - data->res = g_simple_async_result_new(G_OBJECT(script), >> - callback, >> - user_data, >> - osinfo_install_script_generate_async_common); >> + data->res = g_task_new(G_OBJECT(script), >> + cancellable, >> + callback, >> + user_data); >> >> if (templateData) { >> GError *error = NULL; >> @@ -952,14 +949,11 @@ static void osinfo_install_script_generate_async_common(OsinfoInstallScript *scr >> data->config, >> &error)) { >> g_prefix_error(&error, "%s", _("Failed to apply script template: ")); >> - g_simple_async_result_take_error(data->res, error); >> - g_simple_async_result_complete(data->res); >> + g_task_return_error(data->res, error); >> osinfo_install_script_generate_data_free(data); >> return; >> } >> - g_simple_async_result_set_op_res_gpointer(data->res, >> - output, NULL); >> - g_simple_async_result_complete_in_idle(data->res); >> + g_task_return_pointer(data->res, output, NULL); >> osinfo_install_script_generate_data_free(data); >> } else { >> GFile *file = g_file_new_for_uri(templateUri); >> @@ -1007,14 +1001,11 @@ static gpointer osinfo_install_script_generate_finish_common(OsinfoInstallScript >> GAsyncResult *res, >> GError **error) >> { >> - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); >> + GTask *task = G_TASK(res); >> >> g_return_val_if_fail(error == NULL || *error == NULL, NULL); >> >> - if (g_simple_async_result_propagate_error(simple, error)) >> - return NULL; >> - >> - return g_simple_async_result_get_op_res_gpointer(simple); >> + return g_task_propagate_pointer(task, error); >> } >> >> /** >> @@ -1132,9 +1123,7 @@ static void osinfo_install_script_generate_output_close_file(GObject *src, >> res, >> &data->error); >> >> - g_simple_async_result_set_op_res_gpointer(data->res, >> - data->file, NULL); >> - g_simple_async_result_complete_in_idle(data->res); >> + g_task_return_pointer(data->res, data->file, NULL); >> >> osinfo_install_script_generate_output_data_free(data); >> } >> @@ -1309,14 +1298,14 @@ static void osinfo_install_script_generate_output_write_file(GObject *src, >> data->output + data->output_pos, >> data->output_len - data->output_pos, >> G_PRIORITY_DEFAULT, >> - data->cancellable, >> + g_task_get_cancellable(data->res), >> osinfo_install_script_generate_output_write_file, >> data); >> >> } else { >> g_output_stream_close_async(G_OUTPUT_STREAM(data->stream), >> G_PRIORITY_DEFAULT, >> - data->cancellable, >> + g_task_get_cancellable(data->res), >> osinfo_install_script_generate_output_close_file, >> data); >> } >> @@ -1338,12 +1327,11 @@ static void osinfo_install_script_generate_output_async_common(OsinfoInstallScri >> >> OsinfoInstallScriptGenerateSyncData *data_sync = user_data; >> >> - data->res = g_simple_async_result_new(G_OBJECT(script), >> - callback, >> - user_data, >> - osinfo_install_script_generate_output_async_common); >> + data->res = g_task_new(G_OBJECT(script), >> + cancellable, >> + callback, >> + user_data); >> >> - data->cancellable = cancellable; >> data->error = data_sync->error; >> if (media != NULL) { >> data->output = osinfo_install_script_generate_for_media(script, >> diff --git a/osinfo/osinfo_media.c b/osinfo/osinfo_media.c >> index 7ff48a9..d9fcba6 100644 >> --- a/osinfo/osinfo_media.c >> +++ b/osinfo/osinfo_media.c >> @@ -75,10 +75,7 @@ typedef struct _CreateFromLocationAsyncData CreateFromLocationAsyncData; >> struct _CreateFromLocationAsyncData { >> GFile *file; >> >> - gint priority; >> - GCancellable *cancellable; >> - >> - GSimpleAsyncResult *res; >> + GTask *res; >> >> PrimaryVolumeDescriptor pvd; >> SupplementaryVolumeDescriptor svd; >> @@ -91,7 +88,6 @@ static void create_from_location_async_data_free >> (CreateFromLocationAsyncData *data) >> { >> g_object_unref(data->file); >> - g_clear_object(&data->cancellable); >> g_object_unref(data->res); >> >> g_slice_free(CreateFromLocationAsyncData, data); >> @@ -707,8 +703,8 @@ static void on_svd_read(GObject *source, >> g_input_stream_read_async(stream, >> ((gchar *)&data->svd + data->offset), >> data->length - data->offset, >> - data->priority, >> - data->cancellable, >> + g_task_get_priority(data->res), >> + g_task_get_cancellable(data->res), >> on_svd_read, >> data); >> return; >> @@ -760,10 +756,9 @@ static void on_svd_read(GObject *source, >> >> EXIT: >> if (error != NULL) >> - g_simple_async_result_take_error(data->res, error); >> + g_task_return_error(data->res, error); >> else >> - g_simple_async_result_set_op_res_gpointer(data->res, media, NULL); >> - g_simple_async_result_complete(data->res); >> + g_task_return_pointer(data->res, media, NULL); >> >> g_object_unref(stream); >> create_from_location_async_data_free(data); >> @@ -800,8 +795,8 @@ static void on_pvd_read(GObject *source, >> g_input_stream_read_async(stream, >> ((gchar*)&data->pvd) + data->offset, >> data->length - data->offset, >> - data->priority, >> - data->cancellable, >> + g_task_get_priority(data->res), >> + g_task_get_cancellable(data->res), >> on_pvd_read, >> data); >> return; >> @@ -827,15 +822,14 @@ static void on_pvd_read(GObject *source, >> g_input_stream_read_async(stream, >> (gchar *)&data->svd, >> data->length, >> - data->priority, >> - data->cancellable, >> + g_task_get_priority(data->res), >> + g_task_get_cancellable(data->res), >> on_svd_read, >> data); >> return; >> >> ON_ERROR: >> - g_simple_async_result_take_error(data->res, error); >> - g_simple_async_result_complete(data->res); >> + g_task_return_error(data->res, error); >> create_from_location_async_data_free(data); >> } >> >> @@ -857,8 +851,7 @@ static void on_location_skipped(GObject *source, >> OSINFO_MEDIA_ERROR, >> OSINFO_MEDIA_ERROR_NO_DESCRIPTORS, >> _("No volume descriptors")); >> - g_simple_async_result_take_error(data->res, error); >> - g_simple_async_result_complete(data->res); >> + g_task_return_error(data->res, error); >> create_from_location_async_data_free(data); >> >> return; >> @@ -870,8 +863,8 @@ static void on_location_skipped(GObject *source, >> g_input_stream_read_async(stream, >> (gchar *)&data->pvd, >> data->length, >> - data->priority, >> - data->cancellable, >> + g_task_get_priority(data->res), >> + g_task_get_cancellable(data->res), >> on_pvd_read, >> data); >> } >> @@ -889,8 +882,7 @@ static void on_location_read(GObject *source, >> stream = g_file_read_finish(G_FILE(source), res, &error); >> if (error != NULL) { >> g_prefix_error(&error, _("Failed to open file")); >> - g_simple_async_result_take_error(data->res, error); >> - g_simple_async_result_complete(data->res); >> + g_task_return_error(data->res, error); >> create_from_location_async_data_free(data); >> >> return; >> @@ -898,8 +890,8 @@ static void on_location_read(GObject *source, >> >> g_input_stream_skip_async(G_INPUT_STREAM(stream), >> PVD_OFFSET, >> - data->priority, >> - data->cancellable, >> + g_task_get_priority(data->res), >> + g_task_get_cancellable(data->res), >> on_location_skipped, >> data); >> } >> @@ -925,14 +917,13 @@ void osinfo_media_create_from_location_async(const gchar *location, >> g_return_if_fail(location != NULL); >> >> data = g_slice_new0(CreateFromLocationAsyncData); >> - data->res = g_simple_async_result_new >> - (NULL, >> - callback, >> - user_data, >> - osinfo_media_create_from_location_async); >> + data->res = g_task_new(NULL, >> + cancellable, >> + callback, >> + user_data); >> + g_task_set_priority(data->res, priority); >> + >> data->file = g_file_new_for_commandline_arg(location); >> - data->priority = priority; >> - data->cancellable = cancellable; >> g_file_read_async(data->file, >> priority, >> cancellable, >> @@ -953,14 +944,11 @@ void osinfo_media_create_from_location_async(const gchar *location, >> OsinfoMedia *osinfo_media_create_from_location_finish(GAsyncResult *res, >> GError **error) >> { >> - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); >> + GTask *task = G_TASK(res); >> >> g_return_val_if_fail(error == NULL || *error == NULL, NULL); >> >> - if (g_simple_async_result_propagate_error(simple, error)) >> - return NULL; >> - >> - return g_simple_async_result_get_op_res_gpointer(simple); >> + return g_task_propagate_pointer(task, error); >> } >> >> /** >> diff --git a/osinfo/osinfo_tree.c b/osinfo/osinfo_tree.c >> index 55c572e..c80c62d 100644 >> --- a/osinfo/osinfo_tree.c >> +++ b/osinfo/osinfo_tree.c >> @@ -36,10 +36,7 @@ struct _CreateFromLocationAsyncData { >> GFile *file; >> gchar *location; >> >> - gint priority; >> - GCancellable *cancellable; >> - >> - GSimpleAsyncResult *res; >> + GTask *res; >> >> OsinfoTree *tree; >> }; >> @@ -49,7 +46,6 @@ static void create_from_location_async_data_free(CreateFromLocationAsyncData *da >> if (data->tree) >> g_object_unref(data->tree); >> g_object_unref(data->file); >> - g_clear_object(&data->cancellable); >> g_object_unref(data->res); >> >> g_slice_free(CreateFromLocationAsyncData, data); >> @@ -604,8 +600,7 @@ static void on_location_read(GObject *source, >> NULL, >> &error)) { >> g_prefix_error(&error, _("Failed to load .treeinfo file: ")); >> - g_simple_async_result_take_error(data->res, error); >> - g_simple_async_result_complete(data->res); >> + g_task_return_error(data->res, error); >> create_from_location_async_data_free(data); >> return; >> } >> @@ -615,14 +610,13 @@ static void on_location_read(GObject *source, >> length, >> &error))) { >> g_prefix_error(&error, _("Failed to process keyinfo file: ")); >> - g_simple_async_result_take_error(data->res, error); >> + g_task_return_error(data->res, error); >> goto cleanup; >> } >> >> - g_simple_async_result_set_op_res_gpointer(data->res, ret, NULL); >> + g_task_return_pointer(data->res, ret, NULL); >> >> cleanup: >> - g_simple_async_result_complete(data->res); >> create_from_location_async_data_free(data); >> g_free(content); >> } >> @@ -651,15 +645,14 @@ void osinfo_tree_create_from_location_async(const gchar *location, >> treeinfo = g_strdup_printf("%s/.treeinfo", location); >> >> data = g_slice_new0(CreateFromLocationAsyncData); >> - data->res = g_simple_async_result_new >> - (NULL, >> - callback, >> - user_data, >> - osinfo_tree_create_from_location_async); >> + data->res = g_task_new(NULL, >> + cancellable, >> + callback, >> + user_data); >> + g_task_set_priority(data->res, priority); >> + >> data->file = g_file_new_for_uri(treeinfo); >> data->location = g_strdup(location); >> - data->priority = priority; >> - data->cancellable = cancellable; >> >> /* XXX priority ? */ >> /* XXX probe other things besides just tree info */ >> @@ -685,14 +678,11 @@ void osinfo_tree_create_from_location_async(const gchar *location, >> OsinfoTree *osinfo_tree_create_from_location_finish(GAsyncResult *res, >> GError **error) >> { >> - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT(res); >> + GTask *task = G_TASK(res); >> >> g_return_val_if_fail(error == NULL || *error == NULL, NULL); >> >> - if (g_simple_async_result_propagate_error(simple, error)) >> - return NULL; >> - >> - return g_simple_async_result_get_op_res_gpointer(simple); >> + return g_task_propagate_pointer(task, error); >> } >> >> /** >> -- >> 2.5.0 >> >> _______________________________________________ >> Libosinfo mailing list >> Libosinfo at redhat.com >> https://www.redhat.com/mailman/listinfo/libosinfo > > > > -- > Regards, > > Zeeshan Ali (Khattak) > ________________________________________ > Befriend GNOME: http://www.gnome.org/friends/ > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Fabiano Fid?ncio From zeeshanak at gnome.org Mon Jan 11 19:04:36 2016 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Mon, 11 Jan 2016 19:04:36 +0000 Subject: [Libosinfo] [PATCH v3 1/5] Use GTask instead of GSimpleAsyncResult In-Reply-To: References: <1452518395-6211-1-git-send-email-fidencio@redhat.com> Message-ID: On Mon, Jan 11, 2016 at 2:05 PM, Fabiano Fid?ncio wrote: > Zeeshan > > On Mon, Jan 11, 2016 at 2:59 PM, Zeeshan Ali (Khattak) > wrote: >> Hi fidencio, >> >> Thanks for doing this. Just some nits about commit log: >> >> On Mon, Jan 11, 2016 at 1:19 PM, Fabiano Fid?ncio wrote: >>> Instead of using GSimpleAsyncResult, use the new GTask API, which is >>> much more straightforward. >>> For using the new GTask API, let's bump GIO (part of GLib) dependency >>> version to 2.36. >> >> * I prefer to put version bump in separate patch, cause it kinda is a >> separate change and it makes it hard to miss when writing release >> notes. >> >> * Empty lines before each paragraph please. Not really your fault. >> Seems this very annoying habit is getting widespread. :( >> >>> what is safe based on major distro support: >> >> The last line doesn't make sense grammatically (only questions start >> with 'what') and "safe" IMO is vague and incorrect here. Just say "All >> major distros have 2.36 or higher version available:" > > I appreciate your comments but unfortunately I've already pushed the > series, sorry :-\ No biggie, just keep in mind in future. :) -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/ From berrange at redhat.com Wed Jan 13 11:22:42 2016 From: berrange at redhat.com (Daniel P. Berrange) Date: Wed, 13 Jan 2016 11:22:42 +0000 Subject: [Libosinfo] [PATCH] don't include autogenerated enum files in dist Message-ID: <1452684162-28541-1-git-send-email-berrange@redhat.com> Previous commit 77cf2730eb6e5503a9bd40e6baf7cc0b393a9dc7 reverts 4e488678d4af0e54da7400851d554bc4c4497c76 (fixes to the VPATH build) because it was said to break the make distcheck. After examining the problem, it seems this commit was not in fact the problem - it merely exposed the existing bug elsewhere. The real problem is that we were including the autogenerated enum files in the dist. So when doing builds from git those files were in $builddir, but when doing builds from dist those files were in $srcdir. Except that 'make distclean' would delete the enum files, which would again cause them to appear in $builddir. So the real fix is stop including the enum files in the dist Signed-off-by: Daniel P. Berrange --- osinfo/Makefile.am | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index c4f29a4..410a4c1 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -58,7 +58,7 @@ libosinfo_1_0_la_DEPENDENCIES = libosinfo.syms libosinfo_1_0_includedir = $(includedir)/libosinfo-1.0/osinfo -OSINFO_HEADER_FILES = \ +libosinfo_1_0_include_HEADERS = \ osinfo.h \ osinfo_avatar_format.h \ osinfo_db.h \ @@ -99,8 +99,7 @@ OSINFO_HEADER_FILES = \ osinfo_treelist.h \ $(NULL) -libosinfo_1_0_include_HEADERS = \ - $(OSINFO_HEADER_FILES) \ +nodist_libosinfo_1_0_include_HEADERS = \ osinfo_version.h \ osinfo_enum_types.h \ $(NULL) @@ -110,7 +109,6 @@ libosinfo_1_0_la_SOURCES = \ osinfo_datamap.c \ osinfo_datamaplist.c \ osinfo_entity.c \ - osinfo_enum_types.c \ osinfo_filter.c \ osinfo_list.c \ osinfo_device.c \ @@ -151,11 +149,16 @@ libosinfo_1_0_la_SOURCES = \ ignore-value.h \ $(NULL) -osinfo_enum_types.h: $(OSINFO_HEADER_FILES) osinfo_enum_types.h.template - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ +nodist_libosinfo_1_0_la_SOURCES = \ + osinfo_enum_types.c \ + $(NULL) + + +osinfo_enum_types.h: $(libosinfo_1_0_include_HEADERS) osinfo_enum_types.h.template + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ osinfo_enum_types.c: $(OSINFO_HEADER_FILES) osinfo_enum_types.c.template osinfo_enum_types.h - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ DISTCLEANFILES += \ osinfo_enum_types.c \ @@ -188,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) Libosinfo_1_0_gir_CFLAGS = $(libosinfo_1_0_la_CFLAGS) Libosinfo_1_0_gir_SCANNERFLAGS = --identifier-prefix=Osinfo --symbol-prefix=osinfo --c-include="osinfo/osinfo.h" INTROSPECTION_GIRS += Libosinfo-1.0.gir -- 2.5.0 From zeeshanak at gnome.org Wed Jan 13 22:13:58 2016 From: zeeshanak at gnome.org (Zeeshan Ali (Khattak)) Date: Wed, 13 Jan 2016 22:13:58 +0000 Subject: [Libosinfo] [PATCH] don't include autogenerated enum files in dist In-Reply-To: <1452684162-28541-1-git-send-email-berrange@redhat.com> References: <1452684162-28541-1-git-send-email-berrange@redhat.com> Message-ID: Hi, Patch looks fine to me but I failed to apply it on current git master nor 0.3.0 tag. On Wed, Jan 13, 2016 at 11:22 AM, Daniel P. Berrange wrote: > Previous commit 77cf2730eb6e5503a9bd40e6baf7cc0b393a9dc7 > reverts 4e488678d4af0e54da7400851d554bc4c4497c76 (fixes > to the VPATH build) because it was said to break the > make distcheck. > > After examining the problem, it seems this commit was not > in fact the problem - it merely exposed the existing bug > elsewhere. > > The real problem is that we were including the autogenerated > enum files in the dist. So when doing builds from git those > files were in $builddir, but when doing builds from dist > those files were in $srcdir. Except that 'make distclean' > would delete the enum files, which would again cause them > to appear in $builddir. > > So the real fix is stop including the enum files in the dist > > Signed-off-by: Daniel P. Berrange > --- > osinfo/Makefile.am | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) > > diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am > index c4f29a4..410a4c1 100644 > --- a/osinfo/Makefile.am > +++ b/osinfo/Makefile.am > @@ -58,7 +58,7 @@ libosinfo_1_0_la_DEPENDENCIES = libosinfo.syms > > libosinfo_1_0_includedir = $(includedir)/libosinfo-1.0/osinfo > > -OSINFO_HEADER_FILES = \ > +libosinfo_1_0_include_HEADERS = \ > osinfo.h \ > osinfo_avatar_format.h \ > osinfo_db.h \ > @@ -99,8 +99,7 @@ OSINFO_HEADER_FILES = \ > osinfo_treelist.h \ > $(NULL) > > -libosinfo_1_0_include_HEADERS = \ > - $(OSINFO_HEADER_FILES) \ > +nodist_libosinfo_1_0_include_HEADERS = \ > osinfo_version.h \ > osinfo_enum_types.h \ > $(NULL) > @@ -110,7 +109,6 @@ libosinfo_1_0_la_SOURCES = \ > osinfo_datamap.c \ > osinfo_datamaplist.c \ > osinfo_entity.c \ > - osinfo_enum_types.c \ > osinfo_filter.c \ > osinfo_list.c \ > osinfo_device.c \ > @@ -151,11 +149,16 @@ libosinfo_1_0_la_SOURCES = \ > ignore-value.h \ > $(NULL) > > -osinfo_enum_types.h: $(OSINFO_HEADER_FILES) osinfo_enum_types.h.template > - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ > +nodist_libosinfo_1_0_la_SOURCES = \ > + osinfo_enum_types.c \ > + $(NULL) > + > + > +osinfo_enum_types.h: $(libosinfo_1_0_include_HEADERS) osinfo_enum_types.h.template > + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.h.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ > > osinfo_enum_types.c: $(OSINFO_HEADER_FILES) osinfo_enum_types.c.template osinfo_enum_types.h > - $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(OSINFO_HEADER_FILES:%=$(srcdir)/%) ) > $@ > + $(AM_V_GEN) ( $(GLIB_MKENUMS) --template $(srcdir)/osinfo_enum_types.c.template $(libosinfo_1_0_include_HEADERS:%=$(srcdir)/%) ) > $@ > > DISTCLEANFILES += \ > osinfo_enum_types.c \ > @@ -188,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 > Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt > Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 > Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la > -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) > +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) > Libosinfo_1_0_gir_CFLAGS = $(libosinfo_1_0_la_CFLAGS) > Libosinfo_1_0_gir_SCANNERFLAGS = --identifier-prefix=Osinfo --symbol-prefix=osinfo --c-include="osinfo/osinfo.h" > INTROSPECTION_GIRS += Libosinfo-1.0.gir > -- > 2.5.0 > > _______________________________________________ > Libosinfo mailing list > Libosinfo at redhat.com > https://www.redhat.com/mailman/listinfo/libosinfo -- Regards, Zeeshan Ali (Khattak) ________________________________________ Befriend GNOME: http://www.gnome.org/friends/ From berrange at redhat.com Thu Jan 14 09:48:06 2016 From: berrange at redhat.com (Daniel P. Berrange) Date: Thu, 14 Jan 2016 09:48:06 +0000 Subject: [Libosinfo] [PATCH] don't include autogenerated enum files in dist In-Reply-To: References: <1452684162-28541-1-git-send-email-berrange@redhat.com> Message-ID: <20160114094806.GA910@redhat.com> On Wed, Jan 13, 2016 at 10:13:58PM +0000, Zeeshan Ali (Khattak) wrote: > Hi, > > Patch looks fine to me but I failed to apply it on current git master > nor 0.3.0 tag. Opps, I should say it applies after I revert your revert of my previous patch Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :| From fidencio at redhat.com Wed Jan 20 17:12:11 2016 From: fidencio at redhat.com (=?UTF-8?q?Fabiano=20Fid=C3=AAncio?=) Date: Wed, 20 Jan 2016 18:12:11 +0100 Subject: [Libosinfo] [PATCH] build: Fix .vapi generation Message-ID: <1453309931-1609-1-git-send-email-fidencio@redhat.com> After a267020e272a generation of the .vapi file broke. It no longer has path_pattern property while get_path_pattern) is still there. Adding nodist_libosinfo_1_0_include_HEADERS to the list of the files passed to the .gir generation solves the problem. --- osinfo/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am index 410a4c1..ddece61 100644 --- a/osinfo/Makefile.am +++ b/osinfo/Makefile.am @@ -191,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(nodist_libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) Libosinfo_1_0_gir_CFLAGS = $(libosinfo_1_0_la_CFLAGS) Libosinfo_1_0_gir_SCANNERFLAGS = --identifier-prefix=Osinfo --symbol-prefix=osinfo --c-include="osinfo/osinfo.h" INTROSPECTION_GIRS += Libosinfo-1.0.gir -- 2.5.0 From fidencio at redhat.com Wed Jan 20 17:25:30 2016 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Wed, 20 Jan 2016 18:25:30 +0100 Subject: [Libosinfo] [PATCH] build: Fix .vapi generation In-Reply-To: <1453309931-1609-1-git-send-email-fidencio@redhat.com> References: <1453309931-1609-1-git-send-email-fidencio@redhat.com> Message-ID: On Wed, Jan 20, 2016 at 6:12 PM, Fabiano Fid?ncio wrote: > After a267020e272a generation of the .vapi file broke. It no longer has > path_pattern property while get_path_pattern) is still there. > Adding nodist_libosinfo_1_0_include_HEADERS to the list of the files > passed to the .gir generation solves the problem. Just would like to mention that the patch doesn't break VPATH build neither "make distcheck" > --- > osinfo/Makefile.am | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am > index 410a4c1..ddece61 100644 > --- a/osinfo/Makefile.am > +++ b/osinfo/Makefile.am > @@ -191,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 > Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt > Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 > Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la > -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) > +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(nodist_libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) > Libosinfo_1_0_gir_CFLAGS = $(libosinfo_1_0_la_CFLAGS) > Libosinfo_1_0_gir_SCANNERFLAGS = --identifier-prefix=Osinfo --symbol-prefix=osinfo --c-include="osinfo/osinfo.h" > INTROSPECTION_GIRS += Libosinfo-1.0.gir > -- > 2.5.0 > From cfergeau at redhat.com Thu Jan 21 08:33:21 2016 From: cfergeau at redhat.com (Christophe Fergeau) Date: Thu, 21 Jan 2016 09:33:21 +0100 Subject: [Libosinfo] [PATCH] build: Fix .vapi generation In-Reply-To: <1453309931-1609-1-git-send-email-fidencio@redhat.com> References: <1453309931-1609-1-git-send-email-fidencio@redhat.com> Message-ID: <20160121083321.GA21841@edamame.cdg.redhat.com> On Wed, Jan 20, 2016 at 06:12:11PM +0100, Fabiano Fid?ncio wrote: > After a267020e272a generation of the .vapi file broke. It no longer has > path_pattern property while get_path_pattern) is still there. extra parens (or missing opening parens). > Adding nodist_libosinfo_1_0_include_HEADERS to the list of the files > passed to the .gir generation solves the problem. > --- > osinfo/Makefile.am | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am > index 410a4c1..ddece61 100644 > --- a/osinfo/Makefile.am > +++ b/osinfo/Makefile.am > @@ -191,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 > Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt > Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 > Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la > -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) > +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(nodist_libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) I've tested this and it fixed the issue for me Acked-by: Christophe Fergeau Christophe -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: From fidencio at redhat.com Thu Jan 21 09:27:06 2016 From: fidencio at redhat.com (=?UTF-8?Q?Fabiano_Fid=C3=AAncio?=) Date: Thu, 21 Jan 2016 10:27:06 +0100 Subject: [Libosinfo] [PATCH] build: Fix .vapi generation In-Reply-To: <20160121083321.GA21841@edamame.cdg.redhat.com> References: <1453309931-1609-1-git-send-email-fidencio@redhat.com> <20160121083321.GA21841@edamame.cdg.redhat.com> Message-ID: On Thu, Jan 21, 2016 at 9:33 AM, Christophe Fergeau wrote: > On Wed, Jan 20, 2016 at 06:12:11PM +0100, Fabiano Fid?ncio wrote: >> After a267020e272a generation of the .vapi file broke. It no longer has >> path_pattern property while get_path_pattern) is still there. > > extra parens (or missing opening parens). > >> Adding nodist_libosinfo_1_0_include_HEADERS to the list of the files >> passed to the .gir generation solves the problem. > >> --- >> osinfo/Makefile.am | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/osinfo/Makefile.am b/osinfo/Makefile.am >> index 410a4c1..ddece61 100644 >> --- a/osinfo/Makefile.am >> +++ b/osinfo/Makefile.am >> @@ -191,7 +191,7 @@ Libosinfo_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 libxml2-2.0 >> Libosinfo_1_0_gir_PACKAGES = gobject-2.0 gio-2.0 libxml-2.0 libxslt >> Libosinfo_1_0_gir_EXPORT_PACKAGES = libosinfo-1.0 >> Libosinfo_1_0_gir_LIBS = libosinfo-1.0.la >> -Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) >> +Libosinfo_1_0_gir_FILES = $(libosinfo_1_0_include_HEADERS) $(nodist_libosinfo_1_0_include_HEADERS) $(libosinfo_1_0_la_SOURCES) $(nodist_libosinfo_1_0_la_SOURCES) > > I've tested this and it fixed the issue for me > > Acked-by: Christophe Fergeau Pushed, thanks! > > Christophe From bogorodskiy at gmail.com Mon Jan 25 00:10:44 2016 From: bogorodskiy at gmail.com (Roman Bogorodskiy) Date: Mon, 25 Jan 2016 03:10:44 +0300 Subject: [Libosinfo] [PATCH] Fix build with older GCC Message-ID: <1453680644-76293-1-git-send-email-bogorodskiy@gmail.com> Build with older gcc fails with: CC libosinfo_1_0_la-osinfo_avatar_format.lo In file included from ../osinfo/osinfo_os.h:30, from ../osinfo/osinfo.h:55, from osinfo_avatar_format.c:28: ../osinfo/osinfo_media.h:68: error: redefinition of typedef 'OsinfoMedia' ../osinfo/osinfo_install_script.h:43: error: previous declaration of 'OsinfoMedia' was here To avoid redefinition, use forward-declaration in a similar way like it's done for OsinfoOs in osinfo/osinfo_os.h. --- osinfo/osinfo_media.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osinfo/osinfo_media.h b/osinfo/osinfo_media.h index 8ad39c4..09fbacd 100644 --- a/osinfo/osinfo_media.h +++ b/osinfo/osinfo_media.h @@ -65,8 +65,11 @@ typedef enum { #define OSINFO_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OSINFO_TYPE_MEDIA)) #define OSINFO_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), OSINFO_TYPE_MEDIA, OsinfoMediaClass)) -typedef struct _OsinfoMedia OsinfoMedia; - +/* + * Forward declared in osinfo_install_script.h + * + * typedef struct _OsinfoMedia OsinfoMedia; + */ typedef struct _OsinfoMediaClass OsinfoMediaClass; typedef struct _OsinfoMediaPrivate OsinfoMediaPrivate; -- 2.4.6