summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZdenek Prikryl <zprikryl@redhat.com>2009-08-20 14:28:44 +0200
committerZdenek Prikryl <zprikryl@redhat.com>2009-08-20 14:28:44 +0200
commite5c2fad4f71274897ed2ebf5e34a6ab742dc9496 (patch)
treeca31634597e56c176ddee9416b96b518d916db25
parentc69d0f51da3561803a4c668072801273f7fb8285 (diff)
downloadabrt-e5c2fad4f71274897ed2ebf5e34a6ab742dc9496.tar.gz
abrt-e5c2fad4f71274897ed2ebf5e34a6ab742dc9496.tar.xz
abrt-e5c2fad4f71274897ed2ebf5e34a6ab742dc9496.zip
MiddleWare, Bugzilla: create new component file. Can be used in reporting
MiddleWare: fixed reporting according package name
-rw-r--r--lib/Plugins/Bugzilla.cpp21
-rw-r--r--lib/Plugins/Bugzilla.h2
-rw-r--r--lib/Utils/DebugDump.h1
-rw-r--r--src/Daemon/MiddleWare.cpp91
4 files changed, 70 insertions, 45 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index a79f308..694524d 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -7,6 +7,8 @@
#include <sstream>
#include <string.h>
+#define XML_RPC_SUFFIX "/xmlrpc.cgi"
+
CReporterBugzilla::CReporterBugzilla() :
m_pXmlrpcTransport(NULL),
m_pXmlrpcClient(NULL),
@@ -278,7 +280,7 @@ std::string CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
map_xmlrpc_params_t bugParams;
map_xmlrpc_params_t ret;
std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
- std::string component = package.substr(0, package.rfind("-", package.rfind("-")-1));
+ std::string component = pCrashReport.find(FILENAME_COMPONENT)->second[CD_CONTENT];
std::string description;
std::string release = pCrashReport.find(FILENAME_RELEASE)->second[CD_CONTENT];;
std::string product;
@@ -291,7 +293,7 @@ std::string CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
bugParams["component"] = xmlrpc_c::value_string(component);
bugParams["version"] = xmlrpc_c::value_string(version);
//bugParams["op_sys"] = xmlrpc_c::value_string("Linux");
- bugParams["summary"] = xmlrpc_c::value_string("[abrt] crash detected in " + component);
+ bugParams["summary"] = xmlrpc_c::value_string("[abrt] crash detected in " + package);
bugParams["description"] = xmlrpc_c::value_string(description);
bugParams["status_whiteboard"] = xmlrpc_c::value_string("abrt_hash:" + pCrashReport.find(CD_UUID)->second[CD_CONTENT]);
bugParams["platform"] = xmlrpc_c::value_string(pCrashReport.find(FILENAME_ARCHITECTURE)->second[CD_CONTENT]);
@@ -362,7 +364,7 @@ void CReporterBugzilla::AddAttachments(const std::string& pBugId, const map_cras
std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
- std::string component = package.substr(0, package.rfind("-", package.rfind("-")-1));
+ std::string component = pCrashReport.find(FILENAME_COMPONENT)->second[CD_CONTENT];
std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
std::string bugId;
comm_layer_inner_status("Logging into bugzilla...");
@@ -397,15 +399,22 @@ void CReporterBugzilla::SetSettings(const map_plugin_settings_t& pSettings)
m_sBugzillaURL = pSettings.find("BugzillaURL")->second;
//remove the /xmlrpc.cgi part from old settings
//FIXME: can be removed after users are informed about new config format
- std::string::size_type pos = m_sBugzillaURL.find("/xmlrpc.cgi");
- if(pos != std::string::npos){
+ std::string::size_type pos = m_sBugzillaURL.find(XML_RPC_SUFFIX);
+ if(pos != std::string::npos)
+ {
m_sBugzillaURL.erase(pos);
}
//remove the trailing '/'
+ while (m_sBugzillaURL[m_sBugzillaURL.length() - 1] == '/')
+ {
+ m_sBugzillaURL.erase(m_sBugzillaURL.length() - 2);
+ }
+ /*
if(*(--m_sBugzillaURL.end()) == '/')
{
m_sBugzillaURL.erase(--m_sBugzillaURL.end());
}
+ */
m_sBugzillaXMLRPC = m_sBugzillaURL + std::string(XML_RPC_SUFFIX);
}
if (pSettings.find("Login") != pSettings.end())
@@ -437,7 +446,7 @@ map_plugin_settings_t CReporterBugzilla::GetSettings()
PLUGIN_INFO(REPORTER,
CReporterBugzilla,
"Bugzilla",
- "0.0.2",
+ "0.0.3",
"Check if a bug isn't already reported in a bugzilla "
"and if not, report it.",
"zprikryl@redhat.com",
diff --git a/lib/Plugins/Bugzilla.h b/lib/Plugins/Bugzilla.h
index 7280f4f..ab4ec40 100644
--- a/lib/Plugins/Bugzilla.h
+++ b/lib/Plugins/Bugzilla.h
@@ -7,8 +7,6 @@
#include <nssb64.h>
-#define XML_RPC_SUFFIX "/xmlrpc.cgi"
-
class CReporterBugzilla : public CReporter
{
private:
diff --git a/lib/Utils/DebugDump.h b/lib/Utils/DebugDump.h
index 1bd8cc7..9a7427e 100644
--- a/lib/Utils/DebugDump.h
+++ b/lib/Utils/DebugDump.h
@@ -31,6 +31,7 @@
#define FILENAME_TIME "time"
#define FILENAME_UID "uid"
#define FILENAME_PACKAGE "package"
+#define FILENAME_COMPONENT "component"
#define FILENAME_DESCRIPTION "description"
#define FILENAME_ANALYZER "analyzer"
#define FILENAME_RELEASE "release"
diff --git a/src/Daemon/MiddleWare.cpp b/src/Daemon/MiddleWare.cpp
index 823fbdd..4cfd86d 100644
--- a/src/Daemon/MiddleWare.cpp
+++ b/src/Daemon/MiddleWare.cpp
@@ -52,6 +52,7 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_c
if (!dd.Exist(FILENAME_ARCHITECTURE) ||
!dd.Exist(FILENAME_KERNEL) ||
!dd.Exist(FILENAME_PACKAGE) ||
+ !dd.Exist(FILENAME_COMPONENT) ||
!dd.Exist(FILENAME_RELEASE) ||
!dd.Exist(FILENAME_EXECUTABLE))
{
@@ -75,6 +76,7 @@ void CMiddleWare::DebugDumpToCrashReport(const std::string& pDebugDumpDir, map_c
if (fileName == FILENAME_ARCHITECTURE ||
fileName == FILENAME_KERNEL ||
fileName == FILENAME_PACKAGE ||
+ fileName == FILENAME_COMPONENT ||
fileName == FILENAME_RELEASE ||
fileName == FILENAME_EXECUTABLE)
{
@@ -262,61 +264,74 @@ CMiddleWare::report_status_t CMiddleWare::Report(const map_crash_report_t& pCras
{
throw CABRTException(EXCEP_ERROR, "CMiddleWare::Report(): System data are missing in crash report.");
}
+
std::string analyzer = pCrashReport.find(CD_MWANALYZER)->second[CD_CONTENT];
std::string UID = pCrashReport.find(CD_MWUID)->second[CD_CONTENT];
std::string UUID = pCrashReport.find(CD_MWUUID)->second[CD_CONTENT];
- if (m_mapAnalyzerActionsAndReporters.find(analyzer) != m_mapAnalyzerActionsAndReporters.end())
+
+ // ii = 0 -> analyzer is without package name (default)
+ // ii = 1 -> analyzer is with package name (CCpp:xrog-x11-app) (additional reporters to package)
+ int ii;
+ for (ii = 0; ii < 2; ii++)
{
- vector_actions_and_reporters_t::iterator it_r;
- for (it_r = m_mapAnalyzerActionsAndReporters[analyzer].begin();
- it_r != m_mapAnalyzerActionsAndReporters[analyzer].end();
- it_r++)
+ if (ii == 1)
{
- try
- {
- std::string res;
+ std::string packageNVR = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
+ std::string packageName = packageNVR.substr(0, packageNVR.rfind("-", packageNVR.rfind("-") - 1 ));
+ analyzer += ":" + packageName;
+ }
- if (m_pPluginManager->GetPluginType((*it_r).first) == REPORTER)
+ if (m_mapAnalyzerActionsAndReporters.find(analyzer) != m_mapAnalyzerActionsAndReporters.end())
+ {
+ vector_actions_and_reporters_t::iterator it_r;
+ for (it_r = m_mapAnalyzerActionsAndReporters[analyzer].begin();
+ it_r != m_mapAnalyzerActionsAndReporters[analyzer].end();
+ it_r++)
+ {
+ try
{
- CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
- std::string home = "";
- map_plugin_settings_t oldSettings;
- map_plugin_settings_t newSettings;
-
- if (pUID != "")
+ std::string res;
+ if (m_pPluginManager->GetPluginType((*it_r).first) == REPORTER)
{
- home = get_home_dir(atoi(pUID.c_str()));
- if (home != "")
- {
- oldSettings = reporter->GetSettings();
+ CReporter* reporter = m_pPluginManager->GetReporter((*it_r).first);
+ std::string home = "";
+ map_plugin_settings_t oldSettings;
+ map_plugin_settings_t newSettings;
- if (m_pPluginManager->LoadPluginSettings(home + "/.abrt/" + (*it_r).first + "." + PLUGINS_CONF_EXTENSION, newSettings))
+ if (pUID != "")
+ {
+ home = get_home_dir(atoi(pUID.c_str()));
+ if (home != "")
{
- reporter->SetSettings(newSettings);
+ oldSettings = reporter->GetSettings();
+
+ if (m_pPluginManager->LoadPluginSettings(home + "/.abrt/" + (*it_r).first + "." + PLUGINS_CONF_EXTENSION, newSettings))
+ {
+ reporter->SetSettings(newSettings);
+ }
}
}
- }
- res = reporter->Report(pCrashReport, (*it_r).second);
+ res = reporter->Report(pCrashReport, (*it_r).second);
- if (home != "")
- {
- reporter->SetSettings(oldSettings);
+ if (home != "")
+ {
+ reporter->SetSettings(oldSettings);
+ }
}
+ ret[(*it_r).first].push_back("1");
+ ret[(*it_r).first].push_back(res);
+ message += res + "\n";
+ }
+ catch (CABRTException& e)
+ {
+ ret[(*it_r).first].push_back("0");
+ ret[(*it_r).first].push_back(e.what());
+ comm_layer_inner_warning("CMiddleWare::Report(): " + e.what());
+ comm_layer_inner_status("Reporting via '"+(*it_r).first+"' was not successful: " + e.what());
}
- ret[(*it_r).first].push_back("1");
- ret[(*it_r).first].push_back(res);
- message += res + "\n";
- }
- catch (CABRTException& e)
- {
- ret[(*it_r).first].push_back("0");
- ret[(*it_r).first].push_back(e.what());
- comm_layer_inner_warning("CMiddleWare::Report(): " + e.what());
- comm_layer_inner_status("Reporting via '"+(*it_r).first+"' was not successful: " + e.what());
}
-
}
}
@@ -410,6 +425,7 @@ CMiddleWare::mw_result_t CMiddleWare::SavePackageDescriptionToDebugDump(const st
}
std::string description = m_RPM.GetDescription(packageName);
+ std::string component = m_RPM.GetComponent(pExecutable);
CDebugDump dd;
try
@@ -417,6 +433,7 @@ CMiddleWare::mw_result_t CMiddleWare::SavePackageDescriptionToDebugDump(const st
dd.Open(pDebugDumpDir);
dd.SaveText(FILENAME_PACKAGE, package);
dd.SaveText(FILENAME_DESCRIPTION, description);
+ dd.SaveText(FILENAME_COMPONENT, component);
dd.Close();
}
catch (CABRTException& e)