~ubuntu-branches/ubuntu/quantal/calamaris/quantal

« back to all changes in this revision

Viewing changes to debian/patches/debian-changes-2.99.4.0-12

  • Committer: Bazaar Package Importer
  • Author(s): Philipp Frauenfelder
  • Date: 2011-04-25 18:53:51 UTC
  • Revision ID: james.westby@ubuntu.com-20110425185351-ewws2imhlxj0wu7b
Tags: 2.99.4.0-12
* Add CACHELOGFILE to configuration and move cron script.
  Closes: #622831, #623841, #623673, #623674, #623407, #623021, #622959
* Bump standards version to 3.9.1, no changes.
* Changed source format from 1.0 to 3.0 (quilt).
* Replaced oops from suggests with squid3 (also in scripts).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Upstream changes introduced in version 2.99.4.0-12
 
2
 This patch has been created by dpkg-source during the package build.
 
3
 Here's the last changelog entry, hopefully it gives details on why
 
4
 those changes were made:
 
5
 .
 
6
 calamaris (2.99.4.0-12) unstable; urgency=low
 
7
 .
 
8
   * Add CACHELOGFILE to configuration and move cron script.
 
9
     Closes: #622831, #623841, #623673, #623674, #623407, #623021, #622959
 
10
   * Bump standards version to 3.9.1, no changes.
 
11
   * Changed source format from 1.0 to 3.0 (quilt).
 
12
   * Replaced oops from suggests with squid3 (also in scripts).
 
13
 .
 
14
 The person named in the Author field signed this changelog entry.
 
15
Author: Philipp Frauenfelder <pfrauenf@debian.org>
 
16
Bug-Debian: http://bugs.debian.org/622831
 
17
Bug-Debian: http://bugs.debian.org/622959
 
18
Bug-Debian: http://bugs.debian.org/623021
 
19
Bug-Debian: http://bugs.debian.org/623407
 
20
Bug-Debian: http://bugs.debian.org/623673
 
21
Bug-Debian: http://bugs.debian.org/623674
 
22
Bug-Debian: http://bugs.debian.org/623841
 
23
 
 
24
---
 
25
The information above should follow the Patch Tagging Guidelines, please
 
26
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
 
27
are templates for supplementary fields that you might want to add:
 
28
 
 
29
Origin: <vendor|upstream|other>, <url of original patch>
 
30
Bug: <url in upstream bugtracker>
 
31
Bug-Debian: http://bugs.debian.org/<bugnumber>
 
32
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
 
33
Forwarded: <no|not-needed|url proving that it has been forwarded>
 
34
Reviewed-By: <name and email of someone who approved the patch>
 
35
Last-Update: <YYYY-MM-DD>
 
36
 
 
37
--- calamaris-2.99.4.0.orig/calamaris
 
38
+++ calamaris-2.99.4.0/calamaris
 
39
@@ -122,7 +122,7 @@ require 5.002;
 
40
 
 
41
 use Getopt::Long;
 
42
 use Sys::Hostname;
 
43
-use lib '/usr/local';
 
44
+#use lib '/usr/local';
 
45
 
 
46
 Getopt::Long::Configure("bundling");
 
