From: Thomas Viehmann Date: Sat, 20 Sep 2008 15:54:59 +0000 (+0200) Subject: don't try to remove file --searchdirs, prune some paths from messages X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f7759375214cb6a4eb366f6e03c70a900641baa1;p=dak don't try to remove file --searchdirs, prune some paths from messages Signed-off-by: Thomas Viehmann --- diff --git a/tools/debianqueued-0.9/ChangeLog b/tools/debianqueued-0.9/ChangeLog index d8875337..01bf71fc 100644 --- a/tools/debianqueued-0.9/ChangeLog +++ b/tools/debianqueued-0.9/ChangeLog @@ -1,3 +1,7 @@ +2008-09-20 Thomas Viehmann + + * debianqueued: Minor fixes on .commands processing. + 2008-09-15 Joerg Jaspert * config: Use 15 delayed dirs. Also change maintainer_mail to diff --git a/tools/debianqueued-0.9/debianqueued b/tools/debianqueued-0.9/debianqueued index eebba4df..eebb9151 100755 --- a/tools/debianqueued-0.9/debianqueued +++ b/tools/debianqueued-0.9/debianqueued @@ -4,6 +4,7 @@ # # Copyright (C) 1997 Roman Hodek # Copyright (C) 2001-2007 Ryan Murray +# Copyright (C) 2008 Thomas Viehmann # # This program is free software. You can redistribute it and/or # modify it under the terms of the GNU General Public License as @@ -1071,14 +1072,14 @@ sub process_commands($) { if ($word[0] eq "rm") { foreach ( @word[1..$#word] ) { my $origword = $_; - if ($_ eq "--searchdirs") { - $selecteddelayed = -2; - } - elsif (m,^DELAYED/([0-9]+)-day/,) { + if (m,^DELAYED/([0-9]+)-day/,) { $selecteddelayed = $1; s,^DELAYED/[0-9]+-day/,,; } - if (m,/,) { + if ($origword eq "--searchdirs") { + $selecteddelayed = -2; + } + elsif (m,/,) { msg( "mail,log", "$_: filename may not contain slashes except for DELAYED/#-day/ prefixes\n" ); } else { @@ -1131,6 +1132,7 @@ sub process_commands($) { msg( "mail,log", "$file: rm: $!\n" ); } else { + $file =~ s,$conf::incoming/?,,; push( @removed, $file ); } } @@ -1193,36 +1195,34 @@ sub process_commands($) { elsif ($word[1] !~ m,^[a-zA-Z0-9.+_:@=%-][~a-zA-Z0-9.+_:@=%-]*\.changes$,) { msg( "mail,log", "argument to cancel must be one .changes filename without path\n" ); } - my (@files); + my (@files) = (); for ( my($adelay)=0; $adelay <= $conf::max_delayed; $adelay++ ) { my($dir) = sprintf( "$conf::targetdir_delayed",$adelay ); if (-f "$dir/$word[1]") { - push (@files, "$dir/$word[1]"); - push (@files, map( "$dir/$_",get_filelist_from_known_good_changes("$dir/$word[1]"))); + @removed = (); + push (@files, "$word[1]"); + push (@files,get_filelist_from_known_good_changes("$dir/$word[1]")); + foreach $file ( @files ) { + if (!-f "$dir/$file") { + msg( "mail,log", "$dir/$file: no such file\n" ); + } + elsif ("$dir/$file" =~ /$conf::keep_files/) { + msg( "mail,log", "$dir/$file is protected, cannot ". + "remove\n" ); + } + elsif (!unlink( "$dir/$file" )) { + msg( "mail,log", "$dir/$file: rm: $!\n" ); + } + else { + push( @removed, $file ); + } + } + msg( "mail,log", "Files removed from $adelay-day: @removed\n" ) if @removed; } } if (!@files) { msg( "mail,log", "No upload found: $word[1]\n" ); } - else { - @removed = (); - foreach $file ( @files ) { - if (!-f $file) { - msg( "mail,log", "$file: no such file\n" ); - } - elsif ($file =~ /$conf::keep_files/) { - msg( "mail,log", "$file is protected, cannot ". - "remove\n" ); - } - elsif (!unlink( $file )) { - msg( "mail,log", "$file: rm: $!\n" ); - } - else { - push( @removed, $file ); - } - } - msg( "mail,log", "Files removed: @removed\n" ) if @removed; - } } else { msg( "mail,log", "unknown command $word[0]\n" );