From 28c588d6a86daa3d2f2bb7cdb4604d79e7dcf08b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 9 Dec 2010 12:29:54 +0100 Subject: create report-libs-devel package; separate out report headers Signed-off-by: Denys Vlasenko --- src/applet/Makefile.am | 12 ++--- src/cli/Makefile.am | 5 +- src/cli/report.cpp | 19 ++++---- src/daemon/Makefile.am | 8 ++-- src/hooks/Makefile.am | 8 ++-- src/include/Makefile.am | 16 +++---- src/include/crash_dump.h | 100 ---------------------------------------- src/include/dump_dir.h | 68 --------------------------- src/include/report/crash_dump.h | 100 ++++++++++++++++++++++++++++++++++++++++ src/include/report/dump_dir.h | 68 +++++++++++++++++++++++++++ src/include/report/run_event.h | 48 +++++++++++++++++++ src/include/run_event.h | 48 ------------------- src/lib/Makefile.am | 20 ++++---- src/plugins/Makefile.am | 56 +++++++++++++--------- 14 files changed, 292 insertions(+), 284 deletions(-) delete mode 100644 src/include/crash_dump.h delete mode 100644 src/include/dump_dir.h create mode 100644 src/include/report/crash_dump.h create mode 100644 src/include/report/dump_dir.h create mode 100644 src/include/report/run_event.h delete mode 100644 src/include/run_event.h (limited to 'src') diff --git a/src/applet/Makefile.am b/src/applet/Makefile.am index d32eaa37..dbd88bdf 100644 --- a/src/applet/Makefile.am +++ b/src/applet/Makefile.am @@ -5,11 +5,8 @@ abrt_applet_SOURCES = \ Applet.cpp \ applet_gtk.h applet_gtk.c abrt_applet_CPPFLAGS = \ - -Wall -Werror \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ - -I/usr/include/glib-2.0 \ - -I/usr/lib/glib-2.0/include \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ -DCONF_DIR=\"$(CONF_DIR)\" \ @@ -19,7 +16,10 @@ abrt_applet_CPPFLAGS = \ -DICON_DIR=\"${datadir}/abrt/icons/hicolor/48x48/status\" \ $(GTK_CFLAGS) \ $(DBUS_CFLAGS) \ - -D_GNU_SOURCE + -D_GNU_SOURCE \ + -Wall -Werror +# -I/usr/include/glib-2.0 +# -I/usr/lib/glib-2.0/include # $(LIBNOTIFY_CFLAGS) # $(DBUS_GLIB_CFLAGS) abrt_applet_LDADD = \ @@ -35,7 +35,7 @@ abrt_applet_LDADD = \ # test_report.cpp #test_report_CPPFLAGS = \ # -Wall -Werror \ -# -I$(srcdir)/../include \ +# -I$(srcdir)/../include/report -I$(srcdir)/../include \ # -D_GNU_SOURCE #test_report_LDADD = \ # ../lib/libabrt.la diff --git a/src/cli/Makefile.am b/src/cli/Makefile.am index 3584fd6c..9346dd16 100644 --- a/src/cli/Makefile.am +++ b/src/cli/Makefile.am @@ -7,12 +7,13 @@ abrt_cli_SOURCES = \ dbus.h dbus.cpp abrt_cli_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(ENABLE_SOCKET_OR_DBUS) \ $(DBUS_CFLAGS) $(GLIB_CFLAGS) \ - -D_GNU_SOURCE + -D_GNU_SOURCE \ + -Wall -Werror # $(GTK_CFLAGS) abrt_cli_LDADD = \ diff --git a/src/cli/report.cpp b/src/cli/report.cpp index 556e06b4..f87486a7 100644 --- a/src/cli/report.cpp +++ b/src/cli/report.cpp @@ -356,15 +356,14 @@ static int run_report_editor(crash_data_t *crash_data) FILE *fp = fdopen(fd, "w"); if (!fp) /* errno is set */ { - perror_msg("can't open '%s' to save the crash report", filename); - return 2; + die_out_of_memory(); } write_crash_report(crash_data, fp); if (fclose(fp)) /* errno is set */ { - perror_msg("can't close '%s'", filename); + perror_msg("can't write '%s'", filename); return 2; } @@ -381,21 +380,18 @@ static int run_report_editor(crash_data_t *crash_data) } fseek(fp, 0, SEEK_END); - long size = ftell(fp); + unsigned long size = ftell(fp); fseek(fp, 0, SEEK_SET); char *text = (char*)xmalloc(size + 1); if (fread(text, 1, size, fp) != size) { error_msg("can't read '%s'", filename); + fclose(fp); return 2; } text[size] = '\0'; - if (fclose(fp) != 0) /* errno is set */ - { - perror_msg("can't close '%s'", filename); - return 2; - } + fclose(fp); // Delete the tempfile. if (unlink(filename) == -1) /* errno is set */ @@ -448,7 +444,8 @@ static bool ask_yesno(const char *question) fflush(NULL); char answer[16]; - fgets(answer, sizeof(answer), stdin); + if (!fgets(answer, sizeof(answer), stdin)) + return false; /* Use strncmp here because the answer might contain a newline as the last char. */ return 0 == strncmp(answer, yes, strlen(yes)); @@ -529,7 +526,7 @@ static GHashTable *get_reporter_plugin_settings(const vector_string_t& reporters /* Load plugin config in the home dir. Do not skip lines * with empty value (but containing a "key="), * because user may want to override password - * from /etc/abrt/plugins/*.conf, but he prefers to + * from /etc/abrt/plugins/foo.conf, but he prefers to * enter it every time he reports. */ map_string_h *single_plugin_settings = new_map_string(); char *path = xasprintf("%s/.abrt/%s.conf", homedir, key); diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am index d25a21b1..1362bb0c 100644 --- a/src/daemon/Makefile.am +++ b/src/daemon/Makefile.am @@ -18,7 +18,7 @@ abrtd_SOURCES = \ Settings.h Settings.cpp \ Daemon.h Daemon.cpp abrtd_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -43,7 +43,7 @@ abrtd_LDADD = \ abrt_server_SOURCES = \ abrt-server.c abrt_server_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -61,7 +61,7 @@ abrt_server_LDADD = \ abrt_handle_crashdump_SOURCES = \ abrt-handle-crashdump.c abrt_handle_crashdump_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -83,7 +83,7 @@ abrt_action_save_package_data_SOURCES = \ Settings.h Settings.cpp \ abrt-action-save-package-data.cpp abrt_action_save_package_data_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ diff --git a/src/hooks/Makefile.am b/src/hooks/Makefile.am index eedf1a60..0ba2ad57 100644 --- a/src/hooks/Makefile.am +++ b/src/hooks/Makefile.am @@ -5,12 +5,13 @@ bin_PROGRAMS = dumpoops abrt_hook_ccpp_SOURCES = \ abrt-hook-ccpp.c abrt_hook_ccpp_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DCONF_DIR=\"$(CONF_DIR)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(GLIB_CFLAGS) \ + -Wall \ -D_GNU_SOURCE abrt_hook_ccpp_LDADD = \ ../lib/libabrt.la @@ -19,7 +20,7 @@ abrt_hook_ccpp_LDADD = \ dumpoops_SOURCES = \ dumpoops.cpp dumpoops_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -I$(srcdir)/../plugins \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ @@ -28,8 +29,9 @@ dumpoops_CPPFLAGS = \ -DCONF_DIR=\"$(CONF_DIR)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(GLIB_CFLAGS) \ + -Wall -Werror \ -D_GNU_SOURCE -# build will succeed, but at runtime plugins do need ABRT*d*Utils +# build will succeed without it, but at runtime plugins do need libabrt_daemon dumpoops_LDADD = \ ../lib/libabrt_daemon.la \ ../lib/libabrt.la diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 5b61bd82..165c705b 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am @@ -1,8 +1,11 @@ -HEADER_FILES = \ - crash_dump.h \ - dump_dir.h \ - run_event.h \ - \ +libreport_includedir = $(includedir)/report +libreport_include_HEADERS = \ + report/crash_dump.h \ + report/dump_dir.h \ + report/run_event.h + +libabrt_includedir = $(includedir)/abrt +libabrt_include_HEADERS = \ abrtlib.h \ abrt_types.h \ comm_layer_inner.h \ @@ -13,6 +16,3 @@ HEADER_FILES = \ action.h \ analyzer.h \ xfuncs.h - -lib_includedir=$(includedir)/abrt/ -lib_include_HEADERS = $(HEADER_FILES) diff --git a/src/include/crash_dump.h b/src/include/crash_dump.h deleted file mode 100644 index 10ddc885..00000000 --- a/src/include/crash_dump.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef CRASH_DUMP_H_ -#define CRASH_DUMP_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -enum { - CD_FLAG_SYS = (1 << 0), - CD_FLAG_BIN = (1 << 1), - CD_FLAG_TXT = (1 << 2), - CD_FLAG_ISEDITABLE = (1 << 3), - CD_FLAG_ISNOTEDITABLE = (1 << 4), -}; - -struct crash_item { - char *content; - unsigned flags; -}; -typedef struct crash_item crash_item; - -/* In-memory crash data structure and accessors */ - -typedef GHashTable crash_data_t; - -crash_data_t *new_crash_data(void); - -static inline void free_crash_data(crash_data_t *crash_data) -{ - if (crash_data) - g_hash_table_destroy(crash_data); -} - -void add_to_crash_data_ext(crash_data_t *crash_data, - const char *name, - const char *content, - unsigned flags); -/* Uses CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE flags */ -void add_to_crash_data(crash_data_t *crash_data, - const char *name, - const char *content); - -static inline struct crash_item *get_crash_data_item_or_NULL(crash_data_t *crash_data, const char *key) -{ - return (struct crash_item *)g_hash_table_lookup(crash_data, key); -} -const char *get_crash_item_content_or_NULL(crash_data_t *crash_data, const char *key); -/* Aborts if key is not found: */ -const char *get_crash_item_content_or_die(crash_data_t *crash_data, const char *key); - - -/* Vector of these structures */ - -typedef GPtrArray vector_of_crash_data_t; - -static inline crash_data_t *get_crash_data(vector_of_crash_data_t *vector, unsigned i) -{ - return (crash_data_t *)g_ptr_array_index(vector, i); -} - -vector_of_crash_data_t *new_vector_of_crash_data(void); -static inline void free_vector_of_crash_data(vector_of_crash_data_t *vector) -{ - if (vector) - g_ptr_array_free(vector, TRUE); -} - - -/* Conversions between in-memory and on-disk formats */ - -crash_data_t *load_crash_data_from_crash_dump_dir(struct dump_dir *dd); -struct dump_dir *create_crash_dump_dir(crash_data_t *crash_data); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/dump_dir.h b/src/include/dump_dir.h deleted file mode 100644 index 8cec9459..00000000 --- a/src/include/dump_dir.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - On-disk storage of crash dumps - - Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef DUMP_DIR_H_ -#define DUMP_DIR_H_ - -/* For DIR */ -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - DD_FAIL_QUIETLY = (1 << 0), -}; - -struct dump_dir { - char *dd_dir; - DIR *next_dir; - int locked; - uid_t dd_uid; - gid_t dd_gid; -}; - -void dd_close(struct dump_dir *dd); - -struct dump_dir *dd_opendir(const char *dir, int flags); -struct dump_dir *dd_create(const char *dir, uid_t uid); -int dd_exist(struct dump_dir *dd, const char *path); -DIR *dd_init_next_file(struct dump_dir *dd); -int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name); - -enum { - /* DD_FAIL_QUIETLY bit is valid for dd_load_text_ext too, */ - DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 1), -}; -char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags); -char* dd_load_text(const struct dump_dir *dd, const char *name); -void dd_save_text(struct dump_dir *dd, const char *name, const char *data); -void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size); -void dd_delete(struct dump_dir *dd); - -void delete_crash_dump_dir(const char *dd_dir); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/include/report/crash_dump.h b/src/include/report/crash_dump.h new file mode 100644 index 00000000..10ddc885 --- /dev/null +++ b/src/include/report/crash_dump.h @@ -0,0 +1,100 @@ +/* + Copyright (C) 2009 Abrt team. + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#ifndef CRASH_DUMP_H_ +#define CRASH_DUMP_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct dump_dir; + +enum { + CD_FLAG_SYS = (1 << 0), + CD_FLAG_BIN = (1 << 1), + CD_FLAG_TXT = (1 << 2), + CD_FLAG_ISEDITABLE = (1 << 3), + CD_FLAG_ISNOTEDITABLE = (1 << 4), +}; + +struct crash_item { + char *content; + unsigned flags; +}; +typedef struct crash_item crash_item; + +/* In-memory crash data structure and accessors */ + +typedef GHashTable crash_data_t; + +crash_data_t *new_crash_data(void); + +static inline void free_crash_data(crash_data_t *crash_data) +{ + if (crash_data) + g_hash_table_destroy(crash_data); +} + +void add_to_crash_data_ext(crash_data_t *crash_data, + const char *name, + const char *content, + unsigned flags); +/* Uses CD_FLAG_TXT + CD_FLAG_ISNOTEDITABLE flags */ +void add_to_crash_data(crash_data_t *crash_data, + const char *name, + const char *content); + +static inline struct crash_item *get_crash_data_item_or_NULL(crash_data_t *crash_data, const char *key) +{ + return (struct crash_item *)g_hash_table_lookup(crash_data, key); +} +const char *get_crash_item_content_or_NULL(crash_data_t *crash_data, const char *key); +/* Aborts if key is not found: */ +const char *get_crash_item_content_or_die(crash_data_t *crash_data, const char *key); + + +/* Vector of these structures */ + +typedef GPtrArray vector_of_crash_data_t; + +static inline crash_data_t *get_crash_data(vector_of_crash_data_t *vector, unsigned i) +{ + return (crash_data_t *)g_ptr_array_index(vector, i); +} + +vector_of_crash_data_t *new_vector_of_crash_data(void); +static inline void free_vector_of_crash_data(vector_of_crash_data_t *vector) +{ + if (vector) + g_ptr_array_free(vector, TRUE); +} + + +/* Conversions between in-memory and on-disk formats */ + +crash_data_t *load_crash_data_from_crash_dump_dir(struct dump_dir *dd); +struct dump_dir *create_crash_dump_dir(crash_data_t *crash_data); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/report/dump_dir.h b/src/include/report/dump_dir.h new file mode 100644 index 00000000..8cec9459 --- /dev/null +++ b/src/include/report/dump_dir.h @@ -0,0 +1,68 @@ +/* + On-disk storage of crash dumps + + Copyright (C) 2009 Zdenek Prikryl (zprikryl@redhat.com) + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#ifndef DUMP_DIR_H_ +#define DUMP_DIR_H_ + +/* For DIR */ +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +enum { + DD_FAIL_QUIETLY = (1 << 0), +}; + +struct dump_dir { + char *dd_dir; + DIR *next_dir; + int locked; + uid_t dd_uid; + gid_t dd_gid; +}; + +void dd_close(struct dump_dir *dd); + +struct dump_dir *dd_opendir(const char *dir, int flags); +struct dump_dir *dd_create(const char *dir, uid_t uid); +int dd_exist(struct dump_dir *dd, const char *path); +DIR *dd_init_next_file(struct dump_dir *dd); +int dd_get_next_file(struct dump_dir *dd, char **short_name, char **full_name); + +enum { + /* DD_FAIL_QUIETLY bit is valid for dd_load_text_ext too, */ + DD_LOAD_TEXT_RETURN_NULL_ON_FAILURE = (1 << 1), +}; +char* dd_load_text_ext(const struct dump_dir *dd, const char *name, unsigned flags); +char* dd_load_text(const struct dump_dir *dd, const char *name); +void dd_save_text(struct dump_dir *dd, const char *name, const char *data); +void dd_save_binary(struct dump_dir *dd, const char *name, const char *data, unsigned size); +void dd_delete(struct dump_dir *dd); + +void delete_crash_dump_dir(const char *dd_dir); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/report/run_event.h b/src/include/report/run_event.h new file mode 100644 index 00000000..c2e34650 --- /dev/null +++ b/src/include/report/run_event.h @@ -0,0 +1,48 @@ +/* + Copyright (C) 2009 Abrt team. + Copyright (C) 2009 RedHat inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +*/ +#ifndef RUN_EVENT_H_ +#define RUN_EVENT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +struct dump_dir; + +struct run_event_state { + int (*post_run_callback)(const char *dump_dir_name, void *param); + void *post_run_param; + char* (*logging_callback)(char *log_line, void *param); + void *logging_param; +}; +struct run_event_state *new_run_event_state(void); +void free_run_event_state(struct run_event_state *state); + +/* Returns exitcode of first failed action, or first nonzero return value + * of post_run_callback. If all actions are successful, returns 0. + * If no actions were run for the event, returns -1. + */ +int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event); +char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/include/run_event.h b/src/include/run_event.h deleted file mode 100644 index c2e34650..00000000 --- a/src/include/run_event.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (C) 2009 Abrt team. - Copyright (C) 2009 RedHat inc. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -*/ -#ifndef RUN_EVENT_H_ -#define RUN_EVENT_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -struct dump_dir; - -struct run_event_state { - int (*post_run_callback)(const char *dump_dir_name, void *param); - void *post_run_param; - char* (*logging_callback)(char *log_line, void *param); - void *logging_param; -}; -struct run_event_state *new_run_event_state(void); -void free_run_event_state(struct run_event_state *state); - -/* Returns exitcode of first failed action, or first nonzero return value - * of post_run_callback. If all actions are successful, returns 0. - * If no actions were run for the event, returns -1. - */ -int run_event(struct run_event_state *state, const char *dump_dir_name, const char *event); -char *list_possible_events(struct dump_dir *dd, const char *dump_dir_name, const char *pfx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 1d6c7dc3..384d1c26 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -8,9 +8,6 @@ lib_LTLIBRARIES = \ libabrt_dbus.la \ libabrt_web.la -HEADER_DIR = $(srcdir)/../include -AM_CPPFLAGS = -I$(HEADER_DIR) - # Not used just yet: # time.cpp # xconnect.cpp @@ -46,7 +43,7 @@ libabrt_la_SOURCES = \ parse_options.c parse_options.h libabrt_la_CPPFLAGS = \ -Wall -Werror \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ @@ -63,8 +60,7 @@ libabrt_la_LIBADD = \ libabrt_dbus_la_SOURCES = \ abrt_dbus.c abrt_dbus.h libabrt_dbus_la_CPPFLAGS = \ - -Wall -Werror \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ @@ -72,6 +68,7 @@ libabrt_dbus_la_CPPFLAGS = \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(GLIB_CFLAGS) \ $(DBUS_CFLAGS) \ + -Wall -Werror \ -D_GNU_SOURCE libabrt_dbus_la_LDFLAGS = \ -version-info 0:1:0 @@ -80,17 +77,18 @@ libabrt_dbus_la_LIBADD = \ $(DBUS_LIBS) libabrt_daemon_la_SOURCES = \ - $(HEADER_DIR)/comm_layer_inner.h CommLayerInner.cpp \ - $(HEADER_DIR)/plugin.h Plugin.cpp + CommLayerInner.cpp \ + Plugin.cpp libabrt_daemon_la_CPPFLAGS = \ - -Wall \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ -DCONF_DIR=\"$(CONF_DIR)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ $(GLIB_CFLAGS) \ + -Wall \ + -Werror \ -D_GNU_SOURCE libabrt_daemon_la_LDFLAGS = \ -version-info 0:1:0 @@ -102,7 +100,7 @@ libabrt_web_la_SOURCES = \ abrt_xmlrpc.h abrt_xmlrpc.cpp libabrt_web_la_CPPFLAGS = \ -Wall -Werror \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DPLUGINS_LIB_DIR=\"$(PLUGINS_LIB_DIR)\" \ -DPLUGINS_CONF_DIR=\"$(PLUGINS_CONF_DIR)\" \ diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 9ace1b3f..8ee69759 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am @@ -1,7 +1,5 @@ -INC_PATH=$(srcdir)/../include -UTILS_PATH=$(srcdir)/../lib -AM_CPPFLAGS = -I$(INC_PATH) -I$(UTILS_PATH) -pluginslibdir=$(PLUGINS_LIB_DIR) +pluginslibdir = $(PLUGINS_LIB_DIR) + libexec_SCRIPTS = \ abrt-action-install-debuginfo.py @@ -18,6 +16,7 @@ dist_pluginslib_DATA = \ KerneloopsReporter.glade pluginsconfdir = $(PLUGINS_CONF_DIR) + dist_pluginsconf_DATA = \ CCpp.conf \ Python.conf \ @@ -49,21 +48,32 @@ install-data-hook: $(DESTDIR)/$(DEBUG_INFO_DIR) $(DESTDIR)$(sysconfdir)/abrt/plugins/Logger.conf # CCpp -libCCpp_la_SOURCES = CCpp.cpp CCpp.h -libCCpp_la_LDFLAGS = -avoid-version -libCCpp_la_CPPFLAGS = -Wall -Werror \ - -I$(INC_PATH) \ - -I$(UTILS_PATH) \ +libCCpp_la_SOURCES = \ + CCpp.cpp CCpp.h +libCCpp_la_CPPFLAGS = \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ + -I$(srcdir)/../lib \ -DCCPP_HOOK_PATH=\"${libexecdir}/abrt-hook-ccpp\" \ -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ -DLOCALSTATEDIR='"$(localstatedir)"' \ - $(GLIB_CFLAGS) + $(GLIB_CFLAGS) \ + -Wall -Werror # -DHOSTILE_KERNEL +libCCpp_la_LDFLAGS = \ + -avoid-version # KerneloopsScanner -libKerneloopsScanner_la_SOURCES = KerneloopsScanner.cpp KerneloopsScanner.h KerneloopsSysLog.cpp KerneloopsSysLog.h -libKerneloopsScanner_la_LDFLAGS = -avoid-version $(GLIB_LIBS) -libKerneloopsScanner_la_CPPFLAGS = -I$(INC_PATH) -I$(UTILS_PATH) -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(GLIB_CFLAGS) +libKerneloopsScanner_la_SOURCES = \ + KerneloopsScanner.cpp KerneloopsScanner.h \ + KerneloopsSysLog.cpp KerneloopsSysLog.h +libKerneloopsScanner_la_CPPFLAGS = \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ + -I$(srcdir)/../lib \ + -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" \ + $(GLIB_CFLAGS) +libKerneloopsScanner_la_LDFLAGS = \ + -avoid-version \ + $(GLIB_LIBS) libexec_PROGRAMS = \ abrt-action-analyze-c \ @@ -80,7 +90,7 @@ libexec_PROGRAMS = \ abrt_action_analyze_c_SOURCES = \ abrt-action-analyze-c.c abrt_action_analyze_c_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -99,7 +109,7 @@ abrt_action_analyze_c_LDADD = \ abrt_action_analyze_python_SOURCES = \ abrt-action-analyze-python.c abrt_action_analyze_python_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -118,7 +128,7 @@ abrt_action_analyze_python_LDADD = \ abrt_action_analyze_oops_SOURCES = \ abrt-action-analyze-oops.c abrt_action_analyze_oops_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -137,7 +147,7 @@ abrt_action_analyze_oops_LDADD = \ abrt_action_generate_backtrace_SOURCES = \ abrt-action-generate-backtrace.c abrt_action_generate_backtrace_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -157,7 +167,7 @@ abrt_action_generate_backtrace_LDADD = \ abrt_action_bugzilla_SOURCES = \ abrt-action-bugzilla.cpp abrt_action_bugzilla_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -179,7 +189,7 @@ abrt_action_rhtsupport_SOURCES = \ abrt_rh_support.h abrt_rh_support.c \ abrt-action-rhtsupport.cpp abrt_action_rhtsupport_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -203,7 +213,7 @@ abrt_action_rhtsupport_LDADD = \ abrt_action_upload_SOURCES = \ abrt-action-upload.cpp abrt_action_upload_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -226,7 +236,7 @@ abrt_action_upload_LDADD = \ abrt_action_kerneloops_SOURCES = \ abrt-action-kerneloops.cpp abrt_action_kerneloops_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -246,7 +256,7 @@ abrt_action_kerneloops_LDADD = \ abrt_action_mailx_SOURCES = \ abrt-action-mailx.cpp abrt_action_mailx_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ @@ -265,7 +275,7 @@ abrt_action_mailx_LDADD = \ abrt_action_print_SOURCES = \ abrt-action-print.cpp abrt_action_print_CPPFLAGS = \ - -I$(srcdir)/../include \ + -I$(srcdir)/../include/report -I$(srcdir)/../include \ -I$(srcdir)/../lib \ -DBIN_DIR=\"$(bindir)\" \ -DVAR_RUN=\"$(VAR_RUN)\" \ -- cgit