47
 GetOptions( "all-useful-reports|a" => \$opt_a,
 
48
@@ -4048,13 +4048,13 @@ sub outgraph {
 
49
 
 
50
   if ($max_x_data < 0) {
 
51
     # show last $max_x_data Values
 
52
-    $min_x = ($#{@$xaxis_ref} + $max_x_data < 0) ? 0
 
53
-      : $#{@$xaxis_ref} + $max_x_data + 1;
 
54
-    $max_x = $#{@$xaxis_ref};
 
55
+    $min_x = ($#{$xaxis_ref} + $max_x_data < 0) ? 0
 
56
+      : $#{$xaxis_ref} + $max_x_data + 1;
 
57
+    $max_x = $#{$xaxis_ref};
 
58
   } else {
 
59
     # show first $max_x_data Values
 
60
     $min_x = 0;
 
61
-    $max_x = ($#{@$xaxis_ref} > $max_x_data) ? $max_x_data : $#{@$xaxis_ref};
 
62
+    $max_x = ($#{$xaxis_ref} > $max_x_data) ? $max_x_data : $#{$xaxis_ref};
 
63
   }
 
64
 
 
65
   my $graph = calamaris::calBars3d->new($width, int($width/3*2));
 
66
@@ -4080,7 +4080,7 @@ Please use one of the supported image ty
 
67
   ($factor0, $unit0) = getfactor(max(@$yaxis1_ref[$min_x..$max_x]),9);
 
68
   $yaxis1_ref = reformatarray($factor0, $yaxis1_ref) if ($factor0 > 1);
 
69
   my %graph_label = (x_label           => '',
 
70
-                    y_label            => "$unit0 ${@$legend_ref}[0]",
 
71
+                    y_label            => "$unit0 ${$legend_ref}[0]",
 
72
                     title              => '',
 
73
                     two_axes           => '0',
 
74
                     x_labels_vertical  => '1',
 
75
@@ -4111,8 +4111,8 @@ Please use one of the supported image ty
 
76
     push @data, [@$yaxis2_ref[$min_x..$max_x]];
 
77
     push @data, [@$yaxis3_ref[$min_x..$max_x]] if ref($yaxis3_ref);
 
78
     push @data, [@$yaxis4_ref[$min_x..$max_x]] if ref($yaxis4_ref);
 
79
-    %graph_label = ( y1_label          => "$unit0 ${@$legend_ref}[0]",
 
80
-                   y2_label            => "$unit1 ${@$legend_ref}[1]",
 
81
+    %graph_label = ( y1_label          => "$unit0 ${$legend_ref}[0]",
 
82
+                   y2_label            => "$unit1 ${$legend_ref}[1]",
 
83
                    two_axes            => '1',
 
84
                    bar_spacing         => '0',
 
85
                    set_spacing         => '6', );
 
86
--- /dev/null
 
87
+++ calamaris-2.99.4.0/calamaris-cron-script
 
88
@@ -0,0 +1,259 @@
 
89
+#! /bin/sh
 
90
+
 
91
+set -e
 
92
+
 
93
+# calamaris: daily cron script.
 
94
+# This script should be run before the one for squid or oops. According to the
 
95
+# man page of run-parts this is okay: squid and oops come after calamaris in
 
96
+# the alphabet.
 
97
+
 
98
+# Date: 1998-10-07
 
99
+
 
100
+# DEBUG=1
 
101
+
 
102
+CONFFILE=/etc/calamaris/cron.conf
 
103
+CALAMARIS=/usr/bin/calamaris
 
104
+CALAMARIS_CONF_FILE=/etc/calamaris/calamaris.conf
 
105
+
 
106
+if [ ! -x /usr/bin/calamaris ]; then
 
107
+    exit 0
 
108
+fi
 
109
+
 
110
+CALAMARISOPTIONS="-a -f auto --config-file ${CALAMARIS_CONF_FILE}"
 
111
+HTMLOPTIONS="-F html"
 
112
+ME=/etc/cron.daily/calamaris
 
113
+WEEKFILES=forweekly.1:forweekly.2:forweekly.3:forweekly.4:forweekly.5:forweekly.6:forweekly.0
 
114
+
 
115
+# today
 
116
+DAYOFWEEK=`date +"%w"`
 
117
+DAYOFMONTH=`date +"%d" | bc -l`
 
118
+# WEEKOFYEAR=`date +"%W"`
 
119
+# MONTH=`date +"%B"`
 
120
+
 
121
+# read configuration file: /etc/calamaris/cron.conf
 
122
+# daily
 
123
+eval `awk -F: \
 
124
+'(!/�#/) && ($1 == "daily") {
 
125
+        print "DAYMAIL=" $2; print "DAYWEB=" $3;
 
126
+        print "DAYDO=" $4; print "DAYTITLE=" $5;
 
127
+}' $CONFFILE`
 
128
+DAYWEBPATH=`dirname $DAYWEB`
 
129
+DAYWEBFILE=`basename $DAYWEB`
 
130
+
 
131
+# weekly
 
132
+eval `awk -F: \
 
133
+'(!/�#/) && ($1 == "weekly") {
 
134
+        print "WEEKMAIL=" $2; print "WEEKWEB=" $3;
 
135
+        print "WEEKDO=" $4; print "WEEKTITLE=" $5;
 
136
+}' $CONFFILE`
 
137
+WEEKWEBPATH=`dirname $WEEKWEB`
 
138
+WEEKWEBFILE=`basename $WEEKWEB`
 
139
+
 
140
+# monthly
 
141
+eval `awk -F: \
 
142
+'(!/�#/) && ($1 == "monthly") {
 
143
+        print "MONTHMAIL=" $2; print "MONTHWEB=" $3;
 
144
+        print "MONTHDO=" $4; print "MONTHTITLE=" $5;
 
145
+}' $CONFFILE`
 
146
+MONTHWEBPATH=`dirname $MONTHWEB`
 
147
+MONTHWEBFILE=`basename $MONTHWEB`
 
148
+
 
149
+# squid or oops?
 
150
+CACHE=auto
 
151
+eval `awk -F= \
 
152
+'(!/�#/) && ($1 == "cache") {
 
153
+        print "CACHE=" $2;
 
154
+}' $CONFFILE`
 
155
+
 
156
+# cache file
 
157
+CACHEFILE=access.log
 
158
+eval `awk -F= \
 
159
+'(!/�#/) && ($1 == "cachefile") {
 
160
+        print "CACHEFILE=" $2;
 
161
+}' $CONFFILE`
 
162
+
 
163
+# look for cache log files
 
164
+if [ "$CACHE" = "auto" ]; then
 
165
+    if [ -r /var/log/squid/$CACHEFILE ]; then
 
166
+       CACHE=squid
 
167
+       CACHELOGDIR=/var/log/squid
 
168
+    fi
 
169
+    if [ -r /var/log/oops/$CACHEFILE ]; then
 
170
+       CACHE=oops
 
171
+       CACHELOGDIR=/var/log/oops
 
172
+    fi
 
173
+    if [ "$CACHE" = "auto" ]; then
 
174
+       echo "/etc/cron.daily/calamaris: no cache log files found, exiting cleanly"
 
175
+       exit 0
 
176
+    fi
 
177
+else
 
178
+    CACHELOGDIR=/var/log/$CACHE
 
179
+    if [ ! -r $CACHELOGDIR/$CACHEFILE ]; then
 
180
+       echo "/etc/cron.daily/calamaris: no cache log files found in $CACHELOGDIR, exiting cleanly"
 
181
+       exit 0
 
182
+    fi
 
183
+fi
 
184
+
 
185
+# change to working dir
 
186
+LOGDIR=/var/log/calamaris
 
187
+cd $LOGDIR || exit 1
 
188
+
 
189
+# if we need monthly or weekly reports save a summary
 
190
+if [ "$WEEKDO" != "nothing" ]; then
 
191
+    CALAMARISOPTIONSOLD="$CALAMARISOPTIONS"
 
192
+    CALAMARISOPTIONS="$CALAMARISOPTIONS -o forweekly.$DAYOFWEEK"
 
193
+    # Ensure that this file exists and is empty; if there are no entries in the
 
194
+    # squid access.log, calamaris won't create the summary file, which causes
 
195
+    # problems with the weekly and monthly summaries.
 
196
+    :> forweekly.$DAYOFWEEK
 
197
+else
 
198
+    if [ "$MONTHDO" != "nothing" ]; then
 
199
+       CALAMARISOPTIONSOLD="$CALAMARISOPTIONS"
 
200
+       CALAMARISOPTIONS="$CALAMARISOPTIONS -o formonthly.$DAYOFMONTH"
 
201
+    fi
 
202
+fi
 
203
+
 
204
+# do the daily report
 
205
+case "$DAYDO" in
 
206
+    nothing) if [ "$WEEKDO" != "nothing" ]; then
 
207
+       cat $CACHELOGDIR/$CACHEFILE | \
 
208
+           nice -39 $CALAMARIS $CALAMARISOPTIONS > /dev/null
 
209
+       fi
 
210
+    ;;
 
211
+    mail) if [ -x /usr/sbin/sendmail ]; then (
 
212
+           echo "To: $DAYMAIL"
 
213
+            echo "From: Calamaris <root>"
 
214
+           cat $CACHELOGDIR/$CACHEFILE | \
 
215
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -F mail -H "$DAYTITLE"
 
216
+       ) | /usr/sbin/sendmail -t
 
217
+       fi
 
218
+    ;;
 
219
+    web) cat $CACHELOGDIR/$CACHEFILE | \
 
220
+           nice -39 $CALAMARIS $CALAMARISOPTIONS $HTMLOPTIONS -H "$DAYTITLE" \
 
221
+               --output-path $DAYWEBPATH --output-file $DAYWEBFILE
 
222
+    ;;
 
223
+    both) cat $CACHELOGDIR/$CACHEFILE | \
 
224
+           nice -39 $CALAMARIS $CALAMARISOPTIONS $HTMLOPTIONS -H "$DAYTITLE" \
 
225
+               --output-path $DAYWEBPATH --output-file $DAYWEBFILE
 
226
+       if [ -x /usr/sbin/sendmail ]; then (
 
227
+           echo "To: $DAYMAIL"
 
228
+            echo "From: Calamaris <root>"
 
229
+           cat $CACHELOGDIR/$CACHEFILE | \
 
230
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -F mail -H "$DAYTITLE"
 
231
+       ) | /usr/sbin/sendmail -t
 
232
+       fi
 
233
+    ;;
 
234
+    *) echo "the 'todo' for the daily Squid report in $CONFFILE"
 
235
+       echo -n "is '$DAYDO' instead of one out of "
 
236
+       echo "(nothing, mail, web, both)." >&2
 
237
+       exit 1
 
238
+    ;;
 
239
+esac
 
240
+
 
241
+if [ "$MONTHDO" != "nothing" -a "$WEEKDO" != "nothing" ]; then
 
242
+    cp forweekly.$DAYOFWEEK formonthly.$DAYOFMONTH
 
243
+fi
 
244
+
 
245
+# do the weekly report on Sunday <=> $DAYOFWEEK==0
 
246
+if [ -n "$CALAMARISOPTIONSOLD" ]; then
 
247
+    CALAMARISOPTIONS="$CALAMARISOPTIONSOLD"
 
248
+fi
 
249
+
 
250
+if [ "$DAYOFWEEK" = "0" ]; then
 
251
+    # make sure, all forweekly files exist, ie. touch them
 
252
+    touch `echo $WEEKFILES | sed "s/:/ /g"`
 
253
+    case "$WEEKDO" in
 
254
+       nothing) 
 
255
+       ;;
 
256
+       mail) if [ -x /usr/sbin/sendmail ]; then (
 
257
+               echo "To: $WEEKMAIL"
 
258
+                echo "From: Calamaris <root>"
 
259
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES \
 
260
+                   -z -F mail -H "$WEEKTITLE"
 
261
+           ) | /usr/sbin/sendmail -t
 
262
+            fi
 
263
+       ;;
 
264
+       web) nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES \
 
