]> git.pld-linux.org Git - packages/ccze.git/blob - ccze-debian.patch
- rel.3 - add debian patch with dpkg plugin and some other fixes
[packages/ccze.git] / ccze-debian.patch
1 --- ccze-0.2.1.orig/ccze.plugins
2 +++ ccze-0.2.1/ccze.plugins
3 @@ -1,5 +1,6 @@
4  apm
5  distcc
6 +dpkg
7  exim
8  fetchmail
9  ftpstats
10 --- ccze-0.2.1.orig/doc/ccze.1.in
11 +++ ccze-0.2.1/doc/ccze.1.in
12 @@ -94,7 +94,7 @@
13  
14  If \fIcssfile\fR is set, then CCZE will not inline the Cascading Style
15  Sheet information into the outputted HTML, but include a link to the
16 -external stylesheet given in this paramater.
17 +external stylesheet given in this parameter.
18  .TP
19  .B \-p, \-\-plugin \fIPLUGIN\fR
20  While the default action is to load all plugins (see the \fBPlugins\fR
21 @@ -102,7 +102,7 @@
22  plugins will be loaded. If one knows what kind of log will be piped
23  through \fBccze\fR, using this option may result in a slight speedup.
24  .TP
25 -.B \-r, \-\-remove\-facilty
26 +.B \-r, \-\-remove\-facility
27  Syslog\-ng puts the facility level before log messages. With this
28  switch, these can be cut off.
29  .TP
30 --- ccze-0.2.1.orig/src/ccze-color.c
31 +++ ccze-0.2.1/src/ccze-color.c
32 @@ -133,6 +133,7 @@
33    {CCZE_KEYWORD ("system", CCZE_COLOR_SYSTEMWORD, "\"System words\"")},
34    {CCZE_KEYWORD ("process", CCZE_COLOR_PROC, "Sender process")},
35    {CCZE_KEYWORD ("dir", CCZE_COLOR_DIR, "Directory names")},
36 +  {CCZE_KEYWORD ("file", CCZE_COLOR_FILE, "File names")},
37    {CCZE_KEYWORD ("prot", CCZE_COLOR_PROT, "Protocols")},
38    {CCZE_KEYWORD ("service", CCZE_COLOR_SERVICE, "Services")},
39    {CCZE_KEYWORD ("email", CCZE_COLOR_EMAIL, "E-mail addresses")},
40 @@ -169,6 +170,8 @@
41    {CCZE_KEYWORD ("ftpcodes", CCZE_COLOR_FTPCODES, "FTP codes")},
42    {CCZE_KEYWORD ("keyword", CCZE_COLOR_KEYWORD,
43                  "Various keywords (like PHP in php.log, etc)")},
44 +  {CCZE_KEYWORD ("pkgstatus", CCZE_COLOR_PKGSTATUS, "package status (dpkg)")},
45 +  {CCZE_KEYWORD ("pkg", CCZE_COLOR_PKG, "package name (dpkg)")},
46    
47    {CCZE_KEYWORD_H ("black", CCZE_COLOR_STATIC_BLACK, "Black")},
48    {CCZE_KEYWORD_H ("red", CCZE_COLOR_STATIC_RED, "Red")},
49 @@ -487,6 +490,7 @@
50    ccze_color_table[CCZE_COLOR_EMAIL] = (RAW_ANSI_BOLD | RAW_ANSI_GREEN);
51    ccze_color_table[CCZE_COLOR_SUBJECT] = (RAW_ANSI_MAGENTA);
52    ccze_color_table[CCZE_COLOR_DIR] = (RAW_ANSI_BOLD | RAW_ANSI_CYAN);
53 +  ccze_color_table[CCZE_COLOR_FILE] = ccze_color_table[CCZE_COLOR_DIR];
54    ccze_color_table[CCZE_COLOR_SIZE] = (RAW_ANSI_BOLD | RAW_ANSI_WHITE);
55    ccze_color_table[CCZE_COLOR_USER] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW);
56    ccze_color_table[CCZE_COLOR_HTTPCODES] = (RAW_ANSI_BOLD | RAW_ANSI_WHITE);
57 @@ -536,6 +540,8 @@
58    ccze_color_table[CCZE_COLOR_PERCENTAGE] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW);
59    ccze_color_table[CCZE_COLOR_FTPCODES] = (RAW_ANSI_CYAN);
60    ccze_color_table[CCZE_COLOR_KEYWORD] = (RAW_ANSI_BOLD | RAW_ANSI_YELLOW);
61 +  ccze_color_table[CCZE_COLOR_PKGSTATUS] = (RAW_ANSI_GREEN);
62 +  ccze_color_table[CCZE_COLOR_PKG] = (RAW_ANSI_BOLD|RAW_ANSI_RED);
63  
64    ccze_color_table[CCZE_COLOR_STATIC_BLACK] = (RAW_ANSI_BLACK);
65    ccze_color_table[CCZE_COLOR_STATIC_RED] = (RAW_ANSI_RED);
66 @@ -575,6 +581,7 @@
67    ccze_color_table[CCZE_COLOR_EMAIL] = (BOLD GREEN);
68    ccze_color_table[CCZE_COLOR_SUBJECT] = (MAGENTA);
69    ccze_color_table[CCZE_COLOR_DIR] = (BOLD CYAN);
70 +  ccze_color_table[CCZE_COLOR_FILE] = ccze_color_table[CCZE_COLOR_DIR];
71    ccze_color_table[CCZE_COLOR_SIZE] = (BOLD WHITE);
72    ccze_color_table[CCZE_COLOR_USER] = (BOLD YELLOW);
73    ccze_color_table[CCZE_COLOR_HTTPCODES] = (BOLD WHITE);
74 @@ -624,6 +631,8 @@
75    ccze_color_table[CCZE_COLOR_PERCENTAGE] = (BOLD YELLOW);
76    ccze_color_table[CCZE_COLOR_FTPCODES] = (CYAN);
77    ccze_color_table[CCZE_COLOR_KEYWORD] = (BOLD YELLOW);
78 +  ccze_color_table[CCZE_COLOR_PKGSTATUS] = (GREEN);
79 +  ccze_color_table[CCZE_COLOR_PKG] = (BOLD RED);
80  
81    ccze_color_table[CCZE_COLOR_STATIC_BLACK] = (BLACK);
82    ccze_color_table[CCZE_COLOR_STATIC_RED] = (RED);
83 --- ccze-0.2.1.orig/src/ccze-wordcolor.c
84 +++ ccze-0.2.1/src/ccze-wordcolor.c
85 @@ -37,13 +37,13 @@
86    "warn", "restart", "exit", "stop", "end", "shutting", "down", "close",
87    "unreach", "can't", "cannot", "skip", "deny", "disable", "ignored",
88    "miss", "oops", "not", "backdoor", "blocking", "ignoring",
89 -  "unable", "readonly", "offline", "terminate", "empty"
90 +  "unable", "readonly", "offline", "terminate", "empty", "virus"
91  };
92  
93  static char *words_good[] = {
94    "activ", "start", "ready", "online", "load", "ok", "register", "detected",
95    "configured", "enable", "listen", "open", "complete", "attempt", "done",
96 -  "check", "listen", "connect", "finish"
97 +  "check", "listen", "connect", "finish", "clean"
98  };
99  
100  static char *words_error[] = {
101 @@ -291,7 +291,7 @@
102    reg_time = pcre_compile ("\\d{1,2}:\\d{1,2}(:\\d{1,2})?", 0, &error,
103                            &errptr, NULL);
104    reg_addr = pcre_compile ("^0x(\\d|[a-f])+$", 0, &error, &errptr, NULL);
105 -  reg_num = pcre_compile ("^-?\\d+$", 0, &error, &errptr, NULL);
106 +  reg_num = pcre_compile ("^[+-]?\\d+$", 0, &error, &errptr, NULL);
107    reg_sig = pcre_compile ("^sig(hup|int|quit|ill|abrt|fpe|kill|segv|pipe|"
108                           "alrm|term|usr1|usr2|chld|cont|stop|tstp|tin|tout|"
109                           "bus|poll|prof|sys|trap|urg|vtalrm|xcpu|xfsz|iot|"
110 --- ccze-0.2.1.orig/src/mod_syslog.c
111 +++ ccze-0.2.1/src/mod_syslog.c
112 @@ -104,7 +104,7 @@
113    int errptr;
114  
115    reg_syslog = pcre_compile ("^(\\S*\\s{1,2}\\d{1,2}\\s\\d\\d:\\d\\d:\\d\\d)"
116 -                            "\\s(\\S+)\\s((\\S+:?)\\s(.*))$", 0, &error,
117 +                            "\\s(\\S+)\\s+((\\S+:?)\\s(.*))$", 0, &error,
118                              &errptr, NULL);
119    hints_syslog = pcre_study (reg_syslog, 0, &error);
120  }
121 --- ccze-0.2.1.orig/src/ccze.h
122 +++ ccze-0.2.1/src/ccze.h
123 @@ -46,6 +46,7 @@
124    CCZE_COLOR_EMAIL,
125    CCZE_COLOR_SUBJECT,
126    CCZE_COLOR_DIR,
127 +  CCZE_COLOR_FILE,
128    CCZE_COLOR_SIZE,
129    CCZE_COLOR_USER,
130    CCZE_COLOR_HTTPCODES,
131 @@ -95,6 +96,8 @@
132    CCZE_COLOR_PERCENTAGE,
133    CCZE_COLOR_FTPCODES,
134    CCZE_COLOR_KEYWORD,
135 +  CCZE_COLOR_PKGSTATUS,
136 +  CCZE_COLOR_PKG,
137  
138    CCZE_COLOR_STATIC_BLACK,
139    CCZE_COLOR_STATIC_RED,
140 --- ccze-0.2.1.orig/src/mod_dpkg.c
141 +++ ccze-0.2.1/src/mod_dpkg.c
142 @@ -0,0 +1,180 @@
143 +/* -*- mode: c; c-file-style: "gnu" -*-
144 + * mod_dpkg.c -- Dpkg log-coloriser module for CCZE
145 + * Copyright (C) 2007 arno. <arno.@no-log.org>
146 + *
147 + * This file is part of ccze.
148 + *
149 + * ccze is free software; you can redistribute it and/or modify it
150 + * under the terms of the GNU General Public License as published by
151 + * the Free Software Foundation; either version 2 of the License, or
152 + * (at your option) any later version.
153 + *
154 + * ccze is distributed in the hope that it will be useful, but WITHOUT
155 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
156 + * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
157 + * License for more details.
158 + *
159 + * You should have received a copy of the GNU General Public License
160 + * along with this program; if not, write to the Free Software
161 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
162 + */
163 +
164 +#include <ccze.h>
165 +#include <stdlib.h>
166 +#include <string.h>
167 +
168 +static void ccze_dpkg_setup (void);
169 +static void ccze_dpkg_shutdown (void);
170 +static int ccze_dpkg_handle (const char *str, size_t length, char **rest);
171 +
172 +
173 +static pcre *reg_dpkg_status, *reg_dpkg_action, *reg_dpkg_conffile;
174 +
175 +static char *
176 +ccze_dpkg_status_process(const char *str, int *offsets, int match)
177 +{
178 +  char *date, *state, *pkg, *installed_version;
179 +
180 +  pcre_get_substring (str, offsets, match, 1, (const char **)&date);
181 +  pcre_get_substring (str, offsets, match, 2, (const char **)&state);
182 +  pcre_get_substring (str, offsets, match, 3, (const char **)&pkg);
183 +  pcre_get_substring (str, offsets, match, 4, (const char **)&installed_version);
184 +
185 +  ccze_print_date(date);
186 +  ccze_space();
187 +  ccze_addstr(CCZE_COLOR_KEYWORD, "status");
188 +  ccze_space();
189 +  ccze_addstr(CCZE_COLOR_PKGSTATUS, state);
190 +  ccze_space();
191 +  ccze_addstr(CCZE_COLOR_PKG, pkg);
192 +  ccze_space();
193 +  ccze_addstr(CCZE_COLOR_DEFAULT, installed_version);
194 +  ccze_newline();
195 +
196 +  free(date);
197 +  free(state);
198 +  free(pkg);
199 +  free(installed_version);
200 +
201 +  return NULL;
202 +}
203 +
204 +static char *
205 +ccze_dpkg_action_process(const char *str, int *offsets, int match)
206 +{
207 +  char *date, *action, *pkg, *installed_version, *available_version;
208 +
209 +  pcre_get_substring (str, offsets, match, 1, (const char **)&date);
210 +  pcre_get_substring (str, offsets, match, 2, (const char **)&action);
211 +  pcre_get_substring (str, offsets, match, 3, (const char **)&pkg);
212 +  pcre_get_substring (str, offsets, match, 4, (const char **)&installed_version);
213 +  pcre_get_substring (str, offsets, match, 5, (const char **)&available_version);
214 +
215 +  ccze_print_date(date);
216 +  ccze_space();
217 +  ccze_addstr(CCZE_COLOR_KEYWORD, action);
218 +  ccze_space();
219 +  ccze_addstr(CCZE_COLOR_PKG, pkg);
220 +  ccze_space();
221 +  ccze_addstr(CCZE_COLOR_DEFAULT, installed_version);
222 +  ccze_space();
223 +  ccze_addstr(CCZE_COLOR_DEFAULT, available_version);
224 +  ccze_newline();
225 +
226 +  free(date);
227 +  free(action);
228 +  free(pkg);
229 +  free(installed_version);
230 +  free(available_version);
231 +
232 +  return NULL;
233 +}
234 +
235 +static char *
236 +ccze_dpkg_conffile_process(const char *str, int *offsets, int match)
237 +{
238 +  char *date, *filename, *decision;
239 +  /* YYYY-MM-DD HH:MM:SS conffile <filename> <decision> */
240 +
241 +  pcre_get_substring (str, offsets, match, 1, (const char **)&date);
242 +  pcre_get_substring (str, offsets, match, 2, (const char **)&filename);
243 +  pcre_get_substring (str, offsets, match, 3, (const char **)&decision);
244 +
245 +  ccze_print_date(date);
246 +  ccze_space();
247 +  ccze_addstr(CCZE_COLOR_KEYWORD, "conffile");
248 +  ccze_space();
249 +  ccze_addstr(CCZE_COLOR_FILE, filename);
250 +  ccze_space();
251 +  ccze_addstr(CCZE_COLOR_KEYWORD, decision);
252 +  ccze_newline();
253 +
254 +  free(date);
255 +  free(filename);
256 +  free(decision);
257 +
258 +  return NULL;
259 +}
260 +
261 +
262 +static void
263 +ccze_dpkg_setup (void)
264 +{
265 +  const char *error;
266 +  int errptr;
267 +
268 +  /* YYYY-MM-DD HH:MM:SS status <state> <pkg> <installed-version> */
269 +  reg_dpkg_status = pcre_compile(
270 +      "^([-\\d]{10}\\s[:\\d]{8})\\sstatus\\s(\\S+)\\s(\\S+)\\s(\\S+)$",
271 +      0, &error, &errptr, NULL);
272 +
273 +  /* YYYY-MM-DD HH:MM:SS <action> <pkg> <installed-version> <available-version> */
274 +  reg_dpkg_action = pcre_compile(
275 +      "^([-\\d]{10}\\s[:\\d]{8})\\s(install|upgrade|remove|purge)\\s(\\S+)\\s(\\S+)\\s(\\S+)$",
276 +      0, &error, &errptr, NULL);
277 +
278 +  /* YYYY-MM-DD HH:MM:SS conffile <filename> <decision> */
279 +  reg_dpkg_conffile = pcre_compile(
280 +      "^([-\\d]{10}\\s[:\\d]{8})\\sconffile\\s(\\S+)\\s(install|keep)$",
281 +      0, &error, &errptr, NULL);
282 +
283 +}
284 +
285 +static void
286 +ccze_dpkg_shutdown (void)
287 +{
288 +  free (reg_dpkg_status);
289 +  free (reg_dpkg_action);
290 +  free (reg_dpkg_conffile);
291 +}
292 +
293 +static int
294 +ccze_dpkg_handle (const char *str, size_t length, char **rest)
295 +{
296 +  int match, offsets[99];
297 +  
298 +  if ((match = pcre_exec (reg_dpkg_status, NULL, str, length,
299 +                  0, 0, offsets, 99)) >= 0)
300 +  {
301 +      *rest = ccze_dpkg_status_process (str, offsets, match);
302 +      return 1;
303 +  }
304 +
305 +  if ((match = pcre_exec (reg_dpkg_action, NULL, str, length,
306 +                  0, 0, offsets, 99)) >= 0)
307 +  {
308 +      *rest = ccze_dpkg_action_process (str, offsets, match);
309 +      return 1;
310 +  }
311 +
312 +  if ((match = pcre_exec (reg_dpkg_conffile, NULL, str, length,
313 +                  0, 0, offsets, 99)) >= 0)
314 +  {
315 +      *rest = ccze_dpkg_conffile_process (str, offsets, match);
316 +      return 1;
317 +  }
318 +
319 +  return 0;
320 +}
321 +
322 +CCZE_DEFINE_PLUGIN (dpkg, FULL, "Coloriser for dpkg logs.");
This page took 0.109753 seconds and 3 git commands to generate.