summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2009-11-10 14:25:40 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-10 14:25:40 +0100
commitc0ee9dabb895e9079a6367a823187f9e687c3e4a (patch)
tree0c06abb4063c099918e641be9106fb16ee2665a6
parent8ddd4fb2e18e4ae996907a930aaedb5ceea1b78b (diff)
downloadabrt-c0ee9dabb895e9079a6367a823187f9e687c3e4a.tar.gz
abrt-c0ee9dabb895e9079a6367a823187f9e687c3e4a.tar.xz
abrt-c0ee9dabb895e9079a6367a823187f9e687c3e4a.zip
remove getSettings from most plugins (inherited one is ok)
Also move parse_release() to abrtlib, it's shared among Bugzilla and Catcut. Tested Bugzilla and Catcut, both work. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--inc/abrtlib.h2
-rw-r--r--lib/Plugins/Bugzilla.cpp53
-rw-r--r--lib/Plugins/Bugzilla.h6
-rw-r--r--lib/Plugins/CCpp.cpp23
-rw-r--r--lib/Plugins/CCpp.h3
-rw-r--r--lib/Plugins/Catcut.cpp42
-rw-r--r--lib/Plugins/FileTransfer.cpp24
-rw-r--r--lib/Plugins/FileTransfer.h3
-rw-r--r--lib/Plugins/KerneloopsReporter.cpp21
-rw-r--r--lib/Plugins/KerneloopsReporter.h3
-rw-r--r--lib/Plugins/Logger.cpp32
-rw-r--r--lib/Plugins/Logger.h3
-rw-r--r--lib/Plugins/Mailx.cpp43
-rw-r--r--lib/Plugins/Mailx.h3
-rw-r--r--lib/Plugins/SQLite3.cpp22
-rw-r--r--lib/Plugins/SQLite3.h3
-rw-r--r--lib/Plugins/TicketUploader.cpp32
-rw-r--r--lib/Plugins/TicketUploader.h3
-rw-r--r--lib/Utils/Makefile.am1
-rw-r--r--lib/Utils/parse_release.cpp38
-rwxr-xr-xscripts/dbg_mkrpm7
-rw-r--r--src/Daemon/Daemon.cpp11
-rw-r--r--src/Daemon/Settings.cpp2
23 files changed, 202 insertions, 178 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index f9228d31..01dfc08a 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -217,4 +217,6 @@ to_string(T x)
return o.str();
}
+void parse_release(const char *pRelease, std::string& pProduct, std::string& pVersion);
+
#endif
diff --git a/lib/Plugins/Bugzilla.cpp b/lib/Plugins/Bugzilla.cpp
index b3cef929..06f93342 100644
--- a/lib/Plugins/Bugzilla.cpp
+++ b/lib/Plugins/Bugzilla.cpp
@@ -8,43 +8,12 @@
#include "ABRTException.h"
#include "CommLayerInner.h"
#ifdef HAVE_CONFIG_H
- #include <config.h>
+# include <config.h>
#endif
#define XML_RPC_SUFFIX "/xmlrpc.cgi"
-static void get_product_and_version(const std::string& pRelease,
- std::string& pProduct,
- std::string& pVersion)
-{
- if (pRelease.find("Rawhide") != std::string::npos)
- {
- pProduct = "Fedora";
- pVersion = "rawhide";
- return;
- }
- if (pRelease.find("Fedora") != std::string::npos)
- {
- pProduct = "Fedora";
- }
- else if (pRelease.find("Red Hat Enterprise Linux") != std::string::npos)
- {
- pProduct = "Red Hat Enterprise Linux ";
- }
- std::string::size_type pos = pRelease.find("release");
- pos = pRelease.find(" ", pos) + 1;
- while (pRelease[pos] != ' ')
- {
- pVersion += pRelease[pos];
- if (pProduct == "Red Hat Enterprise Linux ")
- {
- pProduct += pRelease[pos];
- }
- pos++;
- }
-}
-
static void create_new_bug_description(const map_crash_report_t& pCrashReport, std::string& pDescription)
{
pDescription = "abrt detected a crash.\n\n";
@@ -272,7 +241,7 @@ uint32_t ctx::new_bug(const map_crash_report_t& pCrashReport)
std::string product;
std::string version;
- get_product_and_version(release, product, version);
+ parse_release(release.c_str(), product, version);
xmlrpc_value* param = xmlrpc_build_value(&env, "({s:s,s:s,s:s,s:s,s:s,s:s,s:s})",
"product", product.c_str(),
@@ -368,14 +337,14 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
std::string BugzillaURL;
bool NoSSLVerify;
map_plugin_settings_t settings = parse_settings(pSettings);
- /* if parse_settings fails it returns an empty map so we need to use defaults*/
- if(!settings.empty())
+ /* if parse_settings fails it returns an empty map so we need to use defaults */
+ if (!settings.empty())
{
Login = settings["Login"];
Password = settings["Password"];
BugzillaXMLRPC = settings["BugzillaXMLRPC"];
BugzillaURL = settings["BugzillaURL"];
- NoSSLVerify = settings["NoSSLVerify"] == "yes";
+ NoSSLVerify = string_to_bool(settings["NoSSLVerify"].c_str());
}
else
{
@@ -437,9 +406,9 @@ std::string CReporterBugzilla::Report(const map_crash_report_t& pCrashReport,
map_plugin_settings_t CReporterBugzilla::parse_settings(const map_plugin_settings_t& pSettings)
{
map_plugin_settings_t plugin_settings;
- map_plugin_settings_t::const_iterator it;
- map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
it = pSettings.find("BugzillaURL");
if (it != end)
{
@@ -491,6 +460,8 @@ map_plugin_settings_t CReporterBugzilla::parse_settings(const map_plugin_setting
void CReporterBugzilla::SetSettings(const map_plugin_settings_t& pSettings)
{
+ m_pSettings = pSettings;
+
//BUG! This gets called when user's keyring contains login data,
//then it takes precedence over /etc/abrt/plugins/Bugzilla.conf.
//I got a case when keyring had a STALE password, and there was no way
@@ -498,9 +469,8 @@ void CReporterBugzilla::SetSettings(const map_plugin_settings_t& pSettings)
//(by hacking abrt source!), I don't know how to purge it from the keyring.
//At the very least, log("SOMETHING") here.
- map_plugin_settings_t::const_iterator it;
map_plugin_settings_t::const_iterator end = pSettings.end();
-
+ map_plugin_settings_t::const_iterator it;
it = pSettings.find("BugzillaURL");
if (it != end)
{
@@ -538,10 +508,11 @@ void CReporterBugzilla::SetSettings(const map_plugin_settings_t& pSettings)
it = pSettings.find("NoSSLVerify");
if (it != end)
{
- m_bNoSSLVerify = (it->second == "yes");
+ m_bNoSSLVerify = string_to_bool(it->second.c_str());
}
}
+/* Should not be deleted (why?) */
const map_plugin_settings_t& CReporterBugzilla::GetSettings()
{
m_pSettings["BugzillaURL"] = m_sBugzillaURL;
diff --git a/lib/Plugins/Bugzilla.h b/lib/Plugins/Bugzilla.h
index 55a5f5f0..9130a698 100644
--- a/lib/Plugins/Bugzilla.h
+++ b/lib/Plugins/Bugzilla.h
@@ -19,11 +19,13 @@ class CReporterBugzilla : public CReporter
public:
CReporterBugzilla();
virtual ~CReporterBugzilla();
- virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+
virtual std::string Report(const map_crash_report_t& pCrashReport,
const map_plugin_settings_t& pSettings,
const std::string& pArgs);
+
+ virtual void SetSettings(const map_plugin_settings_t& pSettings);
+ virtual const map_plugin_settings_t& GetSettings();
};
#endif /* BUGZILLA_H_ */
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp
index 5f87235c..82c5677d 100644
--- a/lib/Plugins/CCpp.cpp
+++ b/lib/Plugins/CCpp.cpp
@@ -980,7 +980,7 @@ void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
it = pSettings.find("MemoryMap");
if (it != end)
{
- m_bMemoryMap = it->second == "yes";
+ m_bMemoryMap = string_to_bool(it->second.c_str());
}
it = pSettings.find("DebugInfo");
if (it != end)
@@ -997,19 +997,20 @@ void CAnalyzerCCpp::SetSettings(const map_plugin_settings_t& pSettings)
it = pSettings.find("InstallDebuginfo");
if (it != end)
{
- m_bInstallDebugInfo = it->second == "yes";
+ m_bInstallDebugInfo = string_to_bool(it->second.c_str());
}
}
-const map_plugin_settings_t& CAnalyzerCCpp::GetSettings()
-{
- m_pSettings["MemoryMap"] = m_bMemoryMap ? "yes" : "no";
- m_pSettings["DebugInfo"] = m_sDebugInfo;
- m_pSettings["DebugInfoCacheMB"] = to_string(m_nDebugInfoCacheMB);
- m_pSettings["InstallDebugInfo"] = m_bInstallDebugInfo ? "yes" : "no";
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CAnalyzerCCpp::GetSettings()
+//{
+// m_pSettings["MemoryMap"] = m_bMemoryMap ? "yes" : "no";
+// m_pSettings["DebugInfo"] = m_sDebugInfo;
+// m_pSettings["DebugInfoCacheMB"] = to_string(m_nDebugInfoCacheMB);
+// m_pSettings["InstallDebugInfo"] = m_bInstallDebugInfo ? "yes" : "no";
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(ANALYZER,
CAnalyzerCCpp,
diff --git a/lib/Plugins/CCpp.h b/lib/Plugins/CCpp.h
index e2abdece..3fa0d99a 100644
--- a/lib/Plugins/CCpp.h
+++ b/lib/Plugins/CCpp.h
@@ -44,7 +44,8 @@ class CAnalyzerCCpp : public CAnalyzer
virtual void Init();
virtual void DeInit();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
};
#endif /* CCPP */
diff --git a/lib/Plugins/Catcut.cpp b/lib/Plugins/Catcut.cpp
index f594bb48..e6d16b4f 100644
--- a/lib/Plugins/Catcut.cpp
+++ b/lib/Plugins/Catcut.cpp
@@ -68,41 +68,6 @@ static void create_new_bug_description(const map_crash_report_t& pCrashReport, s
}
}
-static void
-get_product_and_version(const char *pRelease,
- string& pProduct,
- string& pVersion)
-{
- if (strstr(pRelease, "Rawhide"))
- {
- pProduct = "Fedora";
- pVersion = "rawhide";
- return;
- }
- if (strstr(pRelease, "Fedora"))
- {
- pProduct = "Fedora";
- }
- else if (strstr(pRelease, "Red Hat Enterprise Linux"))
- {
- pProduct = "Red Hat Enterprise Linux ";
- }
-
- const char *release = strstr(pRelease, "release");
- const char *space = release ? strchr(release, ' ') : NULL;
-
- if (space++) while (*space != '\0' && *space != ' ')
- {
- /* Eat string like "5.2" */
- pVersion += *space;
- if (pProduct == "Red Hat Enterprise Linux ")
- {
- pProduct += *space;
- }
- space++;
- }
-}
-
static int
put_stream(const char *pURL, FILE* f, size_t content_length)
{
@@ -364,7 +329,7 @@ ctx::new_bug(const char *auth_cookie, const map_crash_report_t& pCrashReport)
string product;
string version;
- get_product_and_version(release.c_str(), product, version);
+ parse_release(release.c_str(), product, version);
xmlrpc_value *param = xmlrpc_build_value(&env, "(s{s:s,s:s,s:s,s:s,s:s,s:s,s:s})",
auth_cookie,
@@ -570,9 +535,8 @@ void CReporterCatcut::SetSettings(const map_plugin_settings_t& pSettings)
{
m_pSettings = pSettings;
- map_plugin_settings_t::const_iterator it;
map_plugin_settings_t::const_iterator end = pSettings.end();
-
+ map_plugin_settings_t::const_iterator it;
it = pSettings.find("CatcutURL");
if (it != end)
{
@@ -591,7 +555,7 @@ void CReporterCatcut::SetSettings(const map_plugin_settings_t& pSettings)
it = pSettings.find("NoSSLVerify");
if (it != end)
{
- m_bNoSSLVerify = it->second == "yes";
+ m_bNoSSLVerify = string_to_bool(it->second.c_str());
}
it = pSettings.find("RetryCount");
if (it != end)
diff --git a/lib/Plugins/FileTransfer.cpp b/lib/Plugins/FileTransfer.cpp
index 72b3b16e..868f54dd 100644
--- a/lib/Plugins/FileTransfer.cpp
+++ b/lib/Plugins/FileTransfer.cpp
@@ -370,8 +370,11 @@ void CFileTransfer::Run(const char *pActionDir, const char *pArgs)
void CFileTransfer::SetSettings(const map_plugin_settings_t& pSettings)
{
+ m_pSettings = pSettings;
+
map_plugin_settings_t::const_iterator end = pSettings.end();
- map_plugin_settings_t::const_iterator it = pSettings.find("URL");
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("URL");
if (it != end)
{
m_sURL = it->second;
@@ -405,15 +408,16 @@ void CFileTransfer::SetSettings(const map_plugin_settings_t& pSettings)
}
}
-const map_plugin_settings_t& CFileTransfer::GetSettings()
-{
- m_pSettings["URL"] = m_sURL;
- m_pSettings["RetryCount"] = to_string(m_nRetryCount);
- m_pSettings["RetryDelay"] = to_string(m_nRetryDelay);
- m_pSettings["ArchiveType"] = m_sArchiveType;
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CFileTransfer::GetSettings()
+//{
+// m_pSettings["URL"] = m_sURL;
+// m_pSettings["RetryCount"] = to_string(m_nRetryCount);
+// m_pSettings["RetryDelay"] = to_string(m_nRetryDelay);
+// m_pSettings["ArchiveType"] = m_sArchiveType;
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(ACTION,
CFileTransfer,
diff --git a/lib/Plugins/FileTransfer.h b/lib/Plugins/FileTransfer.h
index 9caa2567..91207f49 100644
--- a/lib/Plugins/FileTransfer.h
+++ b/lib/Plugins/FileTransfer.h
@@ -41,7 +41,8 @@ class CFileTransfer : public CAction
public:
CFileTransfer();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
virtual void Run(const char *pActionDir, const char *pArgs);
};
diff --git a/lib/Plugins/KerneloopsReporter.cpp b/lib/Plugins/KerneloopsReporter.cpp
index cfb4e050..f7a6cbb8 100644
--- a/lib/Plugins/KerneloopsReporter.cpp
+++ b/lib/Plugins/KerneloopsReporter.cpp
@@ -118,18 +118,23 @@ std::string CKerneloopsReporter::Report(const map_crash_report_t& pCrashReport,
void CKerneloopsReporter::SetSettings(const map_plugin_settings_t& pSettings)
{
- map_plugin_settings_t::const_iterator it = pSettings.find("SubmitURL");
- if (it != pSettings.end()) {
+ m_pSettings = pSettings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("SubmitURL");
+ if (it != end) {
m_sSubmitURL = it->second;
}
}
-const map_plugin_settings_t& CKerneloopsReporter::GetSettings()
-{
- m_pSettings["SubmitURL"] = m_sSubmitURL;
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CKerneloopsReporter::GetSettings()
+//{
+// m_pSettings["SubmitURL"] = m_sSubmitURL;
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(REPORTER,
CKerneloopsReporter,
diff --git a/lib/Plugins/KerneloopsReporter.h b/lib/Plugins/KerneloopsReporter.h
index 7f6ab8cc..af82afbe 100644
--- a/lib/Plugins/KerneloopsReporter.h
+++ b/lib/Plugins/KerneloopsReporter.h
@@ -41,7 +41,8 @@ class CKerneloopsReporter : public CReporter
CKerneloopsReporter();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
virtual std::string Report(const map_crash_report_t& pCrashReport,
const map_plugin_settings_t& pSettings,
const std::string& pArgs);
diff --git a/lib/Plugins/Logger.cpp b/lib/Plugins/Logger.cpp
index b2ac1ade..6babc732 100644
--- a/lib/Plugins/Logger.cpp
+++ b/lib/Plugins/Logger.cpp
@@ -19,9 +19,10 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "Logger.h"
#include <fstream>
#include <sstream>
+#include "abrtlib.h"
+#include "Logger.h"
#include "DebugDump.h"
#include "CommLayerInner.h"
#include "ABRTException.h"
@@ -33,23 +34,30 @@ CLogger::CLogger() :
void CLogger::SetSettings(const map_plugin_settings_t& pSettings)
{
- if (pSettings.find("LogPath") != pSettings.end())
+ m_pSettings = pSettings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("LogPath");
+ if (it != end)
{
- m_sLogPath = pSettings.find("LogPath")->second;
+ m_sLogPath = it->second;
}
- if (pSettings.find("AppendLogs") != pSettings.end())
+ it = pSettings.find("AppendLogs");
+ if (it != end)
{
- m_bAppendLogs = pSettings.find("AppendLogs")->second == "yes";
+ m_bAppendLogs = string_to_bool(it->second.c_str());
}
}
-const map_plugin_settings_t& CLogger::GetSettings()
-{
- m_pSettings["LogPath"] = m_sLogPath;
- m_pSettings["AppendLogs"] = m_bAppendLogs ? "yes" : "no";
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CLogger::GetSettings()
+//{
+// m_pSettings["LogPath"] = m_sLogPath;
+// m_pSettings["AppendLogs"] = m_bAppendLogs ? "yes" : "no";
+//
+// return m_pSettings;
+//}
std::string CLogger::Report(const map_crash_report_t& pCrashReport,
const map_plugin_settings_t& pSettings, const std::string& pArgs)
diff --git a/lib/Plugins/Logger.h b/lib/Plugins/Logger.h
index 0969bea6..285e25ba 100644
--- a/lib/Plugins/Logger.h
+++ b/lib/Plugins/Logger.h
@@ -35,7 +35,8 @@ class CLogger : public CReporter
CLogger();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
virtual std::string Report(const map_crash_report_t& pCrashReport,
const map_plugin_settings_t& pSettings,
const std::string& pArgs);
diff --git a/lib/Plugins/Mailx.cpp b/lib/Plugins/Mailx.cpp
index f0834049..1979f9e8 100644
--- a/lib/Plugins/Mailx.cpp
+++ b/lib/Plugins/Mailx.cpp
@@ -201,33 +201,42 @@ std::string CMailx::Report(const map_crash_report_t& pCrashReport,
void CMailx::SetSettings(const map_plugin_settings_t& pSettings)
{
- if (pSettings.find("Subject") != pSettings.end())
+ m_pSettings = pSettings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("Subject");
+ if (it != end)
{
- m_sSubject = pSettings.find("Subject")->second;
+ m_sSubject = it->second;
}
- if (pSettings.find("EmailFrom") != pSettings.end())
+ it = pSettings.find("EmailFrom");
+ if (it != end)
{
- m_sEmailFrom = pSettings.find("EmailFrom")->second;
+ m_sEmailFrom = it->second;
}
- if (pSettings.find("EmailTo") != pSettings.end())
+ it = pSettings.find("EmailTo");
+ if (it != end)
{
- m_sEmailTo = pSettings.find("EmailTo")->second;
+ m_sEmailTo = it->second;
}
- if (pSettings.find("SendBinaryData") != pSettings.end())
+ it = pSettings.find("SendBinaryData");
+ if (it != end)
{
- m_bSendBinaryData = pSettings.find("SendBinaryData")->second == "yes";
+ m_bSendBinaryData = string_to_bool(it->second.c_str());
}
}
-const map_plugin_settings_t& CMailx::GetSettings()
-{
- m_pSettings["Subject"] = m_sSubject;
- m_pSettings["EmailFrom"] = m_sEmailFrom;
- m_pSettings["EmailTo"] = m_sEmailTo;
- m_pSettings["SendBinaryData"] = m_bSendBinaryData ? "yes" : "no";
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CMailx::GetSettings()
+//{
+// m_pSettings["Subject"] = m_sSubject;
+// m_pSettings["EmailFrom"] = m_sEmailFrom;
+// m_pSettings["EmailTo"] = m_sEmailTo;
+// m_pSettings["SendBinaryData"] = m_bSendBinaryData ? "yes" : "no";
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(REPORTER,
CMailx,
diff --git a/lib/Plugins/Mailx.h b/lib/Plugins/Mailx.h
index 7af11885..4aa861f1 100644
--- a/lib/Plugins/Mailx.h
+++ b/lib/Plugins/Mailx.h
@@ -47,7 +47,8 @@ class CMailx : public CReporter
CMailx();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
virtual std::string Report(const map_crash_report_t& pCrashReport,
const map_plugin_settings_t& pSettings,
const std::string& pArgs);
diff --git a/lib/Plugins/SQLite3.cpp b/lib/Plugins/SQLite3.cpp
index ab39d040..3aad0545 100644
--- a/lib/Plugins/SQLite3.cpp
+++ b/lib/Plugins/SQLite3.cpp
@@ -398,18 +398,24 @@ database_row_t CSQLite3::GetUUIDData(const std::string& pUUID, const std::string
void CSQLite3::SetSettings(const map_plugin_settings_t& pSettings)
{
- if (pSettings.find("DBPath") != pSettings.end())
+ m_pSettings = pSettings;
+
+ map_plugin_settings_t::const_iterator end = pSettings.end();
+ map_plugin_settings_t::const_iterator it;
+ it = pSettings.find("DBPath");
+ if (it != end)
{
- m_sDBPath = pSettings.find("DBPath")->second;
+ m_sDBPath = it->second;
}
}
-const map_plugin_settings_t& CSQLite3::GetSettings()
-{
- m_pSettings["DBPath"] = m_sDBPath;
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CSQLite3::GetSettings()
+//{
+// m_pSettings["DBPath"] = m_sDBPath;
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(DATABASE,
CSQLite3,
diff --git a/lib/Plugins/SQLite3.h b/lib/Plugins/SQLite3.h
index 0eb3d086..fc13bd73 100644
--- a/lib/Plugins/SQLite3.h
+++ b/lib/Plugins/SQLite3.h
@@ -58,7 +58,8 @@ class CSQLite3 : public CDatabase
virtual database_row_t GetUUIDData(const std::string& pUUID, const std::string& pUID);
virtual void SetSettings(const map_plugin_settings_t& pSettings);
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
};
#endif /* SQLITE3_H_ */
diff --git a/lib/Plugins/TicketUploader.cpp b/lib/Plugins/TicketUploader.cpp
index e380de09..76bda400 100644
--- a/lib/Plugins/TicketUploader.cpp
+++ b/lib/Plugins/TicketUploader.cpp
@@ -341,9 +341,10 @@ string CTicketUploader::Report(const map_crash_report_t& pCrashReport,
void CTicketUploader::SetSettings(const map_plugin_settings_t& pSettings)
{
+ m_pSettings = pSettings;
+
map_plugin_settings_t::const_iterator end = pSettings.end();
map_plugin_settings_t::const_iterator it;
-
it = pSettings.find("Customer");
if (it != end)
{
@@ -362,12 +363,12 @@ void CTicketUploader::SetSettings(const map_plugin_settings_t& pSettings)
it = pSettings.find("Encrypt");
if (it != end)
{
- m_bEncrypt = it->second == "yes";
+ m_bEncrypt = string_to_bool(it->second.c_str());
}
it = pSettings.find("Upload");
if (it != end)
{
- m_bUpload = it->second == "yes";
+ m_bUpload = string_to_bool(it->second.c_str());
}
it = pSettings.find("RetryCount");
if (it != end)
@@ -381,18 +382,19 @@ void CTicketUploader::SetSettings(const map_plugin_settings_t& pSettings)
}
}
-const map_plugin_settings_t& CTicketUploader::GetSettings()
-{
- m_pSettings["Customer"] = m_sCustomer;
- m_pSettings["Ticket"] = m_sTicket;
- m_pSettings["URL"] = m_sURL;
- m_pSettings["Encrypt"] = m_bEncrypt ? "yes" : "no";
- m_pSettings["Upload"] = m_bEncrypt ? "yes" : "no";
- m_pSettings["RetryCount"] = to_string(m_nRetryCount);
- m_pSettings["RetryDelay"] = to_string(m_nRetryDelay);
-
- return m_pSettings;
-}
+//ok to delete?
+//const map_plugin_settings_t& CTicketUploader::GetSettings()
+//{
+// m_pSettings["Customer"] = m_sCustomer;
+// m_pSettings["Ticket"] = m_sTicket;
+// m_pSettings["URL"] = m_sURL;
+// m_pSettings["Encrypt"] = m_bEncrypt ? "yes" : "no";
+// m_pSettings["Upload"] = m_bEncrypt ? "yes" : "no";
+// m_pSettings["RetryCount"] = to_string(m_nRetryCount);
+// m_pSettings["RetryDelay"] = to_string(m_nRetryDelay);
+//
+// return m_pSettings;
+//}
PLUGIN_INFO(REPORTER,
CTicketUploader,
diff --git a/lib/Plugins/TicketUploader.h b/lib/Plugins/TicketUploader.h
index 9ae3478f..2a7c98af 100644
--- a/lib/Plugins/TicketUploader.h
+++ b/lib/Plugins/TicketUploader.h
@@ -45,7 +45,8 @@ class CTicketUploader : public CReporter
public:
CTicketUploader();
virtual ~CTicketUploader();
- virtual const map_plugin_settings_t& GetSettings();
+//ok to delete?
+// virtual const map_plugin_settings_t& GetSettings();
virtual void SetSettings(const map_plugin_settings_t& pSettings);
virtual std::string Report(const map_crash_report_t& pCrashReport,
diff --git a/lib/Utils/Makefile.am b/lib/Utils/Makefile.am
index d2596f39..1b141bd7 100644
--- a/lib/Utils/Makefile.am
+++ b/lib/Utils/Makefile.am
@@ -11,6 +11,7 @@ libABRTUtils_la_SOURCES = \
logging.cpp \
copyfd.cpp \
skip_whitespace.cpp \
+ parse_release.cpp \
CrashTypesSocket.cpp \
DebugDump.h DebugDump.cpp \
CommLayerInner.h CommLayerInner.cpp \
diff --git a/lib/Utils/parse_release.cpp b/lib/Utils/parse_release.cpp
new file mode 100644
index 00000000..33d3edb1
--- /dev/null
+++ b/lib/Utils/parse_release.cpp
@@ -0,0 +1,38 @@
+#include "abrtlib.h"
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+using namespace std;
+
+void parse_release(const char *pRelease, string& pProduct, string& pVersion)
+{
+ if (strstr(pRelease, "Rawhide"))
+ {
+ pProduct = "Fedora";
+ pVersion = "rawhide";
+ return;
+ }
+ if (strstr(pRelease, "Fedora"))
+ {
+ pProduct = "Fedora";
+ }
+ else if (strstr(pRelease, "Red Hat Enterprise Linux"))
+ {
+ pProduct = "Red Hat Enterprise Linux ";
+ }
+
+ const char *release = strstr(pRelease, "release");
+ const char *space = release ? strchr(release, ' ') : NULL;
+
+ if (space++) while (*space != '\0' && *space != ' ')
+ {
+ /* Eat string like "5.2" */
+ pVersion += *space;
+ if (pProduct == "Red Hat Enterprise Linux ")
+ {
+ pProduct += *space;
+ }
+ space++;
+ }
+}
diff --git a/scripts/dbg_mkrpm b/scripts/dbg_mkrpm
index 28b040e5..e5f0fe97 100755
--- a/scripts/dbg_mkrpm
+++ b/scripts/dbg_mkrpm
@@ -23,5 +23,8 @@ rm -rf "$T" || exit
gzip "abrt-$ABRTVER".tar || exit
-
-./dbg_rpmbuildlocal -bb abrt.spec 2>&1 | tee -a "$0.log"
+# Less ugly way to pass exitcode (without bashisms)?
+{ ./dbg_rpmbuildlocal -bb abrt.spec 2>&1; echo $? >"EXITCODE"; } | tee -a "$0.log"
+ret=`cat EXITCODE`
+rm EXITCODE
+exit "$ret"
diff --git a/src/Daemon/Daemon.cpp b/src/Daemon/Daemon.cpp
index 2945cc24..3ceab47c 100644
--- a/src/Daemon/Daemon.cpp
+++ b/src/Daemon/Daemon.cpp
@@ -376,23 +376,24 @@ static void FindNewDumps(const char* pPath)
switch (res)
{
case MW_OK:
- VERB1 log("Saving into database (%s)", itt->c_str());
+ VERB1 log("Saving %s into database", itt->c_str());
RunActionsAndReporters(crashinfo[CD_MWDDD][CD_CONTENT].c_str());
break;
case MW_IN_DB:
- VERB1 log("Already saved in database (%s)", itt->c_str());
+ VERB1 log("%s is already saved in database", itt->c_str());
break;
case MW_REPORTED:
case MW_OCCURED:
+ VERB1 log("Already saved crash %s, deleting", itt->c_str());
+ DeleteDebugDumpDir(itt->c_str());
+ break;
case MW_BLACKLISTED:
case MW_CORRUPTED:
case MW_PACKAGE_ERROR:
case MW_GPG_ERROR:
case MW_FILE_ERROR:
default:
-//Perhaps corrupted & bad needs to be logged unconditionally,
-//already saved one - only on VERB1
- VERB1 log("Corrupted, bad or already saved crash, deleting");
+ log("Corrupted or bad crash %s (res:%d), deleting", itt->c_str(), (int)res);
DeleteDebugDumpDir(itt->c_str());
break;
}
diff --git a/src/Daemon/Settings.cpp b/src/Daemon/Settings.cpp
index d9c9a98b..cefd35a4 100644
--- a/src/Daemon/Settings.cpp
+++ b/src/Daemon/Settings.cpp
@@ -132,7 +132,7 @@ static void ParseCommon()
map_string_t::const_iterator end = s_mapSectionCommon.end();
if (it != end)
{
- g_settings_bOpenGPGCheck = it->second == "yes";
+ g_settings_bOpenGPGCheck = string_to_bool(it->second.c_str());
}
it = s_mapSectionCommon.find("OpenGPGPublicKeys");
if (it != end)