265
+               -z $HTMLOPTIONS -H "$WEEKTITLE" \
 
266
+               --output-path $WEEKWEBPATH --output-file $WEEKWEBFILE
 
267
+       ;;
 
268
+       both) if [ "$DEBUG" = "1" ]; then
 
269
+               echo "Weekly stats."
 
270
+               echo "Doing web stats: nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES -zwH \"$WEEKTITLE\" into $WEEKWEB"
 
271
+           fi
 
272
+           nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES \
 
273
+               -z $HTMLOPTIONS -H "$WEEKTITLE" \
 
274
+               --output-path $WEEKWEBPATH --output-file $WEEKWEBFILE
 
275
+           if [ "$DEBUG" = "1" ]; then
 
276
+               echo "Doing mail stats: nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES -zmH \"$WEEKTITLE\""
 
277
+           fi
 
278
+           if [ -x /usr/sbin/sendmail ]; then (
 
279
+               echo "To: $WEEKMAIL"
 
280
+                echo "From: Calamaris <root>"
 
281
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -i $WEEKFILES \
 
282
+                   -z -F mail -H "$WEEKTITLE"
 
283
+           ) | /usr/sbin/sendmail -t
 
284
+           fi
 
285
+           if [ "$DEBUG" = "1" ]; then echo "Finished weekly stats."; fi
 
