From 0c292e1b3af43961daa5e521572389766ed8261c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pawe=C5=82=20Go=C5=82aszewski?= Date: Thu, 9 Jun 2011 16:07:55 +0000 Subject: [PATCH] - rel.3 - add debian patch with dpkg plugin and some other fixes Changed files: ccze-debian.patch -> 1.1 ccze.spec -> 1.9 --- ccze-debian.patch | 322 ++++++++++++++++++++++++++++++++++++++++++++++ ccze.spec | 4 +- 2 files changed, 325 insertions(+), 1 deletion(-) create mode 100644 ccze-debian.patch diff --git a/ccze-debian.patch b/ccze-debian.patch new file mode 100644 index 0000000..c0c3113 --- /dev/null +++ b/ccze-debian.patch @@ -0,0 +1,322 @@ +--- ccze-0.2.1.orig/ccze.plugins ++++ ccze-0.2.1/ccze.plugins +@@ -1,5 +1,6 @@ + apm + distcc ++dpkg + exim + fetchmail + ftpstats +--- ccze-0.2.1.orig/doc/ccze.1.in ++++ ccze-0.2.1/doc/ccze.1.in +@@ -94,7 +94,7 @@ + + If \fIcssfile\fR is set, then CCZE will not inline the Cascading Style + Sheet information into the outputted HTML, but include a link to the +-external stylesheet given in this paramater. ++external stylesheet given in this parameter. + .TP + .B \-p, \-\-plugin \fIPLUGIN\fR + While the default action is to load all plugins (see the \fBPlugins\fR +@@ -102,7 +102,7 @@ + plugins will be loaded. If one knows what kind of log will be piped + through \fBccze\fR, using this option may result in a slight speedup. + .TP +-.B \-r, \-\-remove\-facilty ++.B \-r, \-\-remove\-facility + Syslog\-ng puts the facility level before log messages. With this + switch, these can be cut off. + .TP +--- ccze-0.2.1.orig/src/ccze-color.c ++++ ccze-0.2.1/src/ccze-color.c +@@ -133,6 +133,7 @@ + {CCZE_KEYWORD ("system", CCZE_COLOR_SYSTEMWORD, "\"System words\"")}, + {CCZE_KEYWORD ("process", CCZE_COLOR_PROC, "Sender process")}, + {CCZE_KEYWORD ("dir", CCZE_COLOR_DIR, "Directory names")}, ++ {CCZE_KEYWORD ("file", CCZE_COLOR_FILE, "File names")}, + {CCZE_KEYWORD ("prot", CCZE_COLOR_PROT, "Protocols")}, + {CCZE_KEYWORD ("service", CCZE_COLOR_SERVICE, "Services")}, + {CCZE_KEYWORD ("email", CCZE_COLOR_EMAIL, "E-mail addresses")}, +@@ -169,6 +170,8 @@ + {CCZE_KEYWORD ("ftpcodes", CCZE_COLOR_FTPCODES, "FTP codes")}, + {CCZE_KEYWORD ("keyword", CCZE_COLOR_KEYWORD, + "Various keywords (like PHP in php.log, etc)")}, ++ {CCZE_KEYWORD ("pkgstatus", CCZE_COLOR_PKGSTATUS, "package status (dpkg)")}, ++ {CCZE_KEYWORD ("pkg", CCZE_COLOR_PKG, "package name (dpkg)")}, + + {CCZE_KEYWORD_H ("black", CCZE_COLOR_STATIC_BLACK, "Black")}, + {CCZE_KEYWORD_H ("red", CCZE_COLOR_STATIC_RED, "Red")}, +@@ -487,6 +490,7 @@ + ccze_color_table[CCZE_COLOR_EMAIL] = (RAW_ANSI_BOLD | RAW_ANSI_GREEN); + ccze_color_table[CCZE_COLOR_SUBJECT] = (RAW_ANSI_MAGENTA); + ccze_color_table[CCZE_COLOR_DIR] = (RAW_ANSI_BOLD | RAW_ANSI_CYAN); ++ ccze_color_table[CCZE_COLOR_FILE] = ccze_color_table[CCZE_COLOR_DIR]; + ccze_color_table[CCZE_COLOR_SIZE] = (RAW_ANSI_BOLD | RAW_ANSI_WHITE); + ccze_color_table[CCZE_COLOR_USER] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW); + ccze_color_table[CCZE_COLOR_HTTPCODES] = (RAW_ANSI_BOLD | RAW_ANSI_WHITE); +@@ -536,6 +540,8 @@ + ccze_color_table[CCZE_COLOR_PERCENTAGE] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW); + ccze_color_table[CCZE_COLOR_FTPCODES] = (RAW_ANSI_CYAN); + ccze_color_table[CCZE_COLOR_KEYWORD] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW); ++ ccze_color_table[CCZE_COLOR_PKGSTATUS] = (RAW_ANSI_GREEN); ++ ccze_color_table[CCZE_COLOR_PKG] = (RAW_ANSI_BOLD|RAW_ANSI_RED); + + ccze_color_table[CCZE_COLOR_STATIC_BLACK] = (RAW_ANSI_BLACK); + ccze_color_table[CCZE_COLOR_STATIC_RED] = (RAW_ANSI_RED); +@@ -575,6 +581,7 @@ + ccze_color_table[CCZE_COLOR_EMAIL] = (BOLD GREEN); + ccze_color_table[CCZE_COLOR_SUBJECT] = (MAGENTA); + ccze_color_table[CCZE_COLOR_DIR] = (BOLD CYAN); ++ ccze_color_table[CCZE_COLOR_FILE] = ccze_color_table[CCZE_COLOR_DIR]; + ccze_color_table[CCZE_COLOR_SIZE] = (BOLD WHITE); + ccze_color_table[CCZE_COLOR_USER] = (BOLD YELLOW); + ccze_color_table[CCZE_COLOR_HTTPCODES] = (BOLD WHITE); +@@ -624,6 +631,8 @@ + ccze_color_table[CCZE_COLOR_PERCENTAGE] = (BOLD YELLOW); + ccze_color_table[CCZE_COLOR_FTPCODES] = (CYAN); + ccze_color_table[CCZE_COLOR_KEYWORD] = (BOLD YELLOW); ++ ccze_color_table[CCZE_COLOR_PKGSTATUS] = (GREEN); ++ ccze_color_table[CCZE_COLOR_PKG] = (BOLD RED); + + ccze_color_table[CCZE_COLOR_STATIC_BLACK] = (BLACK); + ccze_color_table[CCZE_COLOR_STATIC_RED] = (RED); +--- ccze-0.2.1.orig/src/ccze-wordcolor.c ++++ ccze-0.2.1/src/ccze-wordcolor.c +@@ -37,13 +37,13 @@ + "warn", "restart", "exit", "stop", "end", "shutting", "down", "close", + "unreach", "can't", "cannot", "skip", "deny", "disable", "ignored", + "miss", "oops", "not", "backdoor", "blocking", "ignoring", +- "unable", "readonly", "offline", "terminate", "empty" ++ "unable", "readonly", "offline", "terminate", "empty", "virus" + }; + + static char *words_good[] = { + "activ", "start", "ready", "online", "load", "ok", "register", "detected", + "configured", "enable", "listen", "open", "complete", "attempt", "done", +- "check", "listen", "connect", "finish" ++ "check", "listen", "connect", "finish", "clean" + }; + + static char *words_error[] = { +@@ -291,7 +291,7 @@ + reg_time = pcre_compile ("\\d{1,2}:\\d{1,2}(:\\d{1,2})?", 0, &error, + &errptr, NULL); + reg_addr = pcre_compile ("^0x(\\d|[a-f])+$", 0, &error, &errptr, NULL); +- reg_num = pcre_compile ("^-?\\d+$", 0, &error, &errptr, NULL); ++ reg_num = pcre_compile ("^[+-]?\\d+$", 0, &error, &errptr, NULL); + reg_sig = pcre_compile ("^sig(hup|int|quit|ill|abrt|fpe|kill|segv|pipe|" + "alrm|term|usr1|usr2|chld|cont|stop|tstp|tin|tout|" + "bus|poll|prof|sys|trap|urg|vtalrm|xcpu|xfsz|iot|" +--- ccze-0.2.1.orig/src/mod_syslog.c ++++ ccze-0.2.1/src/mod_syslog.c +@@ -104,7 +104,7 @@ + int errptr; + + reg_syslog = pcre_compile ("^(\\S*\\s{1,2}\\d{1,2}\\s\\d\\d:\\d\\d:\\d\\d)" +- "\\s(\\S+)\\s((\\S+:?)\\s(.*))$", 0, &error, ++ "\\s(\\S+)\\s+((\\S+:?)\\s(.*))$", 0, &error, + &errptr, NULL); + hints_syslog = pcre_study (reg_syslog, 0, &error); + } +--- ccze-0.2.1.orig/src/ccze.h ++++ ccze-0.2.1/src/ccze.h +@@ -46,6 +46,7 @@ + CCZE_COLOR_EMAIL, + CCZE_COLOR_SUBJECT, + CCZE_COLOR_DIR, ++ CCZE_COLOR_FILE, + CCZE_COLOR_SIZE, + CCZE_COLOR_USER, + CCZE_COLOR_HTTPCODES, +@@ -95,6 +96,8 @@ + CCZE_COLOR_PERCENTAGE, + CCZE_COLOR_FTPCODES, + CCZE_COLOR_KEYWORD, ++ CCZE_COLOR_PKGSTATUS, ++ CCZE_COLOR_PKG, + + CCZE_COLOR_STATIC_BLACK, + CCZE_COLOR_STATIC_RED, +--- ccze-0.2.1.orig/src/mod_dpkg.c ++++ ccze-0.2.1/src/mod_dpkg.c +@@ -0,0 +1,180 @@ ++/* -*- mode: c; c-file-style: "gnu" -*- ++ * mod_dpkg.c -- Dpkg log-coloriser module for CCZE ++ * Copyright (C) 2007 arno. ++ * ++ * This file is part of ccze. ++ * ++ * ccze 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. ++ * ++ * ccze 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ++ */ ++ ++#include ++#include ++#include ++ ++static void ccze_dpkg_setup (void); ++static void ccze_dpkg_shutdown (void); ++static int ccze_dpkg_handle (const char *str, size_t length, char **rest); ++ ++ ++static pcre *reg_dpkg_status, *reg_dpkg_action, *reg_dpkg_conffile; ++ ++static char * ++ccze_dpkg_status_process(const char *str, int *offsets, int match) ++{ ++ char *date, *state, *pkg, *installed_version; ++ ++ pcre_get_substring (str, offsets, match, 1, (const char **)&date); ++ pcre_get_substring (str, offsets, match, 2, (const char **)&state); ++ pcre_get_substring (str, offsets, match, 3, (const char **)&pkg); ++ pcre_get_substring (str, offsets, match, 4, (const char **)&installed_version); ++ ++ ccze_print_date(date); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_KEYWORD, "status"); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_PKGSTATUS, state); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_PKG, pkg); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_DEFAULT, installed_version); ++ ccze_newline(); ++ ++ free(date); ++ free(state); ++ free(pkg); ++ free(installed_version); ++ ++ return NULL; ++} ++ ++static char * ++ccze_dpkg_action_process(const char *str, int *offsets, int match) ++{ ++ char *date, *action, *pkg, *installed_version, *available_version; ++ ++ pcre_get_substring (str, offsets, match, 1, (const char **)&date); ++ pcre_get_substring (str, offsets, match, 2, (const char **)&action); ++ pcre_get_substring (str, offsets, match, 3, (const char **)&pkg); ++ pcre_get_substring (str, offsets, match, 4, (const char **)&installed_version); ++ pcre_get_substring (str, offsets, match, 5, (const char **)&available_version); ++ ++ ccze_print_date(date); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_KEYWORD, action); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_PKG, pkg); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_DEFAULT, installed_version); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_DEFAULT, available_version); ++ ccze_newline(); ++ ++ free(date); ++ free(action); ++ free(pkg); ++ free(installed_version); ++ free(available_version); ++ ++ return NULL; ++} ++ ++static char * ++ccze_dpkg_conffile_process(const char *str, int *offsets, int match) ++{ ++ char *date, *filename, *decision; ++ /* YYYY-MM-DD HH:MM:SS conffile */ ++ ++ pcre_get_substring (str, offsets, match, 1, (const char **)&date); ++ pcre_get_substring (str, offsets, match, 2, (const char **)&filename); ++ pcre_get_substring (str, offsets, match, 3, (const char **)&decision); ++ ++ ccze_print_date(date); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_KEYWORD, "conffile"); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_FILE, filename); ++ ccze_space(); ++ ccze_addstr(CCZE_COLOR_KEYWORD, decision); ++ ccze_newline(); ++ ++ free(date); ++ free(filename); ++ free(decision); ++ ++ return NULL; ++} ++ ++ ++static void ++ccze_dpkg_setup (void) ++{ ++ const char *error; ++ int errptr; ++ ++ /* YYYY-MM-DD HH:MM:SS status */ ++ reg_dpkg_status = pcre_compile( ++ "^([-\\d]{10}\\s[:\\d]{8})\\sstatus\\s(\\S+)\\s(\\S+)\\s(\\S+)$", ++ 0, &error, &errptr, NULL); ++ ++ /* YYYY-MM-DD HH:MM:SS */ ++ reg_dpkg_action = pcre_compile( ++ "^([-\\d]{10}\\s[:\\d]{8})\\s(install|upgrade|remove|purge)\\s(\\S+)\\s(\\S+)\\s(\\S+)$", ++ 0, &error, &errptr, NULL); ++ ++ /* YYYY-MM-DD HH:MM:SS conffile */ ++ reg_dpkg_conffile = pcre_compile( ++ "^([-\\d]{10}\\s[:\\d]{8})\\sconffile\\s(\\S+)\\s(install|keep)$", ++ 0, &error, &errptr, NULL); ++ ++} ++ ++static void ++ccze_dpkg_shutdown (void) ++{ ++ free (reg_dpkg_status); ++ free (reg_dpkg_action); ++ free (reg_dpkg_conffile); ++} ++ ++static int ++ccze_dpkg_handle (const char *str, size_t length, char **rest) ++{ ++ int match, offsets[99]; ++ ++ if ((match = pcre_exec (reg_dpkg_status, NULL, str, length, ++ 0, 0, offsets, 99)) >= 0) ++ { ++ *rest = ccze_dpkg_status_process (str, offsets, match); ++ return 1; ++ } ++ ++ if ((match = pcre_exec (reg_dpkg_action, NULL, str, length, ++ 0, 0, offsets, 99)) >= 0) ++ { ++ *rest = ccze_dpkg_action_process (str, offsets, match); ++ return 1; ++ } ++ ++ if ((match = pcre_exec (reg_dpkg_conffile, NULL, str, length, ++ 0, 0, offsets, 99)) >= 0) ++ { ++ *rest = ccze_dpkg_conffile_process (str, offsets, match); ++ return 1; ++ } ++ ++ return 0; ++} ++ ++CCZE_DEFINE_PLUGIN (dpkg, FULL, "Coloriser for dpkg logs."); diff --git a/ccze.spec b/ccze.spec index 322c57a..7ebfee9 100644 --- a/ccze.spec +++ b/ccze.spec @@ -4,7 +4,7 @@ Summary: A robust log colorizer Summary(pl.UTF-8): Program w C do kolorowania logów Name: ccze Version: 0.2.1 -Release: 2 +Release: 3 Epoch: 1 License: GPL Group: Applications/Text @@ -16,6 +16,7 @@ Patch2: %{name}-fbsd.patch Patch3: %{name}-Wmulticharacter.patch Patch4: %{name}-error.patch Patch5: %{name}-tinfo.patch +Patch6: %{name}-debian.patch URL: http://bonehunter.rulez.org/CCZE.html BuildRequires: autoconf BuildRequires: automake @@ -58,6 +59,7 @@ Plik nagłówkowy dla wtyczek CCZE. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 %build %{__aclocal} -- 2.43.0