new upstream release - 2.0.5
This commit is contained in:
parent
9e8a026dce
commit
85cf0d65d2
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,2 +1,3 @@
|
|||||||
/libreport-2.0.3.tar.gz
|
/libreport-2.0.3.tar.gz
|
||||||
/libreport-2.0.4.tar.gz
|
/libreport-2.0.4.tar.gz
|
||||||
|
/libreport-2.0.5.tar.gz
|
||||||
|
479
interactive-libreport.patch
Normal file
479
interactive-libreport.patch
Normal file
@ -0,0 +1,479 @@
|
|||||||
|
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c
|
||||||
|
index 2598a7a..784b37e 100644
|
||||||
|
--- a/src/cli/cli-report.c
|
||||||
|
+++ b/src/cli/cli-report.c
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
#include "internal_libreport.h"
|
||||||
|
#include "run-command.h"
|
||||||
|
#include "cli-report.h"
|
||||||
|
+#include "client.h"
|
||||||
|
|
||||||
|
/* Field separator for the crash report file that is edited by user. */
|
||||||
|
#define FIELD_SEP "%----"
|
||||||
|
@@ -404,24 +405,6 @@ static bool ask_yesno(const char *question)
|
||||||
|
return 0 == strncmp(answer, yes, strlen(yes));
|
||||||
|
}
|
||||||
|
|
||||||
|
-/* Returns true if echo has been changed from another state. */
|
||||||
|
-static bool set_echo(bool enable)
|
||||||
|
-{
|
||||||
|
- struct termios t;
|
||||||
|
- if (tcgetattr(STDIN_FILENO, &t) < 0)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- /* No change needed? */
|
||||||
|
- if ((bool)(t.c_lflag & ECHO) == enable)
|
||||||
|
- return false;
|
||||||
|
-
|
||||||
|
- t.c_lflag ^= ECHO;
|
||||||
|
- if (tcsetattr(STDIN_FILENO, TCSANOW, &t) < 0)
|
||||||
|
- perror_msg_and_die("tcsetattr");
|
||||||
|
-
|
||||||
|
- return true;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
/* Returns true if the string contains the specified number. */
|
||||||
|
static bool is_number_in_string(unsigned number, const char *str)
|
||||||
|
{
|
||||||
|
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
|
||||||
|
index 6ed6713..7a0e7e5 100644
|
||||||
|
--- a/src/gui-wizard-gtk/wizard.c
|
||||||
|
+++ b/src/gui-wizard-gtk/wizard.c
|
||||||
|
@@ -17,6 +17,7 @@
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
#include <gtk/gtk.h>
|
||||||
|
+#include "client.h"
|
||||||
|
#include "internal_libreport_gtk.h"
|
||||||
|
#include "wizard.h"
|
||||||
|
|
||||||
|
@@ -1045,14 +1046,186 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g
|
||||||
|
|
||||||
|
/* Read and insert the output into the log pane */
|
||||||
|
char buf[257]; /* usually we get one line, no need to have big buf */
|
||||||
|
+ char *msg; /* one line */
|
||||||
|
+ char *newline;
|
||||||
|
+ char *raw;
|
||||||
|
int r;
|
||||||
|
- while ((r = read(evd->fd, buf, sizeof(buf)-1)) > 0)
|
||||||
|
+ struct strbuf *line = strbuf_new();
|
||||||
|
+
|
||||||
|
+ int alert_prefix_len = strlen(REPORT_PREFIX_ALERT);
|
||||||
|
+ int ask_prefix_len = strlen(REPORT_PREFIX_ASK);
|
||||||
|
+ int ask_yes_no_prefix_len = strlen(REPORT_PREFIX_ASK_YES_NO);
|
||||||
|
+ int ask_password_prefix_len = strlen(REPORT_PREFIX_ASK_PASSWORD);
|
||||||
|
+
|
||||||
|
+ /* read buffered and split lines */
|
||||||
|
+ while ((r = read(evd->fd, buf, sizeof(buf) - 1)) > 0)
|
||||||
|
{
|
||||||
|
buf[r] = '\0';
|
||||||
|
- append_to_textview(evd->tv_log, buf);
|
||||||
|
- save_to_event_log(evd, buf);
|
||||||
|
+ raw = buf;
|
||||||
|
+
|
||||||
|
+ /* split lines in the current buffer */
|
||||||
|
+ while ((newline = strchr(raw, '\n')) != NULL)
|
||||||
|
+ {
|
||||||
|
+ *newline = '\0';
|
||||||
|
+ /* finish line */
|
||||||
|
+ strbuf_append_str(line, raw);
|
||||||
|
+ strbuf_append_char(line, '\n');
|
||||||
|
+
|
||||||
|
+ msg = line->buf;
|
||||||
|
+
|
||||||
|
+ /* alert dialog */
|
||||||
|
+ if (strncmp(REPORT_PREFIX_ALERT, msg, alert_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += alert_prefix_len;
|
||||||
|
+
|
||||||
|
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
|
||||||
|
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
+ GTK_MESSAGE_WARNING,
|
||||||
|
+ GTK_BUTTONS_CLOSE,
|
||||||
|
+ msg);
|
||||||
|
+
|
||||||
|
+ gtk_dialog_run(GTK_DIALOG(dialog));
|
||||||
|
+ gtk_widget_destroy(dialog);
|
||||||
|
+ }
|
||||||
|
+ /* ask dialog with textbox */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK, msg, ask_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_prefix_len;
|
||||||
|
+
|
||||||
|
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
|
||||||
|
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
+ GTK_MESSAGE_QUESTION,
|
||||||
|
+ GTK_BUTTONS_OK_CANCEL,
|
||||||
|
+ msg);
|
||||||
|
+
|
||||||
|
+ GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||||
|
+ GtkWidget *textbox = gtk_entry_new();
|
||||||
|
+ gtk_entry_set_editable(GTK_ENTRY(textbox), TRUE);
|
||||||
|
+ gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0);
|
||||||
|
+ gtk_widget_show(textbox);
|
||||||
|
+
|
||||||
|
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
|
||||||
|
+ {
|
||||||
|
+ const char *text = gtk_entry_get_text(GTK_ENTRY(textbox));
|
||||||
|
+ char *response = xasprintf("%s\n", text);
|
||||||
|
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
|
||||||
|
+ {
|
||||||
|
+ free(response);
|
||||||
|
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", text);
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(response);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
|
||||||
|
+ {
|
||||||
|
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ gtk_widget_destroy(textbox);
|
||||||
|
+ gtk_widget_destroy(dialog);
|
||||||
|
+ }
|
||||||
|
+ /* ask dialog with passwordbox */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK_PASSWORD, msg, ask_password_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_password_prefix_len;
|
||||||
|
+
|
||||||
|
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
|
||||||
|
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
+ GTK_MESSAGE_QUESTION,
|
||||||
|
+ GTK_BUTTONS_OK_CANCEL,
|
||||||
|
+ msg);
|
||||||
|
+
|
||||||
|
+ GtkWidget *vbox = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
|
||||||
|
+ GtkWidget *textbox = gtk_entry_new();
|
||||||
|
+ gtk_entry_set_editable(GTK_ENTRY(textbox), TRUE);
|
||||||
|
+ gtk_entry_set_visibility(GTK_ENTRY(textbox), FALSE);
|
||||||
|
+ gtk_box_pack_start(GTK_BOX(vbox), textbox, TRUE, TRUE, 0);
|
||||||
|
+ gtk_widget_show(textbox);
|
||||||
|
+
|
||||||
|
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK)
|
||||||
|
+ {
|
||||||
|
+ const char *text = gtk_entry_get_text(GTK_ENTRY(textbox));
|
||||||
|
+ char *response = xasprintf("%s\n", text);
|
||||||
|
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
|
||||||
|
+ {
|
||||||
|
+ free(response);
|
||||||
|
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", text);
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(response);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
|
||||||
|
+ {
|
||||||
|
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ gtk_widget_destroy(textbox);
|
||||||
|
+ gtk_widget_destroy(dialog);
|
||||||
|
+ }
|
||||||
|
+ /* yes/no dialog */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK_YES_NO, msg, ask_yes_no_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_yes_no_prefix_len;
|
||||||
|
+
|
||||||
|
+ GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_assistant),
|
||||||
|
+ GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
|
+ GTK_MESSAGE_QUESTION,
|
||||||
|
+ GTK_BUTTONS_YES_NO,
|
||||||
|
+ msg);
|
||||||
|
+
|
||||||
|
+ if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES)
|
||||||
|
+ {
|
||||||
|
+ char *yes = _("y");
|
||||||
|
+ char *response = xasprintf("%s\n", yes);
|
||||||
|
+ if (write(evd->run_state->command_in_fd, response, strlen(response)) < 0)
|
||||||
|
+ {
|
||||||
|
+ free(response);
|
||||||
|
+ VERB1 perror_msg("Unable to write %s\\n to child's stdin", yes);
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ free(response);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ if (write(evd->run_state->command_in_fd, "\n", strlen("\n")) < 0)
|
||||||
|
+ {
|
||||||
|
+ VERB1 perror_msg("Unable to write \\n to child's stdin");
|
||||||
|
+ return FALSE;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ gtk_widget_destroy(dialog);
|
||||||
|
+ }
|
||||||
|
+ /* no special prefix - forward to log */
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ append_to_textview(evd->tv_log, msg);
|
||||||
|
+ save_to_event_log(evd, msg);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ strbuf_clear(line);
|
||||||
|
+
|
||||||
|
+ /* jump to next line */
|
||||||
|
+ raw = newline + 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* beginning of next line. the line continues by next read() */
|
||||||
|
+ strbuf_append_str(line, raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
+ strbuf_free(line);
|
||||||
|
+
|
||||||
|
if (r < 0 && errno == EAGAIN)
|
||||||
|
/* We got all buffered data, but fd is still open. Done for now */
|
||||||
|
return TRUE; /* "please don't remove this event (yet)" */
|
||||||
|
diff --git a/src/include/client.h b/src/include/client.h
|
||||||
|
index bbd2f10..8074145 100644
|
||||||
|
--- a/src/include/client.h
|
||||||
|
+++ b/src/include/client.h
|
||||||
|
@@ -22,18 +22,25 @@
|
||||||
|
|
||||||
|
#define REPORT_PREFIX_ASK_YES_NO "ASK_YES_NO "
|
||||||
|
#define REPORT_PREFIX_ASK "ASK "
|
||||||
|
+#define REPORT_PREFIX_ASK_PASSWORD "ASK_PASSWORD "
|
||||||
|
#define REPORT_PREFIX_ALERT "ALERT "
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
+#define set_echo libreport_set_echo
|
||||||
|
+int set_echo(int enable);
|
||||||
|
+
|
||||||
|
#define ask_yes_no libreport_ask_yes_no
|
||||||
|
int ask_yes_no(const char *question);
|
||||||
|
|
||||||
|
#define ask libreport_ask
|
||||||
|
char *ask(const char *question, char *response, int response_len);
|
||||||
|
|
||||||
|
+#define ask_password libreport_ask_password
|
||||||
|
+char *ask_password(const char *question, char *response, int response_len);
|
||||||
|
+
|
||||||
|
#define alert libreport_alert
|
||||||
|
void alert(const char *message);
|
||||||
|
|
||||||
|
diff --git a/src/include/run_event.h b/src/include/run_event.h
|
||||||
|
index f7ae9ed..43730ce 100644
|
||||||
|
--- a/src/include/run_event.h
|
||||||
|
+++ b/src/include/run_event.h
|
||||||
|
@@ -44,6 +44,7 @@ struct run_event_state {
|
||||||
|
GList *rule_list;
|
||||||
|
pid_t command_pid;
|
||||||
|
int command_out_fd;
|
||||||
|
+ int command_in_fd;
|
||||||
|
};
|
||||||
|
struct run_event_state *new_run_event_state(void);
|
||||||
|
void free_run_event_state(struct run_event_state *state);
|
||||||
|
diff --git a/src/lib/client.c b/src/lib/client.c
|
||||||
|
index 88a995b..103828b 100644
|
||||||
|
--- a/src/lib/client.c
|
||||||
|
+++ b/src/lib/client.c
|
||||||
|
@@ -25,6 +25,24 @@ static int is_slave_mode()
|
||||||
|
return getenv("REPORT_CLIENT_SLAVE") != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Returns 1 if echo has been changed from another state. */
|
||||||
|
+int set_echo(int enable)
|
||||||
|
+{
|
||||||
|
+ struct termios t;
|
||||||
|
+ if (tcgetattr(STDIN_FILENO, &t) < 0)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ /* No change needed? */
|
||||||
|
+ if ((t.c_lflag & ECHO) == enable)
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+ t.c_lflag ^= ECHO;
|
||||||
|
+ if (tcsetattr(STDIN_FILENO, TCSANOW, &t) < 0)
|
||||||
|
+ perror_msg_and_die("tcsetattr");
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
int ask_yes_no(const char *question)
|
||||||
|
{
|
||||||
|
const char *yes = _("y");
|
||||||
|
@@ -32,12 +50,7 @@ int ask_yes_no(const char *question)
|
||||||
|
|
||||||
|
char *env_response = getenv("REPORT_CLIENT_RESPONSE");
|
||||||
|
if (env_response)
|
||||||
|
- {
|
||||||
|
- if (strncasecmp(yes, env_response, strlen(yes)) == 0)
|
||||||
|
- return true;
|
||||||
|
- if (strncasecmp(no, env_response, strlen(no)) == 0)
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
+ return strncasecmp(yes, env_response, strlen(yes)) == 0;
|
||||||
|
|
||||||
|
if (is_slave_mode())
|
||||||
|
printf(REPORT_PREFIX_ASK_YES_NO "%s\n", question);
|
||||||
|
@@ -48,7 +61,7 @@ int ask_yes_no(const char *question)
|
||||||
|
|
||||||
|
char response[16];
|
||||||
|
if (NULL == fgets(response, sizeof(response), stdin))
|
||||||
|
- return false;
|
||||||
|
+ return 0;
|
||||||
|
|
||||||
|
return strncasecmp(yes, response, strlen(yes)) == 0;
|
||||||
|
}
|
||||||
|
@@ -65,6 +78,22 @@ char *ask(const char *question, char *response, int response_len)
|
||||||
|
return fgets(response, response_len, stdin);
|
||||||
|
}
|
||||||
|
|
||||||
|
+char *ask_password(const char *question, char *response, int response_len)
|
||||||
|
+{
|
||||||
|
+ if (is_slave_mode())
|
||||||
|
+ printf(REPORT_PREFIX_ASK_PASSWORD "%s\n", question);
|
||||||
|
+ else
|
||||||
|
+ printf("%s ", question);
|
||||||
|
+
|
||||||
|
+ fflush(stdout);
|
||||||
|
+
|
||||||
|
+ set_echo(false);
|
||||||
|
+ char *result = fgets(response, response_len, stdin);
|
||||||
|
+ set_echo(true);
|
||||||
|
+
|
||||||
|
+ return result;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
void alert(const char *message)
|
||||||
|
{
|
||||||
|
if (is_slave_mode())
|
||||||
|
diff --git a/src/lib/run_event.c b/src/lib/run_event.c
|
||||||
|
index 0594bde..ba9920c 100644
|
||||||
|
--- a/src/lib/run_event.c
|
||||||
|
+++ b/src/lib/run_event.c
|
||||||
|
@@ -18,6 +18,7 @@
|
||||||
|
*/
|
||||||
|
#include <glob.h>
|
||||||
|
#include <regex.h>
|
||||||
|
+#include "client.h"
|
||||||
|
#include "internal_libreport.h"
|
||||||
|
|
||||||
|
struct run_event_state *new_run_event_state()
|
||||||
|
@@ -393,7 +394,7 @@ int spawn_next_command(struct run_event_state *state,
|
||||||
|
VERB1 log("Executing '%s'", cmd);
|
||||||
|
|
||||||
|
/* Export some useful environment variables for children */
|
||||||
|
- char *env_vec[3];
|
||||||
|
+ char *env_vec[4];
|
||||||
|
/* Just exporting dump_dir_name isn't always ok: it can be "."
|
||||||
|
* and some children want to cd to other directory but still
|
||||||
|
* be able to find dump directory by using $DUMP_DIR...
|
||||||
|
@@ -402,7 +403,8 @@ int spawn_next_command(struct run_event_state *state,
|
||||||
|
env_vec[0] = xasprintf("DUMP_DIR=%s", (full_name ? full_name : dump_dir_name));
|
||||||
|
free(full_name);
|
||||||
|
env_vec[1] = xasprintf("EVENT=%s", event);
|
||||||
|
- env_vec[2] = NULL;
|
||||||
|
+ env_vec[2] = xasprintf("REPORT_CLIENT_SLAVE=1");
|
||||||
|
+ env_vec[3] = NULL;
|
||||||
|
|
||||||
|
char *argv[4];
|
||||||
|
argv[0] = (char*)"/bin/sh"; // TODO: honor $SHELL?
|
||||||
|
@@ -412,7 +414,7 @@ int spawn_next_command(struct run_event_state *state,
|
||||||
|
|
||||||
|
int pipefds[2];
|
||||||
|
state->command_pid = fork_execv_on_steroids(
|
||||||
|
- EXECFLG_INPUT_NUL + EXECFLG_OUTPUT + EXECFLG_ERR2OUT,
|
||||||
|
+ EXECFLG_INPUT + EXECFLG_OUTPUT + EXECFLG_ERR2OUT,
|
||||||
|
argv,
|
||||||
|
pipefds,
|
||||||
|
/* env_vec: */ env_vec,
|
||||||
|
@@ -420,9 +422,11 @@ int spawn_next_command(struct run_event_state *state,
|
||||||
|
/* uid(unused): */ 0
|
||||||
|
);
|
||||||
|
state->command_out_fd = pipefds[0];
|
||||||
|
+ state->command_in_fd = pipefds[1];
|
||||||
|
|
||||||
|
free(env_vec[0]);
|
||||||
|
free(env_vec[1]);
|
||||||
|
+ free(env_vec[2]);
|
||||||
|
free(cmd);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
@@ -447,10 +451,68 @@ int run_event_on_dir_name(struct run_event_state *state,
|
||||||
|
if (!fp)
|
||||||
|
die_out_of_memory();
|
||||||
|
char *buf;
|
||||||
|
+ char *msg;
|
||||||
|
+
|
||||||
|
+ int alert_prefix_len = strlen(REPORT_PREFIX_ALERT);
|
||||||
|
+ int ask_prefix_len = strlen(REPORT_PREFIX_ASK);
|
||||||
|
+ int ask_yes_no_prefix_len = strlen(REPORT_PREFIX_ASK_YES_NO);
|
||||||
|
+ int ask_password_prefix_len = strlen(REPORT_PREFIX_ASK_PASSWORD);
|
||||||
|
+
|
||||||
|
while ((buf = xmalloc_fgetline(fp)) != NULL)
|
||||||
|
{
|
||||||
|
- if (state->logging_callback)
|
||||||
|
- buf = state->logging_callback(buf, state->logging_param);
|
||||||
|
+ msg = buf;
|
||||||
|
+
|
||||||
|
+ /* just cut off prefix, no waiting */
|
||||||
|
+ if (strncmp(REPORT_PREFIX_ALERT, msg, alert_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += alert_prefix_len;
|
||||||
|
+ printf("%s\n", msg);
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ }
|
||||||
|
+ /* wait for y/N response on the same line */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK_YES_NO, msg, ask_yes_no_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_yes_no_prefix_len;
|
||||||
|
+ printf("%s [%s/%s] ", msg, _("y"), _("N"));
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ char buf[16];
|
||||||
|
+ if (!fgets(buf, sizeof(buf), stdin))
|
||||||
|
+ buf[0] = '\0';
|
||||||
|
+
|
||||||
|
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
|
||||||
|
+ perror_msg_and_die("write");
|
||||||
|
+ }
|
||||||
|
+ /* wait for the string on the same line */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK, msg, ask_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_prefix_len;
|
||||||
|
+ printf("%s ", msg);
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ char buf[256];
|
||||||
|
+ if (!fgets(buf, sizeof(buf), stdin))
|
||||||
|
+ buf[0] = '\0';
|
||||||
|
+
|
||||||
|
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
|
||||||
|
+ perror_msg_and_die("write");
|
||||||
|
+ }
|
||||||
|
+ /* set echo off and wait for password on the same line */
|
||||||
|
+ else if (strncmp(REPORT_PREFIX_ASK_PASSWORD, msg, ask_password_prefix_len) == 0)
|
||||||
|
+ {
|
||||||
|
+ msg += ask_password_prefix_len;
|
||||||
|
+ printf("%s ", msg);
|
||||||
|
+ fflush(stdout);
|
||||||
|
+ char buf[256];
|
||||||
|
+ set_echo(false);
|
||||||
|
+ if (!fgets(buf, sizeof(buf), stdin))
|
||||||
|
+ buf[0] = '\0';
|
||||||
|
+ set_echo(true);
|
||||||
|
+
|
||||||
|
+ if (write(state->command_in_fd, buf, strlen(buf)) < 0)
|
||||||
|
+ perror_msg_and_die("write");
|
||||||
|
+ }
|
||||||
|
+ /* no special prefix -> forward to log if applicable */
|
||||||
|
+ else if (state->logging_callback)
|
||||||
|
+ msg = state->logging_callback(msg, state->logging_param);
|
||||||
|
free(buf);
|
||||||
|
}
|
||||||
|
fclose(fp); /* Got EOF, close. This also closes state->command_out_fd */
|
176
libreport.spec
176
libreport.spec
@ -4,19 +4,17 @@
|
|||||||
|
|
||||||
Summary: Generic library for reporting various problems
|
Summary: Generic library for reporting various problems
|
||||||
Name: libreport
|
Name: libreport
|
||||||
Version: 2.0.4
|
Version: 2.0.5
|
||||||
Release: 3%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: System Environment/Libraries
|
Group: System Environment/Libraries
|
||||||
URL: https://fedorahosted.org/abrt/
|
URL: https://fedorahosted.org/abrt/
|
||||||
Source: https://fedorahosted.org/released/abrt/%{name}-%{version}.tar.gz
|
Source: https://fedorahosted.org/released/abrt/%{name}-%{version}.tar.gz
|
||||||
Patch0: remove_pyreport.patch
|
Patch0: interactive-libreport.patch
|
||||||
BuildRequires: dbus-devel
|
BuildRequires: dbus-devel
|
||||||
BuildRequires: gtk2-devel
|
BuildRequires: gtk2-devel
|
||||||
BuildRequires: curl-devel
|
BuildRequires: curl-devel
|
||||||
BuildRequires: rpm-devel >= 4.6
|
|
||||||
BuildRequires: desktop-file-utils
|
BuildRequires: desktop-file-utils
|
||||||
BuildRequires: libnotify-devel
|
|
||||||
BuildRequires: xmlrpc-c-devel
|
BuildRequires: xmlrpc-c-devel
|
||||||
BuildRequires: python-devel
|
BuildRequires: python-devel
|
||||||
BuildRequires: gettext
|
BuildRequires: gettext
|
||||||
@ -28,6 +26,12 @@ BuildRequires: nss-devel
|
|||||||
BuildRequires: texinfo
|
BuildRequires: texinfo
|
||||||
BuildRequires: asciidoc
|
BuildRequires: asciidoc
|
||||||
BuildRequires: xmlto
|
BuildRequires: xmlto
|
||||||
|
BuildRequires: newt-devel
|
||||||
|
# required for update from old report library, otherwise we obsolete report-gtk
|
||||||
|
# and all it's plugins, but don't provide the python bindings and the sealert
|
||||||
|
# end-up with: can't import report.GtkIO
|
||||||
|
# FIXME: can be removed when F15 will EOLed, needs to stay in rhel6!
|
||||||
|
Requires: libreport-python
|
||||||
|
|
||||||
# for rhel6
|
# for rhel6
|
||||||
%if 0%{?rhel} >= 6
|
%if 0%{?rhel} >= 6
|
||||||
@ -50,6 +54,21 @@ Requires: libreport = %{version}-%{release}
|
|||||||
%description devel
|
%description devel
|
||||||
Development libraries and headers for libreport
|
Development libraries and headers for libreport
|
||||||
|
|
||||||
|
%package python
|
||||||
|
Summary: Python bindings for report-libs
|
||||||
|
# Is group correct here? -
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: libreport = %{version}-%{release}
|
||||||
|
Provides: report = 0.22-1
|
||||||
|
Obsoletes: report < 0.22-1
|
||||||
|
# in report the rhtsupport is in the main package, so we need to install it too
|
||||||
|
%if 0%{?rhel} >= 6
|
||||||
|
Requires: libreport-plugin-rhtsupport
|
||||||
|
%endif
|
||||||
|
|
||||||
|
%description python
|
||||||
|
Python bindings for report-libs.
|
||||||
|
|
||||||
%package cli
|
%package cli
|
||||||
Summary: %{name}'s command line interface
|
Summary: %{name}'s command line interface
|
||||||
Group: User Interface/Desktops
|
Group: User Interface/Desktops
|
||||||
@ -59,10 +78,23 @@ Requires: %{name} = %{version}-%{release}
|
|||||||
This package contains simple command line tool for working
|
This package contains simple command line tool for working
|
||||||
with problem dump reports
|
with problem dump reports
|
||||||
|
|
||||||
|
%package newt
|
||||||
|
Summary: %{name}'s newt interface
|
||||||
|
Group: User Interface/Desktops
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Provides: report-newt = 0.22-1
|
||||||
|
Obsoletes: report-newt < 0.22-1
|
||||||
|
|
||||||
|
%description newt
|
||||||
|
This package contains a simple newt application for reporting
|
||||||
|
bugs
|
||||||
|
|
||||||
%package gtk
|
%package gtk
|
||||||
Summary: GTK front-end for libreport
|
Summary: GTK front-end for libreport
|
||||||
Group: User Interface/Desktops
|
Group: User Interface/Desktops
|
||||||
Requires: libreport = %{version}-%{release}
|
Requires: libreport = %{version}-%{release}
|
||||||
|
Provides: report-gtk = 0.22-1
|
||||||
|
Obsoletes: report-gtk < 0.22-1
|
||||||
|
|
||||||
%description gtk
|
%description gtk
|
||||||
Applications for reporting bugs using libreport backend
|
Applications for reporting bugs using libreport backend
|
||||||
@ -75,9 +107,82 @@ Requires: libreport-gtk = %{version}-%{release}
|
|||||||
%description gtk-devel
|
%description gtk-devel
|
||||||
Development libraries and headers for libreport-gtk
|
Development libraries and headers for libreport-gtk
|
||||||
|
|
||||||
|
%package plugin-kerneloops
|
||||||
|
Summary: %{name}'s kerneloops reporter plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: curl
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
|
||||||
|
%description plugin-kerneloops
|
||||||
|
This package contains plugin which sends kernel crash information to specified
|
||||||
|
server, usually to kerneloops.org.
|
||||||
|
|
||||||
|
%package plugin-logger
|
||||||
|
Summary: %{name}'s logger reporter plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Obsoletes: abrt-plugin-logger < 2.0.4
|
||||||
|
Provides: report-plugin-localsave = 0.22-1
|
||||||
|
Obsoletes: report-plugin-localsave < 0.22-1
|
||||||
|
Provides: report-config-localsave = 0.22-1
|
||||||
|
Obsoletes: report-config-localsave < 0.22-1
|
||||||
|
|
||||||
|
%description plugin-logger
|
||||||
|
The simple reporter plugin which writes a report to a specified file.
|
||||||
|
|
||||||
|
%package plugin-mailx
|
||||||
|
Summary: %{name}'s mailx reporter plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Requires: mailx
|
||||||
|
Obsoletes: abrt-plugin-mailx < 2.0.4
|
||||||
|
|
||||||
|
%description plugin-mailx
|
||||||
|
The simple reporter plugin which sends a report via mailx to a specified
|
||||||
|
email address.
|
||||||
|
|
||||||
|
%package plugin-bugzilla
|
||||||
|
Summary: %{name}'s bugzilla plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Obsoletes: abrt-plugin-bugzilla < 2.0.4
|
||||||
|
Provides: report-plugin-bugzilla = 0.22-1
|
||||||
|
Obsoletes: report-plugin-bugzilla < 0.22-1
|
||||||
|
Provides: report-config-bugzilla-redhat-com = 0.22-1
|
||||||
|
Obsoletes: report-config-bugzilla-redhat-com < 0.22-1
|
||||||
|
|
||||||
|
%description plugin-bugzilla
|
||||||
|
Plugin to report bugs into the bugzilla.
|
||||||
|
|
||||||
|
%package plugin-rhtsupport
|
||||||
|
Summary: %{name}'s RHTSupport plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Obsoletes: abrt-plugin-rhtsupport < 2.0.4
|
||||||
|
|
||||||
|
%description plugin-rhtsupport
|
||||||
|
Plugin to report bugs into RH support system.
|
||||||
|
|
||||||
|
%package plugin-reportuploader
|
||||||
|
Summary: %{name}'s reportuploader plugin
|
||||||
|
Group: System Environment/Libraries
|
||||||
|
Requires: %{name} = %{version}-%{release}
|
||||||
|
Obsoletes: abrt-plugin-reportuploader < 2.0.4
|
||||||
|
Provides: report-plugin-ftp = 0.22-1
|
||||||
|
Obsoletes: report-plugin-ftp < 0.22-1
|
||||||
|
Provides: report-config-ftp = 0.22-1
|
||||||
|
Obsoletes: report-config-ftp < 0.22-1
|
||||||
|
Provides: report-plugin-scp = 0.22-1
|
||||||
|
Obsoletes: report-plugin-scp < 0.22-1
|
||||||
|
Provides: report-config-scp = 0.22-1
|
||||||
|
Obsoletes: report-config-scp < 0.22-1
|
||||||
|
|
||||||
|
%description plugin-reportuploader
|
||||||
|
Plugin to report bugs into anonymous FTP site associated with ticketing system.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch0 -p1 -b remove_python
|
%patch0 -p1 -b .interactive
|
||||||
|
|
||||||
%build
|
%build
|
||||||
autoconf
|
autoconf
|
||||||
@ -132,10 +237,13 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
|||||||
%config(noreplace) %{_sysconfdir}/%{name}/report_event.conf
|
%config(noreplace) %{_sysconfdir}/%{name}/report_event.conf
|
||||||
%{_libdir}/libreport.so.*
|
%{_libdir}/libreport.so.*
|
||||||
%{_libdir}/libabrt_dbus.so.*
|
%{_libdir}/libabrt_dbus.so.*
|
||||||
|
%{_libdir}/libabrt_web.so.*
|
||||||
|
%exclude %{_libdir}/libabrt_web.so
|
||||||
|
|
||||||
%files devel
|
%files devel
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
# Public api headers:
|
# Public api headers:
|
||||||
|
%{_includedir}/libreport/client.h
|
||||||
%{_includedir}/libreport/dump_dir.h
|
%{_includedir}/libreport/dump_dir.h
|
||||||
%{_includedir}/libreport/event_config.h
|
%{_includedir}/libreport/event_config.h
|
||||||
%{_includedir}/libreport/problem_data.h
|
%{_includedir}/libreport/problem_data.h
|
||||||
@ -149,11 +257,19 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
|||||||
%{_libdir}/pkgconfig/libreport.pc
|
%{_libdir}/pkgconfig/libreport.pc
|
||||||
%dir %{_includedir}/libreport
|
%dir %{_includedir}/libreport
|
||||||
|
|
||||||
|
%files python
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{python_sitearch}/report/*
|
||||||
|
|
||||||
%files cli
|
%files cli
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_bindir}/report-cli
|
%{_bindir}/report-cli
|
||||||
%{_mandir}/man1/report-cli.1.gz
|
%{_mandir}/man1/report-cli.1.gz
|
||||||
|
|
||||||
|
%files newt
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_bindir}/report-newt
|
||||||
|
|
||||||
%files gtk
|
%files gtk
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_bindir}/report-gtk
|
%{_bindir}/report-gtk
|
||||||
@ -162,10 +278,56 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
|
|||||||
%files gtk-devel
|
%files gtk-devel
|
||||||
%defattr(-,root,root,-)
|
%defattr(-,root,root,-)
|
||||||
%{_libdir}/libreport-gtk.so
|
%{_libdir}/libreport-gtk.so
|
||||||
%{_includedir}/libreport/libreport-gtk.h
|
%{_includedir}/libreport/internal_libreport_gtk.h
|
||||||
%{_libdir}/pkgconfig/libreport-gtk.pc
|
%{_libdir}/pkgconfig/libreport-gtk.pc
|
||||||
|
|
||||||
|
%files plugin-kerneloops
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_sysconfdir}/libreport/events/report_Kerneloops.xml
|
||||||
|
%{_mandir}/man*/reporter-kerneloops.*
|
||||||
|
%{_bindir}/reporter-kerneloops
|
||||||
|
|
||||||
|
%files plugin-logger
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_sysconfdir}/libreport/events/report_Logger.conf
|
||||||
|
%config(noreplace) %{_sysconfdir}/libreport/events.d/print_event.conf
|
||||||
|
%{_bindir}/reporter-print
|
||||||
|
%{_mandir}/man*/reporter-print.*
|
||||||
|
|
||||||
|
%files plugin-mailx
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_sysconfdir}/libreport/events/report_Mailx.xml
|
||||||
|
%config(noreplace) %{_sysconfdir}/libreport/events.d/mailx_event.conf
|
||||||
|
%{_mandir}/man*/reporter-mailx.*
|
||||||
|
%{_bindir}/reporter-mailx
|
||||||
|
|
||||||
|
%files plugin-bugzilla
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%config(noreplace) %{_sysconfdir}/libreport/plugins/Bugzilla.conf
|
||||||
|
%{_sysconfdir}/libreport/events/report_Bugzilla.xml
|
||||||
|
%config(noreplace) %{_sysconfdir}/libreport/events/report_Bugzilla.conf
|
||||||
|
# FIXME: remove with the old gui
|
||||||
|
%{_mandir}/man1/reporter-bugzilla.1.gz
|
||||||
|
%{_bindir}/reporter-bugzilla
|
||||||
|
|
||||||
|
%files plugin-rhtsupport
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_sysconfdir}/libreport/events/report_RHTSupport.xml
|
||||||
|
%config(noreplace) %{_sysconfdir}/libreport/events.d/rhtsupport_event.conf
|
||||||
|
# {_mandir}/man7/abrt-RHTSupport.7.gz
|
||||||
|
%{_bindir}/reporter-rhtsupport
|
||||||
|
|
||||||
|
%files plugin-reportuploader
|
||||||
|
%defattr(-,root,root,-)
|
||||||
|
%{_mandir}/man*/reporter-upload.*
|
||||||
|
%{_bindir}/reporter-upload
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 18 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.5-1
|
||||||
|
- move reporter plugins from abrt to libreport
|
||||||
|
- fixed provides/obsolete to properly obsolete report package
|
||||||
|
- wizard: make more fields editable
|
||||||
|
|
||||||
* Mon Jul 11 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.4-3
|
* Mon Jul 11 2011 Jiri Moskovcak <jmoskovc@redhat.com> 2.0.4-3
|
||||||
- bump release
|
- bump release
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user