286
+       ;;
 
287
+       *) echo "the 'todo' for the weekly Squid report in $CONFFILE"
 
288
+           echo -n "is '$WEEKDO' instead of one out of "
 
289
+           echo "(nothing, mail, web, both)." >&2
 
290
+           exit 1
 
291
+       ;;
 
292
+    esac
 
293
+    # remove all forweekly files (could disturb next week's statistics if
 
294
+    # computer is switched of one day)
 
295
+    rm -f `echo $WEEKFILES | sed "s/:/ /g"`
 
296
+fi
 
297
+
 
298
+# do the monthly report
 
299
+if [ "$DAYOFMONTH" = "1" ]; then
 
300
+    i=2
 
301
+    MONTHFILES=formonthly.1
 
302
+    yesterday=`date +"%d" -d "yesterday"`
 
303
+    end=`echo 1+$yesterday | bc -l`
 
304
+    while [ "$i" != $end ]; do
 
305
+       MONTHFILES=$MONTHFILES:formonthly.$i
 
306
+       i=`echo 1+$i | bc -l`
 
307
+    done
 
308
+    # make sure, all formonthly files exist, ie. touch them
 
309
+    touch `echo $MONTHFILES | sed "s/:/ /g"`
 
310
+    case "$MONTHDO" in
 
