From 86fc61db75385d6fb452b4cf88aec1deffa3a5be Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 23 Nov 2010 15:51:54 +0100 Subject: remove sqlite DB This change removes sqlite database. Database was used to find dump dirs by [UID:]UUID. This patch uses more natural way: dump dirs are addressed by their directory names. DB was also used to produce a list of dump dirs. Now it is done by iterating over the /var/spool/abrt directory. And finally, DB was also used to find duplicate UUIDs. Now it is done by iterating over the /var/spool/abrt directory. Crash count, "inform all" and reporting result message are moved from DB field to a file in dump dir. "Reported" DB field is deleted - if message != "", then this dump was reported. Signed-off-by: Denys Vlasenko --- src/lib/Makefile.am | 1 - src/lib/database.c | 73 -------------------------------------------------- src/lib/dump_dir.c | 2 +- src/lib/make_descr.cpp | 9 +++---- src/lib/test.cpp | 4 +-- 5 files changed, 7 insertions(+), 82 deletions(-) delete mode 100644 src/lib/database.c (limited to 'src/lib') diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index cb42abe7..0561e316 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -38,7 +38,6 @@ libABRTUtils_la_SOURCES = \ run_event.c \ abrt_packages.c abrt_packages.h \ hooklib.c hooklib.h \ - database.c \ parse_options.c parse_options.h libABRTUtils_la_CPPFLAGS = \ -Wall -Werror \ diff --git a/src/lib/database.c b/src/lib/database.c deleted file mode 100644 index 2b742ebf..00000000 --- a/src/lib/database.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - Copyright (C) 2010 ABRT team - Copyright (C) 2010 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 "abrtlib.h" -#include "database.h" - -struct db_row *db_rowcpy_from_list(GList* list) -{ - GList *first = g_list_first(list); - struct db_row *row = (struct db_row*)xzalloc(sizeof(struct db_row)); - struct db_row *src_row = (struct db_row*)first->data; - /* All fields are initialized below, copying is not needed - * memcpy(row, (struct db_row*)first->data, sizeof(struct db_row)); - */ - - row->db_uuid = xstrdup(src_row->db_uuid); - row->db_uid = xstrdup(src_row->db_uid); - row->db_inform_all = xstrdup(src_row->db_inform_all); - row->db_dump_dir = xstrdup(src_row->db_dump_dir); - row->db_count = xstrdup(src_row->db_count); - row->db_reported = xstrdup(src_row->db_reported); - row->db_message = xstrdup(src_row->db_message); - row->db_time = xstrdup(src_row->db_time); - - return row; -} - -void db_row_free(struct db_row *row) -{ - if (!row) - return; - - free(row->db_uuid); - free(row->db_uid); - free(row->db_inform_all); - free(row->db_dump_dir); - free(row->db_count); - free(row->db_reported); - free(row->db_message); - free(row->db_time); - - free(row); -} - -void db_list_free(GList *list) -{ - if (!list) - return; - - for (GList *li = list; li != NULL; li = g_list_next(li)) - { - struct db_row *row = (struct db_row*)li->data; - db_row_free(row); - } - g_list_free(list); -} - diff --git a/src/lib/dump_dir.c b/src/lib/dump_dir.c index 19c49ce7..486c7cfe 100644 --- a/src/lib/dump_dir.c +++ b/src/lib/dump_dir.c @@ -311,7 +311,7 @@ struct dump_dir *dd_create(const char *dir, uid_t uid) char long_str[sizeof(long) * 3 + 2]; sprintf(long_str, "%lu", (long)uid); - dd_save_text(dd, CD_UID, long_str); + dd_save_text(dd, FILENAME_UID, long_str); struct utsname buf; uname(&buf); /* never fails */ diff --git a/src/lib/make_descr.cpp b/src/lib/make_descr.cpp index 33f45b9d..90c73667 100644 --- a/src/lib/make_descr.cpp +++ b/src/lib/make_descr.cpp @@ -67,12 +67,11 @@ static const char *const blacklisted_items[] = { FILENAME_DESCRIPTION, /* package description - basically useless */ FILENAME_HOSTNAME , FILENAME_DUPHASH , - CD_UUID , - CD_INFORMALL , + FILENAME_UUID , + FILENAME_INFORMALL, CD_DUMPDIR , - CD_COUNT , - CD_REPORTED , - CD_MESSAGE , + FILENAME_COUNT , + FILENAME_MESSAGE , NULL }; diff --git a/src/lib/test.cpp b/src/lib/test.cpp index a548dc21..c8269cd1 100644 --- a/src/lib/test.cpp +++ b/src/lib/test.cpp @@ -83,14 +83,14 @@ int main(int argc, char** argv) std::cout << "Application Crashed! " << crashInfo[FILENAME_PACKAGE][CD_CONTENT] << ", " << crashInfo[FILENAME_EXECUTABLE][CD_CONTENT] << ", " << - crashInfo[CD_COUNT][CD_CONTENT] << ", " << std::endl; + crashInfo[FILENAME_COUNT][CD_CONTENT] << ", " << std::endl; /* Get Report, so user can change data (remove private stuff) * If we do not want user interaction, just send data immediately */ map_crash_data_t crashReport; middleWare.CreateCrashReport(crashInfo[FILENAME_DUPHASH][CD_CONTENT], - crashInfo[CD_UID][CD_CONTENT], + crashInfo[FILENAME_UID][CD_CONTENT], crashReport); /* Report crash */ middleWare.Report(crashReport); -- cgit