[PATCH] abrt-cli: add report-only option (trac#281)
by Miroslav Lichvar
---
src/cli/abrt-cli.txt | 5 ++++-
src/cli/cli.c | 15 ++++++++++-----
src/cli/report.c | 39 +++++++++++++++++++++------------------
src/cli/report.h | 1 +
4 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/src/cli/abrt-cli.txt b/src/cli/abrt-cli.txt
index ea3111c..412f1b1 100644
--- a/src/cli/abrt-cli.txt
+++ b/src/cli/abrt-cli.txt
@@ -17,7 +17,7 @@ SYNOPSIS
'abrt-cli' [-vsp] -a[y] DUMP_DIR
-'abrt-cli' [-vsp] -r[y] DUMP_DIR
+'abrt-cli' [-vsp] -r[y|o] DUMP_DIR
'abrt-cli' [-vsp] -d DUMP_DIR
@@ -58,6 +58,9 @@ OPTIONS
-y, --always::
Noninteractive: don't ask questions, assume positive answer to all of them
+-o, --report-only::
+ Report pre-filled problem data, ask only which reporter should be used.
+
-v, --verbose::
Be verbose
diff --git a/src/cli/cli.c b/src/cli/cli.c
index 0e4ce98..bf3077d 100644
--- a/src/cli/cli.c
+++ b/src/cli/cli.c
@@ -170,7 +170,7 @@ int main(int argc, char** argv)
"or: \b [-vsp] -L[PREFIX] [DUMP_DIR]\n"
"or: \b [-vsp] -e EVENT DUMP_DIR\n"
"or: \b [-vsp] -a[y] DUMP_DIR\n"
- "or: \b [-vsp] -r[y] DUMP_DIR\n"
+ "or: \b [-vsp] -r[y|o] DUMP_DIR\n"
"or: \b [-vsp] -d DUMP_DIR"
);
enum {
@@ -187,9 +187,10 @@ int main(int argc, char** argv)
OPTMASK_need_arg = OPT_info|OPT_run_event|OPT_analyze|OPT_report|OPT_delete,
OPT_f = 1 << 9,
OPT_y = 1 << 10,
- OPT_v = 1 << 11,
- OPT_s = 1 << 12,
- OPT_p = 1 << 13,
+ OPT_o = 1 << 11,
+ OPT_v = 1 << 12,
+ OPT_s = 1 << 13,
+ OPT_p = 1 << 14,
};
/* Keep enum above and order of options below in sync! */
struct options program_options[] = {
@@ -205,6 +206,7 @@ int main(int argc, char** argv)
OPT_BOOL( 'V', "version", NULL, _("Display version and exit")),
OPT_BOOL( 'f', "full" , NULL, _("Full listing")),
OPT_BOOL( 'y', "always" , NULL, _("Noninteractive: don't ask questions, assume 'yes'")),
+ OPT_BOOL( 'o', "report-only" , NULL, _("Report pre-filled problem data")),
OPT__VERBOSE(&g_verbose),
OPT_BOOL( 's', NULL , NULL, _("Log to syslog")),
OPT_BOOL( 'p', NULL , NULL, _("Add program names to log")),
@@ -244,6 +246,7 @@ int main(int argc, char** argv)
char *dump_dir_name = argv[0];
bool full = (opts & OPT_f);
bool always = (opts & OPT_y);
+ bool report_only = (opts & OPT_o);
if (!D_list)
{
@@ -335,7 +338,9 @@ int main(int argc, char** argv)
}
}
- exitcode = report(dump_dir_name, (always ? CLI_REPORT_BATCH : 0));
+ exitcode = report(dump_dir_name,
+ (always ? CLI_REPORT_BATCH : 0) |
+ (report_only ? CLI_REPORT_ONLY : 0));
if (exitcode == -1)
error_msg_and_die("Crash '%s' not found", dump_dir_name);
break;
diff --git a/src/cli/report.c b/src/cli/report.c
index 9e0455b..1b41597 100644
--- a/src/cli/report.c
+++ b/src/cli/report.c
@@ -684,34 +684,37 @@ int report(const char *dump_dir_name, int flags)
if (!dd)
return -1;
- char *analyze_events_as_lines = list_possible_events(dd, NULL, "analyze");
- dd_close(dd);
-
- if (analyze_events_as_lines && *analyze_events_as_lines)
+ if (!(flags & CLI_REPORT_ONLY))
{
- GList *list_analyze_events = str_to_glist(analyze_events_as_lines, '\n');
- free(analyze_events_as_lines);
+ char *analyze_events_as_lines = list_possible_events(dd, NULL, "analyze");
+ dd_close(dd);
- char *event = select_event_option(list_analyze_events);
- list_free_with_free(list_analyze_events);
+ if (analyze_events_as_lines && *analyze_events_as_lines)
+ {
+ GList *list_analyze_events = str_to_glist(analyze_events_as_lines, '\n');
+ free(analyze_events_as_lines);
- int analyzer_result = run_analyze_event(dump_dir_name, event);
- free(event);
+ char *event = select_event_option(list_analyze_events);
+ list_free_with_free(list_analyze_events);
- if (analyzer_result != 0)
- return 1;
- }
+ int analyzer_result = run_analyze_event(dump_dir_name, event);
+ free(event);
- /* Load problem_data from (possibly updated by analyze) dump dir */
- dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
- if (!dd)
- return -1;
+ if (analyzer_result != 0)
+ return 1;
+ }
+
+ /* Load problem_data from (possibly updated by analyze) dump dir */
+ dd = dd_opendir(dump_dir_name, /*flags:*/ 0);
+ if (!dd)
+ return -1;
+ }
char *report_events_as_lines = list_possible_events(dd, NULL, "report");
problem_data_t *problem_data = create_problem_data_from_dump_dir(dd);
dd_close(dd);
- if (!(flags & CLI_REPORT_BATCH))
+ if (!(flags & (CLI_REPORT_BATCH | CLI_REPORT_ONLY)))
{
/* Open text editor and give a chance to review the backtrace etc */
create_fields_for_editor(problem_data);
diff --git a/src/cli/report.h b/src/cli/report.h
index a393784..5b1fdcb 100644
--- a/src/cli/report.h
+++ b/src/cli/report.h
@@ -29,6 +29,7 @@ GList *str_to_glist(char *str, int delim);
/* Report the crash */
enum {
CLI_REPORT_BATCH = 1 << 0,
+ CLI_REPORT_ONLY = 1 << 1,
};
int report(const char *dump_dir_name, int flags);
--
1.7.4.4
12 years, 11 months
[PATCH 1/3] [abrt] rhbz671354 - [RFE] Configurable core dump location
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/hooks/abrt-install-ccpp-hook | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/hooks/abrt-install-ccpp-hook b/src/hooks/abrt-install-ccpp-hook
index 12a443f..7fcc2ce 100755
--- a/src/hooks/abrt-install-ccpp-hook
+++ b/src/hooks/abrt-install-ccpp-hook
@@ -6,14 +6,27 @@
dry_run=false
verbose=false
+DEFAULT_LOCATION=/var/spool/abrt
+
+DUMP_LOCATION=`cat /etc/abrt/abrt.conf | grep DumpLocation`
+
+if `echo $DUMP_LOCATION | grep "#" 1>/dev/null 2>&1`; then
+ DUMP_LOCATION=$DEFAULT_LOCATION
+else
+ DUMP_LOCATION=`echo $DUMP_LOCATION | cut -d'=' -f2 | sed 's/ //g' `
+ if [ "$DUMP_LOCATION" = "" ]; then
+ DUMP_LOCATION=$DEFAULT_LOCATION
+ fi
+fi
+
PATTERN_FILE="/proc/sys/kernel/core_pattern"
SAVED_PATTERN_DIR="/var/run/abrt"
SAVED_PATTERN_FILE="/var/run/abrt/saved_core_pattern"
HOOK_BIN="/usr/libexec/abrt-hook-ccpp"
# Must match percent_specifiers[] order in abrt-hook-ccpp.c:
-PATTERN="|$HOOK_BIN /var/spool/abrt %s %c %p %u %g %t %e"
+PATTERN="|$HOOK_BIN $DUMP_LOCATION %s %c %p %u %g %t %e"
# Same, but with bogus "executable name" parameter
-PATTERN1="|$HOOK_BIN /var/spool/abrt %s %c %p %u %g %t e"
+PATTERN1="|$HOOK_BIN $DUMP_LOCATION %s %c %p %u %g %t e"
# core_pipe_limit specifies how many dump_helpers can run at the same time
# 0 - means unlimited, but it's not guaranteed that /proc/<pid> of crashing
--
1.7.1
12 years, 11 months
No rule to make target `../src/cli/cli.c', needed by `abrt.pot'
by Michal Nowak
[...]
Making check in po
make[1]: Entering directory `/tmp/tmp.PmROZZ3aXg/abrt/po'
make[1]: *** No rule to make target `../src/cli/cli.c', needed by `abrt.pot'. Stop.
make[1]: Leaving directory `/tmp/tmp.PmROZZ3aXg/abrt/po'
make: *** [check-recursive] Error 1
It does not seem s to relate with recent move of CLI to libreport,
I guess I saw it weeks ago.
Michal
12 years, 11 months
[PATCH] rhbz712950 - print message when debuginfo hash is missing (proprietary blob)
by Nikola Pajkovsky
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
src/plugins/abrt-action-analyze-core.py | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/plugins/abrt-action-analyze-core.py b/src/plugins/abrt-action-analyze-core.py
index 06473c4..97bc81a 100755
--- a/src/plugins/abrt-action-analyze-core.py
+++ b/src/plugins/abrt-action-analyze-core.py
@@ -69,8 +69,10 @@ def extract_info_from_core(coredump_name):
eu_unstrip_OUT = Popen(["eu-unstrip","--core=%s" % coredump_name, "-n"], stdout=PIPE, bufsize=-1).communicate()[0]
# parse eu_unstrip_OUT and return the list of build_ids
+ # Nvidia debuginfo bug 712950
# eu_unstrip_OUT = (
# "0x7f42362ca000+0x204000 c4d35d993598a6242f7525d024b5ec3becf5b447@0x7f42362ca1a0 /usr/lib64/libcanberra-gtk.so.0 - libcanberra-gtk.so.0\n"
+ # "0x344f200000+0x30c000 - /usr/lib64/nvidia/libGL.so.1 - libGL.so.1\n"
# "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
# "0x3afa400000+0x210000 607308f916c13c3ad9ee503008d31fa671ba73ce@0x3afa4001a0 /usr/lib64/libcanberra.so.0 - libcanberra.so.0\n"
# "0x3bc7000000+0x208000 3be016bb723e85779a23e111a8ab1a520b209422@0x3bc70001a0 /usr/lib64/libvorbisfile.so.3 - libvorbisfile.so.3\n"
@@ -101,10 +103,13 @@ def extract_info_from_core(coredump_name):
# linux-vdso.so.1 -> Virtual Dynamic Shared Object
if b_ids_line[EXECUTABLE] not in ["linux-vdso.so.1"]:
build_id = b_ids_line[BUILD_ID].split('@')[0]
- build_ids.add(build_id)
- library = b_ids_line[LIBRARY]
- libraries.add(library)
- build_ids.add(build_id)
+ if build_id != "-":
+ build_ids.add(build_id)
+ library = b_ids_line[LIBRARY]
+ libraries.add(library)
+ build_ids.add(build_id)
+ else:
+ log(_("No debuginfo '%s', maybe proprietary blob?") % b_ids_line[LIBRARY])
else:
log2("skipping line '%s'" % line)
log1("Found %i build_ids" % len(build_ids))
--
1.7.1
12 years, 11 months
[PATCH] [abrt] new bodhi plugin
by Nikola Pajkovsky
for now bodhi plugin has only two possibilities how to search updates.
1) give bodhi bugzilla id and if bz id is associate to any updates it returns
detail of packages
2) give bodhi name of the package
Working on: -r, --release (f14, f15, ...); -s, --status (stable, update, pending)
Signed-off-by: Nikola Pajkovsky <npajkovs(a)redhat.com>
---
.gitignore | 1 +
abrt.spec.in | 26 ++++-
configure.ac | 11 ++
src/plugins/Makefile.am | 58 +++++++---
src/plugins/abrt-action-bodhi.c | 241 +++++++++++++++++++++++++++++++++++++++
5 files changed, 320 insertions(+), 17 deletions(-)
create mode 100644 src/plugins/abrt-action-bodhi.c
diff --git a/.gitignore b/.gitignore
index a0c88d8..08df83f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ src/plugins/abrt-action-generate-backtrace
src/plugins/abrt-action-upload
src/plugins/abrt-action-mailx
src/plugins/abrt-action-print
+src/plugins/abrt-action-bodhi
src/plugins/abrt-dump-oops
src/plugins/abrt-action-install-debuginfo-to-abrt-cache
src/plugins/abrt-retrace-client
diff --git a/abrt.spec.in b/abrt.spec.in
index 1a4c566..e064451 100644
--- a/abrt.spec.in
+++ b/abrt.spec.in
@@ -39,7 +39,7 @@ BuildRequires: libreport-devel
BuildRequires: btparser-devel
# for rhel6
-%if 0%{?rhel} >= 6
+%if 0%{?rhel}
BuildRequires: gnome-keyring-devel
%else
BuildRequires: libgnome-keyring-devel
@@ -132,6 +132,18 @@ Requires: mailx
The simple reporter plugin which sends a report via mailx to a specified
email address.
+%if 0%{?fedora}
+%package plugin-bodhi
+Summary: %{name}'s bodhi plugin
+BuildRequires: json-c-devel
+Group: System Environment/Libraries
+Requires: %{name} = %{version}-%{release}
+
+%description plugin-bodhi
+Search for a new updates in bodhi
+%endif
+
+
%package plugin-bugzilla
Summary: %{name}'s bugzilla plugin
Group: System Environment/Libraries
@@ -211,7 +223,13 @@ Virtual package to make easy default installation on desktop environments.
%build
autoconf
+
+%if 0%{?rhel}
+%configure --disable-bodhi
+%else
%configure
+%endif
+
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
CFLAGS="-fno-strict-aliasing"
@@ -474,6 +492,12 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
%{_bindir}/abrt-action-print
%{_mandir}/man*/abrt-action-print.*
+%if 0%{?fedora}
+%files plugin-bodhi
+%defattr(-,root,root,-)
+%{_bindir}/abrt-action-bodhi
+%endif
+
%files plugin-mailx
%defattr(-,root,root,-)
%{_sysconfdir}/%{name}/events/report_Mailx.xml
diff --git a/configure.ac b/configure.ac
index efd7023..bc6ba70 100644
--- a/configure.ac
+++ b/configure.ac
@@ -20,6 +20,9 @@ AC_ARG_ENABLE(debug,
[Enable debug information])],
[CFLAGS="$CFLAGS -DDEBUG -ggdb -g"])
+AC_ARG_ENABLE([bodhi],
+ AC_HELP_STRING([--disable-bodhi], [do not use bodhi plugin]))
+
dnl ****** INTERNATIONALIZATION **********************
GETTEXT_PACKAGE=abrt
AC_SUBST(GETTEXT_PACKAGE)
@@ -70,6 +73,14 @@ PKG_CHECK_MODULES([GNOME_KEYRING], [gnome-keyring-1])
PKG_CHECK_MODULES([BTPARSER], [btparser])
PKG_CHECK_MODULES([LIBREPORT], [libreport])
PKG_CHECK_MODULES([LIBREPORT_GTK], [libreport-gtk])
+
+AS_IF([test "x$enable_bodhi" != "xno"], [
+ dnl Do the stuff needed for enabling the feature
+ AC_DEFINE([HAVE_BODHI], [1], [Define if you have bodhi])
+ PKG_CHECK_MODULES([JSON_C], [json])
+])
+AM_CONDITIONAL(HAVE_BODHI, [test "x$enable_bodhi" != "xno"])
+
# Just PKG_CHECK_MODULES([PYTHON], [python]) works only with python2.7+
# Below, if python is not found, we set up for python2.6 w/o checking:
PKG_CHECK_MODULES([PYTHON], [python],,[
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index 352c23a..a8bd75f 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -7,22 +7,30 @@ bin_SCRIPTS = \
abrt-action-analyze-core.py \
abrt-action-list-dsos.py
-bin_PROGRAMS = \
- abrt-dump-oops \
- abrt-action-analyze-c \
- abrt-action-analyze-python \
- abrt-action-analyze-oops \
- abrt-action-trim-files \
- abrt-action-generate-backtrace \
- abrt-action-analyze-backtrace \
- abrt-action-bugzilla \
- abrt-action-rhtsupport \
- abrt-action-kerneloops \
- abrt-action-upload \
- abrt-action-mailx \
- abrt-action-print \
- abrt-action-install-debuginfo-to-abrt-cache \
- abrt-retrace-client
+BIN =
+
+BIN += abrt-dump-oops
+BIN += abrt-action-analyze-c
+BIN += abrt-action-analyze-python
+BIN += abrt-action-analyze-oops
+BIN += abrt-action-trim-files
+BIN += abrt-action-generate-backtrace
+BIN += abrt-action-analyze-backtrace
+BIN += abrt-action-bugzilla
+BIN += abrt-action-rhtsupport
+BIN += abrt-action-kerneloops
+BIN += abrt-action-upload
+BIN += abrt-action-mailx
+BIN += abrt-action-print
+
+if HAVE_BODHI
+BIN += abrt-action-bodhi
+endif
+
+BIN += abrt-action-install-debuginfo-to-abrt-cache
+BIN += abrt-retrace-client
+
+bin_PROGRAMS = $(BIN)
pluginsconfdir = $(PLUGINS_CONF_DIR)
@@ -271,6 +279,24 @@ abrt_action_bugzilla_LDADD = \
../lib/libabrt_web.la \
$(LIBREPORT_LIBS)
+if HAVE_BODHI
+abrt_action_bodhi_SOURCES = \
+ abrt-action-bodhi.c
+abrt_action_bodhi_CPPFLAGS = \
+ -I$(srcdir)/../include/report -I$(srcdir)/../include \
+ -I$(srcdir)/../lib \
+ $(GLIB_CFLAGS) \
+ $(JSON_C_CFLAGS) \
+ -D_GNU_SOURCE \
+ -Wall -Wwrite-strings \
+ $(LIBREPORT_CFLAGS)
+abrt_action_bodhi_LDADD = \
+ $(GLIB_LIBS) \
+ $(JSON_C_LIBS) \
+ ../lib/libabrt_web.la \
+ $(LIBREPORT_LIBS)
+endif
+
abrt_action_rhtsupport_SOURCES = \
abrt_rh_support.h abrt_rh_support.c \
abrt-action-rhtsupport.c
diff --git a/src/plugins/abrt-action-bodhi.c b/src/plugins/abrt-action-bodhi.c
new file mode 100644
index 0000000..339ddc8
--- /dev/null
+++ b/src/plugins/abrt-action-bodhi.c
@@ -0,0 +1,241 @@
+/*
+ Copyright (C) 2011 ABRT team
+ Copyright (C) 2011 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.
+*/
+
+#include <json/json.h>
+
+#include "abrtlib.h"
+#include "abrt_curl.h"
+#include "parse_options.h"
+
+//699198,705037,705036
+
+static const char *bodhi_url = "https://admin.fedoraproject.org/updates/%s";
+
+struct bodhi {
+ const char *package_name;
+ const char *date_pushed;
+ int karma;
+
+ GList *bz_ids;
+};
+
+enum bodhi_flags {
+ BODHI_READ_STR,
+ BODHI_READ_INT,
+};
+
+static void free_bodhi_list(GList *bodhi_list)
+{
+ if (!bodhi_list)
+ return;
+
+ for (GList *li = bodhi_list; li; li = li->next)
+ {
+ struct bodhi *b = (struct bodhi *) li->data;
+ list_free_with_free(b->bz_ids);
+ free(b);
+ }
+
+ g_list_free(bodhi_list);
+}
+
+#define bodhi_read_value_int(item, bodhi, json) \
+ do { \
+ json_object *j; \
+ j = json_object_object_get((json), (item)); \
+ if (!j) \
+ error_msg_and_die("'%s' section is not available", (item)); \
+ bodhi = json_object_get_int(j); \
+ break; \
+ } while(0)
+
+#define bodhi_read_value_str(item, bodhi, json) \
+ do { \
+ json_object *j; \
+ j = json_object_object_get((json), (item)); \
+ if (!j) \
+ error_msg_and_die("'%s' section is not available", (item)); \
+ bodhi = json_object_to_json_string(j); \
+ } while(0)
+
+static void print_bodhi(struct bodhi *b)
+{
+ if (b->package_name)
+ printf("'%s'", b->package_name);
+ if (b->date_pushed)
+ printf(" '%s'", b->date_pushed);
+
+ printf(" %i", b->karma);
+
+ for (GList *li = b->bz_ids; li; li = li->next)
+ printf(" %i", *(int*) li->data);
+
+ puts("");
+}
+
+static GList *bodhi_parse_json(json_object *json)
+{
+ json_object *json_num_items = json_object_object_get(json, "num_items");
+ if (!json_num_items)
+ {
+ error_msg("'num_items' is not available");
+ return NULL;
+ }
+
+ int num_items = json_object_get_int(json_num_items);
+ if (num_items <= 0)
+ return NULL;
+
+ json_object *updates = json_object_object_get(json, "updates");
+ if (!updates)
+ {
+ error_msg("'update' section is not available");
+ return NULL;
+ }
+
+ int updates_len = json_object_array_length(updates);
+ VERB1 log("%i updates", updates_len);
+
+ GList *bodhi_list = NULL;
+ for (int i = 0; i < updates_len; ++i)
+ {
+ json_object *updates_item = json_object_array_get_idx(updates, i);
+
+ /* some of item are null */
+ if (!updates_item)
+ continue;
+
+ struct bodhi *b = xzalloc(sizeof(struct bodhi));
+ bodhi_read_value_str("title", b->package_name, updates_item);
+ bodhi_read_value_str("date_pushed", b->date_pushed, updates_item);
+ bodhi_read_value_int("karma", b->karma, updates_item);
+
+ json_object *bugs = json_object_object_get(updates_item, "bugs");
+ if (bugs)
+ {
+ for (int j = 0; j < json_object_array_length(bugs); ++j)
+ {
+ int *bz_id = xmalloc(sizeof(int));
+ json_object *bug_item = json_object_array_get_idx(bugs, j);
+ bodhi_read_value_int("bz_id", *bz_id, bug_item);
+ b->bz_ids = g_list_append(b->bz_ids, bz_id);
+ }
+ }
+
+ bodhi_list = g_list_append(bodhi_list, b);
+
+ VERB1 print_bodhi(b);
+ }
+
+ return bodhi_list;
+}
+
+static int bodhi_query_list(const char *query, const char *package)
+{
+ if (!query && !package)
+ return -1;
+
+ char *bodhi_url_bugs = xasprintf(bodhi_url, "list");
+
+ abrt_post_state_t *post_state = new_abrt_post_state(
+ ABRT_POST_WANT_BODY|ABRT_POST_WANT_SSL_VERIFY);
+
+ const char *headers[] = {
+ "Accept: application/json",
+ NULL
+ };
+
+ struct strbuf *data = strbuf_new();
+
+ if (query)
+ strbuf_append_str(data, query);
+
+ if (package && query)
+ strbuf_append_strf(data, "&package=%s", package);
+ if (package && !query)
+ strbuf_append_strf(data, "package=%s", package);
+
+ VERB1 log("data: %s", data->buf);
+
+ abrt_post_string(post_state, bodhi_url_bugs, "application/x-www-form-urlencoded",
+ headers, data->buf);
+ free(bodhi_url_bugs);
+ strbuf_free(data);
+
+ VERB3 log("%s", post_state->body);
+
+ /* when you try to search in bodhi server bug with number 'ss' (some invalid
+ * number or not associate to any updates, bodhi returns not json answer, but
+ * some html page. Bug filled here https://fedorahosted.org/bodhi/ticket/611
+ *
+ * What is worst is that json_tokener_parse() does not return NULL when
+ * invalid input is passed to function, but returns some rubbish pointer
+ * 0xfffffffffffffffc. Bug filled https://bugzilla.redhat.com/show_bug.cgi?id=709804
+ */
+ json_object *json = json_tokener_parse(post_state->body);
+ if (!is_error(json))
+ error_msg_and_die("unable parse response from bodhi server");
+
+ GList *bodhi_list = bodhi_parse_json(json);
+ free_bodhi_list(bodhi_list);
+ json_object_put(json);
+ free_abrt_post_state(post_state);
+
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ abrt_init(argv);
+ enum {
+ OPT_v = 1 << 0,
+ OPT_b = 1 << 1,
+ };
+
+ char *bugs = NULL;
+ /* Keep enum above and order of options below in sync! */
+ struct options program_options[] = {
+ OPT__VERBOSE(&g_verbose),
+ OPT_STRING('b', "bugs", &bugs, "id1[,id2,...]" , _("List of bug ids")),
+ OPT_END()
+ };
+
+ const char *program_usage_string = _(
+ "\b bodhi [-v] [-b] package-name package-name ...\n"
+ "\n"
+ "Search for a new updates in bodhi"
+ );
+
+ unsigned opts = parse_opts(argc, argv, program_options, program_usage_string);
+
+ int status = 0;
+
+ char *query = NULL;
+ if (opts & OPT_b)
+ query = xasprintf("bugs=%s", bugs);
+
+ if (optind < argc)
+ while (optind < argc)
+ status = bodhi_query_list(query, argv[optind++]);
+ else
+ status = bodhi_query_list(query, NULL);
+
+ free(query);
+ return 0;
+}
--
1.7.1
12 years, 11 months
[PATCH] Btparser removal
by Karel Klic
Hi,
here is the patch removing btparser from abrt.
`yum install btparser-devel --enablerepo=updates-testing` should make
ABRT compilable again after applying the patch on F15.
12 years, 11 months
ABRT test suite and other testing efforts
by Michal Nowak
Hi -
we (David Kutalek, Izidor Matusov & myself) thought of creating
ABRT test suite and broaden and formalize overall testing efforts.
We came out with mind map (both source XML and bitmap attached)
describing what we have and what we'd like to have in the future.
Basic idea we believe in is that testing in some specific field
should fit the underlying environment. So giving an example:
Testing in Fedora should use Fedora's own infrastructure, that
means e.g. running internal test suite as part of Koji build and
AutoQA tests on Fedora-specific regressions and sanity matters.
Let me describe the mind map in detail, branch by branch:
* Fedora
+ Fedora Test Day
- Global public testing by Fedora community, should focus on
both Features (e.g. Retrace Server), infrastructure
compatibility (e.g. reporting to Bugzilla) and desktop
integration.
+ Fedora AutoQA Tests
- By use of Fedora AutoQA infrastructure we should test only
sanity integration and regressions specific to Fedora only
(e.g. bugzilla plugin worked with mozilla.org Bugzilla but
not with the Red Hat instance).
+ Release Criteria
- Update to Fedora stable release will be pushed only iff
FedoraQA tests passed & upstream test suite passed in Koji.
* RHEL - Not intended to be discussed publicly.
* Internal Test Suite
+ Unit Tests
- Some folks generally think that writing unit tests *after*
the actual code is written is more or less useless because
the test may match broken code. Although I understand possible
issues it's far superb to what we have now. Also considering
ABRT being still more or less rewritten to enhance it's design,
it's quite a good chance we do it the right way.
We'd like to see unit tests in framework of your choice for
both core and plugins.
+ Regression Tests
- Having wide range of regression tests in sources needs some
time, it may be a pain and it may make you feel like you are
coding tests and not developing the useful code instead.
However, in my opinion, it saves you the time you have to
invest in fixing regressions.
Also with regression tests you may slightly less fear
breakage and anger from users. You may also view it as a step
further in providing more stable code; for example code review
was a positive step in that direction.
+ BuildBot
- BuildBot builds ABRT when new commits we the other day, runs
tests, results sends to the mailing list and perhaps even
copies resulting RPMs to fedorapeople repo for testers
consumption.
* Infrastructure
- Just that ABRT should be installed by default in Fedora and
enable in the GUI. Similar tasks for RHEL and RH
infrastructure.
More on the implementation details:
For Fedora, AutoQA should be the choice. Upstream unit tests
- not sure, up to you. Upstream regression and sanity tests -
we'd prefer Beaker/beakerlib, since we are really familiar
with it and is easy to play with.
Let me know, what you think guys about the mind map, your
frameworks of choice, anything.
Thanks,
Michal
12 years, 11 months
libreport - what's missing
by Jiri Moskovcak
Our goal is to obsolete the old report package with libreport which
means we have to provide the same functionality so I prepared a list of
features we're still missing compared to old report:
- text UI
- for that we can (should) use the part of the existing CLI, which
should be split in the same way as GUI and wizard
- newt UI
- for now need just a reporting part (mlichvar promised to help with this)
- the good news is, that the GTK part is done and seems to be working
(tested with sealert and python-meh)
Jirka
12 years, 11 months
libreport split
by Jiri Moskovcak
Hi,
please be informed, that I've finished splitting the sources of
libreport to a separate package. It still lives in the abrt src tree in
a directory libreport, but I plan to move it to it's own git (just git,
not trac) so we have more readable history and it should also be easier
to pick specific patches.
To make abrt compile, you need to first make rpm from the libreport,
install it and then you can compile ABRT. The libreport package should
be soon in Fedora repos: https://bugzilla.redhat.com/show_bug.cgi?id=712017
I'd like to do ABRT update as soon as the review for libreport is done,
so please test it and watch for any breakage.
Thank you,
Jirka
12 years, 11 months