311
+       nothing)
 
312
+       ;;
 
313
+       mail) if [ -x /usr/sbin/sendmail ]; then (
 
314
+               echo "To: $MONTHMAIL"
 
315
+                echo "From: Calamaris <root>"
 
316
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -i $MONTHFILES \
 
317
+                   -z -F mail -H "$MONTHTITLE"
 
318
+             ) | /usr/sbin/sendmail -t
 
319
+              fi
 
320
+        ;;
 
321
+       web) nice -39 $CALAMARIS $CALAMARISOPTIONS -i $MONTHFILES \
 
322
+               -z $HTMLOPTIONS -H "$MONTHTITLE" \
 
323
+               --output-path $MONTHWEBPATH --output-file $MONTHWEBFILE
 
324
+        ;;
 
325
+       both) nice -39 $CALAMARIS $CALAMARISOPTIONS -i $MONTHFILES \
 
326
+               -z $HTMLOPTIONS -H "$MONTHTITLE" \
 
327
+               --output-path $MONTHWEBPATH --output-file $MONTHWEBFILE
 
328
+             if [ -x /usr/sbin/sendmail ]; then (
 
329
+               echo "To: $MONTHMAIL"
 
330
+                echo "From: Calamaris <root>"
 
331
+               nice -39 $CALAMARIS $CALAMARISOPTIONS -i $MONTHFILES \
 
332
+                   -z -F mail -H "$MONTHTITLE"
 
333
+             ) | /usr/sbin/sendmail -t
 
334
+             fi
 
335
+       ;;
 
336
+       *) echo "the 'todo' for the weekly Squid report in $CONFFILE"
 
337
+           echo -n "is '$MONTHDO' instead of one out of "
 
338
+           echo "(nothing, mail, web, both)." >&2
 
339
+           exit 1
 
340
+       ;;
 
341
+    esac
 
342
+    # remove all formonthly files (could disturb next month's statistics if
 
343
+    # computer is switched of one day)
 
344
+    rm -f formonthly.*
 
345
+fi
 
346
+
 
347
+exit 0
 
348
--- calamaris-2.99.4.0.orig/calamaris.1
 
349
+++ calamaris-2.99.4.0/calamaris.1
 
350
@@ -339,7 +339,7 @@ Server-Side-Includes.
 
351
 enables graphics for html, html-embed or html-frame.
 
352
 
 
353
 .I 'unformatted'
 
354
-gives out the raw numbers seperated by spaces. Useful for re-using the output
 
355
+gives out the raw numbers separated by spaces. Useful for re-using the output
 
356
 in other scripts. If you use this along with
 
357
 .I -U,
 
358
 the byte values are calculated in the given Unit, and displayed without
 
359
@@ -484,7 +484,7 @@ generates an index for all reports that
 
360
 .I --cache-input-file|-i file ($cache_input_file)
 
361
 You can reuse a cache file generated with
 
362
 .I --cache-output-file file
 
363
-to add old data to a new report.  Several files can be seperated with a ':'.
 
364
+to add old data to a new report.  Several files can be separated with a ':'.
 
365
 
 
366
 .B Note:
 
367
 if you use more than one cache file, make sure they are chronologicaly
 
368
--- /dev/null
 
369
+++ calamaris-2.99.4.0/calamaris-cron
 
370
@@ -0,0 +1,6 @@
 
371
+#! /bin/sh
 
372
+
 
373
+set -e
 
374
+
 
375
+/usr/lib/calamaris/calamaris-cron-script
 
376
+
 
377
--- /dev/null
 
378
+++ calamaris-2.99.4.0/Makefile
 
379
@@ -0,0 +1,6 @@
 
380
+install:
 
381
+       install -g root -o root -m 755 calamaris $(DESTDIR)/usr/bin/calamaris
 
382
+       install -g root -o root -m 755 calamaris-cron-script $(DESTDIR)/usr/lib/calamaris/calamaris-cron-script
 
383
+       install -g root -o root -m 755 calamaris-cron $(DESTDIR)/etc/cron.daily/calamaris
 
384
+       install -g root -o root -m 644 *.pm $(DESTDIR)/usr/share/perl5/calamaris
 
385
+       install -g root -o root -m 644 calamaris.conf $(DESTDIR)/etc/calamaris