tags #331195 patch thanks On Sun, Oct 02, 2005 at 04:14:42PM +0200, Ola Lundqvist wrote: > On Sun, Oct 02, 2005 at 10:56:09AM +0200, Marc Haber wrote: > > Would you be willing to accept a patch which would cause cron-apt to > > ignore all lines matching ^\(Get:\|Ign[[:space:]]\|Hit[[:space:]]\) in > > $APTCOMMAND's output? > > Maybe. This need to be configurable. Maybe add an option for lines > to ignore...
This was pretty easy to implement, since diff has an option to ignore diffs matching regexps. Patch attached (which also covers #331197). Please consider applying. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835
diff -urN cron-apt-0.3.1/conf/config cron-apt-0.3.1.1/conf/config --- cron-apt-0.3.1/conf/config 2005-10-01 21:21:27.000000000 +0000 +++ cron-apt-0.3.1.1/conf/config 2005-10-05 09:47:01.000000000 +0000 @@ -133,3 +133,14 @@ # If this file exist cron-apt will silently exit. # REFRAINFILE=/etc/cron-apt/refrain + +# If this is non-empty, it will be used as the host name in subjects of +# generated e-mail messages. If this is empty, the output of uname -n +# will be used. +# HOSTNAME="" + +# Ignore lines matching this regexp to determine whether changes occurred +# for MAILON="changes". +# Suggested value for aptitude: DIFFIGNORERE="^\(Get:[[:digit:]]\+\|Hit\|Ign\|Del\|Fetched\|Freed\)[[:space:]]" +# Suggested value for apt-get: ##+#FIXME +# DIFFIGNORERE="" diff -urN cron-apt-0.3.1/src/cron-apt cron-apt-0.3.1.1/src/cron-apt --- cron-apt-0.3.1/src/cron-apt 2005-10-01 21:17:44.000000000 +0000 +++ cron-apt-0.3.1.1/src/cron-apt 2005-10-05 09:45:53.000000000 +0000 @@ -179,6 +179,13 @@ # output will be filtered from log/mail/console output. This is useful # with aptitude, which does not currently support -qq (very quiet). FILTERCTRLM="false" +# If HOSTNAME is non-empty, the contents will be used to generate the +# e-mail subject for notifications sent out. If HOSTNAME is empty, the +# output of $(uname -n) will be used. +HOSTNAME="" +# Ignore lines matching this regexp to determine whether changes occurred +# for MAILON="changes". +DIFFIGNORERE="" export DEBIAN_FRONTEND="noninteractive" export LANG="C" @@ -193,6 +200,10 @@ fi done +if [ -n "$DIFFIGNORERE" ]; then + DIFFIGNORERE="--ignore-matching-lines=$DIFFIGNORERE" +fi + if [ -t 0 ]; then RUNIMMEDIATELY="yes" fi @@ -236,9 +247,12 @@ rm -f "$RUNMAIL" fi if [ -f "$MAIL" ] ; then - SUBJECT="CRON-APT completed on $(uname -n) [$CONFIG]" + if [ -z "$HOSTNAME" ]; then + HOSTNAME="$(uname -n)" + fi + SUBJECT="CRON-APT completed on $HOSTNAME [$CONFIG]" if [ -f "$ERROR" ] ; then - SUBJECT="CRON-APT error on $(uname -n) [$CONFIG]" + SUBJECT="CRON-APT error on $HOSTNAME [$CONFIG]" fi mail -s "$SUBJECT" "$MAILTO" < "$MAIL" rm -f "$MAIL" @@ -514,7 +528,7 @@ fi TLINE=$(echo "$LINE" | sed -e "s/[[:space:]]/_/g;" | \ tr "/" "-") - if [ ! -r "$MAILCHDIR/$ACTIONF-$TLINE" ] || ! diff -u "$MAILCHDIR/$ACTIONF-$TLINE" "$TEMP" > "$DIFF" ; then + if [ ! -r "$MAILCHDIR/$ACTIONF-$TLINE" ] || ! diff $DIFFIGNORERE -u "$MAILCHDIR/$ACTIONF-$TLINE" "$TEMP" > "$DIFF" ; then cp "$TEMP" "$MAILCHDIR/$ACTIONF-$TLINE" # What to do with diff # OBS! FROM NOW ON "$TEMP" CAN HAVE DIFF INFORMATION IN IT!