From d39d095d93d15f059b78e25a89ffd0526ac76b85 Mon Sep 17 00:00:00 2001 From: Johannes Schmid Date: Sun, 22 Jul 2012 14:11:50 +0200 Subject: [PATCH] build: Only check for passwords when installing as root (bgo#680136) --- plugins/build-basic-autotools/build.c | 20 +++++++++++--------- plugins/build-basic-autotools/plugin.c | 5 ++--- plugins/build-basic-autotools/plugin.h | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/plugins/build-basic-autotools/build.c b/plugins/build-basic-autotools/build.c index e315bb557..ae483595a 100644 --- a/plugins/build-basic-autotools/build.c +++ b/plugins/build-basic-autotools/build.c @@ -444,7 +444,7 @@ build_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog, BuildContext *context; gboolean ok; - context = build_get_context (bplugin, prog->work_dir, with_view); + context = build_get_context (bplugin, prog->work_dir, with_view, FALSE); build_set_command_in_context (context, prog); ok = build_execute_command_in_context (context, err); @@ -463,11 +463,11 @@ build_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog, static BuildContext* build_save_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildProgram *prog, - gboolean with_view, GError **err) + gboolean with_view, gboolean check_password, GError **err) { BuildContext *context; - context = build_get_context (bplugin, prog->work_dir, with_view); + context = build_get_context (bplugin, prog->work_dir, with_view, check_password); build_set_command_in_context (context, prog); if (!build_save_and_execute_command_in_context (context, err)) @@ -510,7 +510,7 @@ build_save_distclean_and_execute_command (BasicAutotoolsPlugin* bplugin, BuildPr BuildConfiguration *config; GList *vars; - context = build_get_context (bplugin, prog->work_dir, with_view); + context = build_get_context (bplugin, prog->work_dir, with_view, FALSE); root_path = g_file_get_path (bplugin->project_root_dir); same = strcmp (prog->work_dir, root_path) != 0; g_free (root_path); @@ -575,7 +575,7 @@ build_build_file_or_dir (BasicAutotoolsPlugin *plugin, build_program_set_callback (prog, callback, user_data); build_program_add_env_list (prog, vars); - context = build_save_and_execute_command (plugin, prog, TRUE, err); + context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, err); g_free (target); g_object_unref (build_dir); @@ -614,7 +614,7 @@ build_is_file_built (BasicAutotoolsPlugin *plugin, GFile *file, build_program_set_callback (prog, callback, user_data); build_program_add_env_list (prog, vars); - context = build_save_and_execute_command (plugin, prog, FALSE, err); + context = build_save_and_execute_command (plugin, prog, FALSE, FALSE, err); g_free (target); g_object_unref (build_dir); @@ -644,6 +644,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir, { BuildContext *context; gchar* root = get_root_install_command(plugin); + gboolean use_root = FALSE; GFile *build_dir; BuildProgram *prog; GString *command; @@ -690,6 +691,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir, } } g_string_append (command, first); + use_root = TRUE; } else { @@ -707,7 +709,7 @@ build_install_dir (BasicAutotoolsPlugin *plugin, GFile *dir, build_program_set_callback (prog, callback, user_data); build_program_add_env_list (prog, vars); - context = build_save_and_execute_command (plugin, prog, TRUE, err); + context = build_save_and_execute_command (plugin, prog, TRUE, use_root, err); g_string_free (command, TRUE); g_object_unref (build_dir); @@ -825,7 +827,7 @@ build_tarball (BasicAutotoolsPlugin *plugin) CHOOSE_COMMAND (plugin, BUILD_TARBALL)), build_program_add_env_list (prog, vars); - context = build_save_and_execute_command (plugin, prog, TRUE, NULL); + context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, NULL); return context; } @@ -861,7 +863,7 @@ build_compile_file (BasicAutotoolsPlugin *plugin, GFile *file) build_program_add_env_list (prog, vars); - context = build_save_and_execute_command (plugin, prog, TRUE, NULL); + context = build_save_and_execute_command (plugin, prog, TRUE, FALSE, NULL); g_object_unref (object); } else diff --git a/plugins/build-basic-autotools/plugin.c b/plugins/build-basic-autotools/plugin.c index 4008f5c00..576947a58 100644 --- a/plugins/build-basic-autotools/plugin.c +++ b/plugins/build-basic-autotools/plugin.c @@ -1167,7 +1167,7 @@ build_get_context_with_message(BasicAutotoolsPlugin *plugin, const gchar *dir) BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, - gboolean with_view) + gboolean with_view, gboolean check_passwd) { BuildContext *context = NULL; AnjutaPluginManager *plugin_manager; @@ -1205,6 +1205,7 @@ build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, } context->launcher = anjuta_launcher_new (); + anjuta_launcher_set_check_passwd_prompt (context->launcher, check_passwd); g_signal_connect (G_OBJECT (context->launcher), "child-exited", G_CALLBACK (on_build_terminated), context); build_context_push_dir (context, "default", dir); @@ -2393,7 +2394,6 @@ static void value_added_current_editor (AnjutaPlugin *plugin, const char *name, const GValue *value, gpointer data) { - AnjutaUI *ui; GObject *editor; editor = g_value_get_object (value); @@ -2402,7 +2402,6 @@ value_added_current_editor (AnjutaPlugin *plugin, const char *name, return; BasicAutotoolsPlugin *ba_plugin = ANJUTA_PLUGIN_BASIC_AUTOTOOLS (plugin); - ui = anjuta_shell_get_ui (plugin->shell, NULL); ba_plugin->current_editor = IANJUTA_EDITOR (editor); diff --git a/plugins/build-basic-autotools/plugin.h b/plugins/build-basic-autotools/plugin.h index 8a029e1f8..865420f92 100644 --- a/plugins/build-basic-autotools/plugin.h +++ b/plugins/build-basic-autotools/plugin.h @@ -92,7 +92,7 @@ struct _BasicAutotoolsPluginClass{ typedef struct _BuildContext BuildContext; -BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, gboolean with_view); +BuildContext* build_get_context (BasicAutotoolsPlugin *plugin, const gchar *dir, gboolean with_view, gboolean check_passwd); void build_context_destroy (BuildContext *context); void build_set_command_in_context (BuildContext* context, BuildProgram *prog); -- 2.11.4.GIT