summaryrefslogtreecommitdiffstats
path: root/lib/Plugins
diff options
context:
space:
mode:
authorZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-29 12:46:18 +0200
committerZdenek Prikryl <zdeny@dhcp-lab-218.englab.brq.redhat.com>2009-04-29 12:46:18 +0200
commit1e752b178131fa0268151219deb35e09c40e29bc (patch)
tree0b6bbed34179f605d7e6759211a010edea19f9d5 /lib/Plugins
parent52291c1024050d25967b5640b04d67166b7728d2 (diff)
rework commlayerinner usage
new lock method in debugdump
Diffstat (limited to 'lib/Plugins')
-rw-r--r--lib/Plugins/Bugzilla.cpp14
-rw-r--r--lib/Plugins/CCpp.cpp26
-rw-r--r--lib/Plugins/Kerneloops.cpp10
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp4
-rw-r--r--lib/Plugins/Logger.cpp4
-rw-r--r--lib/Plugins/Mailx.cpp6
-rw-r--r--lib/Plugins/Makefile.am14
-rw-r--r--lib/Plugins/RunApp.cpp4
8 files changed, 44 insertions, 38 deletions
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index 7a56966..73b5b0e 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -4,7 +4,7 @@
#include "PluginSettings.h"
#include "DebugDump.h"
#include "ABRTException.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#include <iostream>
CReporterBugzilla::CReporterBugzilla() :
@@ -35,7 +35,7 @@ void CReporterBugzilla::Login()
{
rpc->call(m_pXmlrpcClient, m_pCarriageParm);
ret = xmlrpc_c::value_struct(rpc->getResult());
- ABRTCommLayer::debug("Login id: " + xmlrpc_c::value_int(ret["id"]));
+ comm_layer_inner_debug("Login id: " + xmlrpc_c::value_int(ret["id"]));
}
catch (std::exception& e)
{
@@ -156,7 +156,7 @@ void CReporterBugzilla::NewBug(const map_crash_report_t& pCrashReport)
{
rpc->call(m_pXmlrpcClient, m_pCarriageParm);
ret = xmlrpc_c::value_struct(rpc->getResult());
- ABRTCommLayer::debug("New bug id: " + xmlrpc_c::value_int(ret["id"]));
+ comm_layer_inner_debug("New bug id: " + xmlrpc_c::value_int(ret["id"]));
}
catch (std::exception& e)
{
@@ -170,15 +170,15 @@ void CReporterBugzilla::Report(const map_crash_report_t& pCrashReport, const std
std::string package = pCrashReport.find(FILENAME_PACKAGE)->second[CD_CONTENT];
std::string component = package.substr(0, package.rfind("-", package.rfind("-")-1));
std::string uuid = pCrashReport.find(CD_UUID)->second[CD_CONTENT];
- ABRTCommLayer::status("Logging into bugzilla...");
+ comm_layer_inner_status("Logging into bugzilla...");
Login();
- ABRTCommLayer::status("Checking for duplicates...");
+ comm_layer_inner_status("Checking for duplicates...");
if (!CheckUUIDInBugzilla(component, uuid))
{
- ABRTCommLayer::status("Creating new bug...");
+ comm_layer_inner_status("Creating new bug...");
NewBug(pCrashReport);
}
- ABRTCommLayer::status("Logging out...");
+ comm_layer_inner_status("Logging out...");
Logout();
}
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index da52d0b..62c1722 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -23,10 +23,9 @@
#include "ABRTException.h"
#include "DebugDump.h"
#include "PluginSettings.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#include <fstream>
#include <sstream>
-#include <iostream>
#include <ctype.h>
#include <unistd.h>
#include <sys/types.h>
@@ -86,10 +85,10 @@ std::string CAnalyzerCCpp::CreateHash(const std::string& pInput)
return ss.str();
}
-
+#include <iostream>
void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
{
- ABRTCommLayer::status("Installing debug infos...");
+ comm_layer_inner_status("Installing debug infos...");
std::string packageName = pPackage.substr(0, pPackage.rfind("-", pPackage.rfind("-")-1));
char buff[1024];
@@ -153,11 +152,18 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
else
{
buff[r] = '\0';
- std::cerr << buff;
+ comm_layer_inner_debug(buff);
if (strstr(buff, packageName.c_str()) != NULL &&
strstr(buff, "already installed and latest version") != NULL)
{
- already_installed = true;
+ char* ii = strstr(buff, packageName.c_str());
+ char* jj = strstr(ii, "\n");
+ char* kk = strstr(ii, "already installed and latest version");
+
+ if (jj > kk)
+ {
+ already_installed = true;
+ }
}
if (already_installed == false &&
(strstr(buff, "No debuginfo packages available to install") != NULL ||
@@ -195,7 +201,7 @@ void CAnalyzerCCpp::InstallDebugInfos(const std::string& pPackage)
void CAnalyzerCCpp::GetBacktrace(const std::string& pDebugDumpDir, std::string& pBacktrace)
{
- ABRTCommLayer::status("Getting backtrace...");
+ comm_layer_inner_status("Getting backtrace...");
std::string tmpFile = "/tmp/" + pDebugDumpDir.substr(pDebugDumpDir.rfind("/"));
std::ofstream fTmp;
@@ -422,7 +428,7 @@ void CAnalyzerCCpp::ExecVP(const char* pCommand, char* const pArgs[], const std:
std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
{
- ABRTCommLayer::status("Getting local universal unique identification...");
+ comm_layer_inner_status("Getting local universal unique identification...");
CDebugDump dd;
std::string UID;
@@ -446,7 +452,7 @@ std::string CAnalyzerCCpp::GetLocalUUID(const std::string& pDebugDumpDir)
}
std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir)
{
- ABRTCommLayer::status("Getting global universal unique identification...");
+ comm_layer_inner_status("Getting global universal unique identification...");
std::string backtrace;
std::string executable;
@@ -464,7 +470,7 @@ std::string CAnalyzerCCpp::GetGlobalUUID(const std::string& pDebugDumpDir)
void CAnalyzerCCpp::CreateReport(const std::string& pDebugDumpDir)
{
- ABRTCommLayer::status("Starting report creation...");
+ comm_layer_inner_status("Starting report creation...");
std::string package;
std::string backtrace;
diff --git a/lib/Plugins/Kerneloops.cpp b/lib/Plugins/Kerneloops.cpp
index 3b8fce6..c868bae 100644
--- a/lib/Plugins/Kerneloops.cpp
+++ b/lib/Plugins/Kerneloops.cpp
@@ -29,7 +29,7 @@
#include "DebugDump.h"
#include "PluginSettings.h"
#include "ABRTException.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#include <sstream>
#include <assert.h>
@@ -59,7 +59,7 @@ void CAnalyzerKerneloops::WriteSysLog(int m_nCount)
std::string CAnalyzerKerneloops::GetLocalUUID(const std::string& pDebugDumpDir)
{
- ABRTCommLayer::status("Getting local/global universal unique identification...");
+ comm_layer_inner_status("Getting local/global universal unique identification...");
std::string m_sOops;
std::stringstream m_sHash;
@@ -88,7 +88,7 @@ std::string CAnalyzerKerneloops::GetGlobalUUID(const std::string& pDebugDumpDir)
void CAnalyzerKerneloops::Report()
{
- ABRTCommLayer::status("Creating crash reports...");
+ comm_layer_inner_status("Creating crash reports...");
CDebugDump m_pDebugDump;
char m_sPath[PATH_MAX];
@@ -162,7 +162,7 @@ void CAnalyzerKerneloops::Init()
void CAnalyzerKerneloops::ScanDmesg()
{
- ABRTCommLayer::debug("Scanning dmesg...");
+ comm_layer_inner_debug("Scanning dmesg...");
int m_nFoundOopses;
char *buffer;
@@ -179,7 +179,7 @@ void CAnalyzerKerneloops::ScanDmesg()
void CAnalyzerKerneloops::ScanSysLogFile(const char *filename, int issyslog)
{
- ABRTCommLayer::debug("Scanning syslog...");
+ comm_layer_inner_debug("Scanning syslog...");
char *buffer;
struct stat statb;
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index cbefe0e..b023106 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -26,7 +26,7 @@
#include "KerneloopsReporter.h"
#include "PluginSettings.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#include <stdlib.h>
#include <string.h>
@@ -59,7 +59,7 @@ size_t writefunction(void *ptr, size_t size, size_t nmemb, void __attribute((unu
void CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
- ABRTCommLayer::status("Creating and submitting a report...");
+ comm_layer_inner_status("Creating and submitting a report...");
CURL *handle;
struct curl_httppost *post = NULL;
diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp
index 9d972e3..33ebfa0 100644
--- a/lib/Plugins/Logger.cpp
+++ b/lib/Plugins/Logger.cpp
@@ -24,7 +24,7 @@
#include "PluginSettings.h"
#include <sstream>
#include "DebugDump.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
CLogger::CLogger() :
m_sLogPath("/var/log/abrt-logger"),
@@ -48,7 +48,7 @@ void CLogger::LoadSettings(const std::string& pPath)
void CLogger::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
- ABRTCommLayer::status("Creating a report...");
+ comm_layer_inner_status("Creating a report...");
std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile;
std::ofstream fOut;
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index 069e013..6e596f2 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -25,7 +25,7 @@
#include "DebugDump.h"
#include "ABRTException.h"
#include "PluginSettings.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#define MAILX_COMMAND "/bin/mailx"
@@ -41,7 +41,7 @@ CMailx::CMailx() :
void CMailx::SendEmail(const std::string& pSubject, const std::string& pText)
{
- ABRTCommLayer::status("Sending an email...");
+ comm_layer_inner_status("Sending an email...");
FILE* command;
std::string mailx_command = MAILX_COMMAND + m_sAttachments +
@@ -64,7 +64,7 @@ void CMailx::SendEmail(const std::string& pSubject, const std::string& pText)
void CMailx::Report(const map_crash_report_t& pCrashReport, const std::string& pArgs)
{
- ABRTCommLayer::status("Creating a report...");
+ comm_layer_inner_status("Creating a report...");
std::stringstream emailBody;
std::stringstream binaryFiles, commonFiles, bigTextFiles, additionalFiles, UUIDFile;
diff --git a/lib/Plugins/Makefile.am b/lib/Plugins/Makefile.am
index 3e4aec6..396b205 100644
--- a/lib/Plugins/Makefile.am
+++ b/lib/Plugins/Makefile.am
@@ -1,4 +1,4 @@
-AM_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils
+AM_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -I$(srcdir)/../CommLayer
pluginslibdir=$(PLUGINS_LIB_DIR)
pluginslib_LTLIBRARIES = libCCpp.la \
libMailx.la \
@@ -17,18 +17,18 @@ dist_pluginsconf_DATA = CCpp.conf Mailx.conf SQLite3.conf Logger.conf Kerneloops
libCCpp_la_SOURCES = CCpp.cpp CCpp.h PluginSettings.h
libCCpp_la_LDFLAGS = -avoid-version
libCCpp_la_LIBADD = $(NSS_LIBS)
-libCCpp_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DCCPP_HOOK_PATH=\"${libexecdir}/hookCCpp\" -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(NSS_CFLAGS)
+libCCpp_la_CPPFLAGS = -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DCCPP_HOOK_PATH=\"${libexecdir}/hookCCpp\" -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" $(NSS_CFLAGS)
# Kerneloops
libKerneloops_la_SOURCES = Kerneloops.cpp Kerneloops.h KerneloopsSysLog.cpp KerneloopsSysLog.h PluginSettings.h
libKerneloops_la_LDFLAGS = -avoid-version
-libKerneloops_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" -DCCPP_HOOK_PATH=\"${libexecdir}/hookKerneloopsoops\"
+libKerneloops_la_CPPFLAGS = -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils -DDEBUG_DUMPS_DIR=\"$(DEBUG_DUMPS_DIR)\" -DCCPP_HOOK_PATH=\"${libexecdir}/hookKerneloopsoops\"
# KerneloopsReporter
libKerneloopsReporter_la_SOURCES = KerneloopsReporter.cpp KerneloopsReporter.h PluginSettings.h
libKerneloopsReporter_la_LDFLAGS = -avoid-version
libKerneloopsReporter_la_LIBADD = $(CURL_LIBS)
-libKerneloopsReporter_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare $(CURL_CFLAGS)
+libKerneloopsReporter_la_CPPFLAGS = -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare $(CURL_CFLAGS)
# Mailx
libMailx_la_SOURCES = Mailx.cpp Mailx.h PluginSettings.h
@@ -38,7 +38,7 @@ libMailx_la_LDFLAGS = -avoid-version
libSQLite3_la_SOURCES = SQLite3.cpp SQLite3.h PluginSettings.h
libSQLite3_la_LDFLAGS = -avoid-version
libSQLite3_la_LIBADD = $(SQLITE3_LIBS)
-libSQLite3_la_CPPFLAGS = -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils $(SQLITE3_CFLAGS)
+libSQLite3_la_CPPFLAGS = -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils $(SQLITE3_CFLAGS)
# Logger
libLogger_la_SOURCES = Logger.cpp Logger.h PluginSettings.h
@@ -52,11 +52,11 @@ libRunApp_la_LDFLAGS = -avoid-version
libBugzilla_la_SOURCES = Bugzilla.h Bugzilla.cpp
libBugzilla_la_LIBADD = $(XMLRPC_CPP_LIBS) $(XMLRPC_CLIENT_CPP_LIBS)
libBugzilla_la_LDFLAGS = -avoid-version
-libBugzilla_la_CPPFLAGS = $(XMLRPC_CPP_CFLAGS) $(XMLRPC_CLIENT_CPP_CFLAGS) -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils
+libBugzilla_la_CPPFLAGS = $(XMLRPC_CPP_CFLAGS) $(XMLRPC_CLIENT_CPP_CFLAGS) -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils
# Python
libPython_la_SOURCES = Python.h Python.cpp
#libPython_la_LIBADD = $(NSS_LIBS)
libPython_la_LDFLAGS = -avoid-version
-libPython_la_CPPFLAGS = $(NSS_CFLAGS) -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils
+libPython_la_CPPFLAGS = $(NSS_CFLAGS) -I$(srcdir)/../CommLayer -I$(srcdir)/../../inc -I$(srcdir)/../MiddleWare -I$(srcdir)/../Utils
diff --git a/lib/Plugins/RunApp.cpp b/lib/Plugins/RunApp.cpp
index 5a20283..4f9d21d 100644
--- a/lib/Plugins/RunApp.cpp
+++ b/lib/Plugins/RunApp.cpp
@@ -24,7 +24,7 @@
#include <stdio.h>
#include "DebugDump.h"
#include "ABRTException.h"
-#include "ABRTCommLayer.h"
+#include "CommLayerInner.h"
#define COMMAND 0
#define FILENAME 1
@@ -59,7 +59,7 @@ void CActionRunApp::ParseArgs(const std::string& psArgs, vector_args_t& pArgs)
void CActionRunApp::Run(const std::string& pDebugDumpDir,
const std::string& pArgs)
{
- ABRTCommLayer::status("Executing RunApp plugin...");
+ comm_layer_inner_status("Executing RunApp plugin...");
char line[1024];
std::string output = "";