summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJiri Moskovcak <jmoskovc@redhat.com>2010-02-09 21:52:42 +0100
committerJiri Moskovcak <jmoskovc@redhat.com>2010-02-09 21:52:42 +0100
commitd81b4067a5997f955037995da32110b9ff5213e3 (patch)
treeefa60c4feda9d1c1fde0252543c1e635bd5c236b /src
parent2b6d0fc5c8e4472bc88db4075d2e63b4f01fbbe5 (diff)
parentd0f19e435b5a3fecb3fd74b1ba0202364e6dc545 (diff)
Merge branch 'master' into rhel6
Diffstat (limited to 'src')
-rwxr-xr-xsrc/Backtrace/abrt-bz-dupchecker79
-rw-r--r--src/CLI/report.cpp10
-rw-r--r--src/Gui/CCMainWindow.py3
-rw-r--r--src/Gui/CC_gui_functions.py3
4 files changed, 57 insertions, 38 deletions
diff --git a/src/Backtrace/abrt-bz-dupchecker b/src/Backtrace/abrt-bz-dupchecker
index cb11bf1..d7798ac 100755
--- a/src/Backtrace/abrt-bz-dupchecker
+++ b/src/Backtrace/abrt-bz-dupchecker
@@ -157,9 +157,6 @@ for buginfo in buginfos:
bz.logout()
-print "SUMMARY"
-print "=========================================================================="
-
# The number of duplicates.
dupcount = 0
# The number of duplicates that can be closed.
@@ -172,36 +169,56 @@ for backtrace, components in database.items():
bugitems))),
len(bugitems) - 1)
-print "Total number of duplicate bugs detected: {0}".format(dupcount)
-print "Number of duplicate bugs that will be closed : {0}".format(dupclosecount)
-print "------------------------------"
-
-# Print the duplicates
+# Sort the duplicates by the component owner, and
+# filter out those which should not be printed.
+dups = []
for backtrace, components in database.items():
for component, bugitems in components.items():
if len(bugitems) > 1:
# Get the component owner
- component_info = json.load(urllib.urlopen("https://admin.fedoraproject.org/pkgdb/packages/name/{0}?tg_format=json".format(buginfo.component)))
- component_packages = component_info['packageListings']
- component_f12 = filter(lambda x:x["collection"]["version"]=="12", component_packages)
owner = "Failed to get component owner"
- if len(component_f12) == 1:
- owner = component_f12["owner"]
-
- if options.wiki:
- print "----"
- print "* component: '''{0}''' ({1})".format(component, owner)
- print "* duplicates: {0}".format(
- reduce(lambda x,y: x+", "+y,
- map(lambda x: "#[https://bugzilla.redhat.com/show_bug.cgi?id={0} {0}] ({1} comments)".format(x['id'],x['comments']),
- bugitems)))
- print "* backtrace:"
- for line in backtrace.replace("Thread\n", "").splitlines():
- print "*# {0}".format(line)
- else:
- print "Component: {0} ({1})".format(component, owner)
- print "Duplicates: {0}".format(
- reduce(lambda x,y: x+", "+y,
- map(lambda x: "{0} ({1})".format(x['id'],x['comments']),
- bugitems)))
- print "Backtrace: {0}".format(backtrace)
+ try:
+ component_info = json.load(urllib.urlopen("https://admin.fedoraproject.org/pkgdb/packages/name/{0}?tg_format=json".format(component)))
+ component_packages = component_info['packageListings']
+ component_f12 = filter(lambda x:x["collection"]["version"]=="12", component_packages)
+ if len(component_f12) == 1:
+ owner = component_f12[0]["owner"]
+ except KeyError:
+ pass
+
+ dups.append((component, owner, bugitems, backtrace))
+ print ".",
+
+print
+print "SUMMARY"
+print "=========================================================================="
+print "Total number of duplicate bugs detected: {0}".format(dupcount)
+print "Number of duplicate bugs that will be closed : {0}".format(dupclosecount)
+print "------------------------------"
+
+# Print the duplicates sorted by package owner.
+def cmp(x, y):
+ if x[1] < y[1]:
+ return -1
+ elif x[1] == y[1]:
+ return 0
+ else:
+ return 1
+for (component, owner, bugitems, backtrace) in sorted(dups, cmp):
+ if options.wiki:
+ print "----"
+ print "* component: '''{0}''' ({1})".format(component, owner)
+ print "* duplicates: {0}".format(
+ reduce(lambda x,y: x+", "+y,
+ map(lambda x: "#[https://bugzilla.redhat.com/show_bug.cgi?id={0} {0}] ({1} comments)".format(x['id'],x['comments']),
+ bugitems)))
+ print "* backtrace:"
+ for line in backtrace.replace("Thread\n", "").splitlines():
+ print "*# {0}".format(line)
+ else:
+ print "Component: {0} ({1})".format(component, owner)
+ print "Duplicates: {0}".format(
+ reduce(lambda x,y: x+", "+y,
+ map(lambda x: "{0} ({1})".format(x['id'],x['comments']),
+ bugitems)))
+ print "Backtrace: {0}".format(backtrace)
diff --git a/src/CLI/report.cpp b/src/CLI/report.cpp
index 7ef33ac..6a8f9f4 100644
--- a/src/CLI/report.cpp
+++ b/src/CLI/report.cpp
@@ -427,12 +427,12 @@ int report(const char *uuid, bool always)
// Skip nonReporter plugins.
if (0 != strcmp(it->second["Type"].c_str(), "Reporter"))
continue;
-
+
map_string_t settings = call_GetPluginSettings(it->first.c_str());
// Login information is missing.
- bool loginMissing = settings.find("Login") != settings.end()
+ bool loginMissing = settings.find("Login") != settings.end()
&& 0 == strcmp(settings["Login"].c_str(), "");
- bool passwordMissing = settings.find("Password") != settings.end()
+ bool passwordMissing = settings.find("Password") != settings.end()
&& 0 == strcmp(settings["Password"].c_str(), "");
if (!loginMissing && !passwordMissing)
continue;
@@ -461,7 +461,7 @@ int report(const char *uuid, bool always)
fgets(answer, sizeof(answer), stdin);
if (strlen(answer) > 0)
pluginSettings[it->first]["Password"] = answer;
- }
+ }
}
}
@@ -475,7 +475,7 @@ int report(const char *uuid, bool always)
vector_string_t &v = it->second;
printf("%s: %s\n", it->first.c_str(), v[REPORT_STATUS_IDX_MSG].c_str());
plugins++;
- if (v[REPORT_STATUS_IDX_FLAG] != "0")
+ if (v[REPORT_STATUS_IDX_FLAG] == "0")
errors++;
it++;
}
diff --git a/src/Gui/CCMainWindow.py b/src/Gui/CCMainWindow.py
index 7967028..c0666f0 100644
--- a/src/Gui/CCMainWindow.py
+++ b/src/Gui/CCMainWindow.py
@@ -2,6 +2,7 @@
import sys
import pwd
import getopt
+from glib import markup_escape_text
from abrt_utils import _, init_logging, log, log1, log2
import gobject
@@ -233,7 +234,7 @@ class MainWindow():
# it is not informative (no URL to the report)
for message in dump.getMessage().split(';'):
if message:
- message_clean = message.strip()
+ message_clean = markup_escape_text(message.strip())
if "http" in message_clean[0:5] or "file:///" in message_clean[0:8]:
report_message = "<a href=\"%s\">%s</a>" % (message_clean, message_clean)
else:
diff --git a/src/Gui/CC_gui_functions.py b/src/Gui/CC_gui_functions.py
index 9378de5..acfd2a5 100644
--- a/src/Gui/CC_gui_functions.py
+++ b/src/Gui/CC_gui_functions.py
@@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
+from glib import markup_escape_text
import gtk
import pango
import subprocess
@@ -66,7 +67,7 @@ def gui_report_dialog ( report_status_dict, parent_dialog,
# this first one is actually a fallback to set at least
# a raw text in case when set_markup() fails
status_label.set_text(report_status_dict[plugin][MESSAGE])
- status_label.set_markup("<span foreground='red'>%s</span>" % report_status_dict[plugin][MESSAGE])
+ status_label.set_markup("<span foreground='red'>%s</span>" % markup_escape_text(report_status_dict[plugin][MESSAGE]))
# if the report was not succesful then this won't pass so this runs only
# if report succeds and gets overwriten by the status message
if report_status_dict[plugin][STATUS] == '1':