]> err.no Git - dak/commitdiff
don't try to remove file --searchdirs, prune some paths from messages
authorThomas Viehmann <tv@beamnet.de>
Sat, 20 Sep 2008 15:54:59 +0000 (17:54 +0200)
committerThomas Viehmann <tv@beamnet.de>
Sat, 20 Sep 2008 15:54:59 +0000 (17:54 +0200)
Signed-off-by: Thomas Viehmann <tv@beamnet.de>
tools/debianqueued-0.9/ChangeLog
tools/debianqueued-0.9/debianqueued

index d88753374b85e959ad5315a96afc5975d8600c52..01bf71fcf448f78d59e118d1ea43e27f8cdf3e65 100644 (file)
@@ -1,3 +1,7 @@
+2008-09-20  Thomas Viehmann  <tv@beamnet.de>
+
+       * debianqueued: Minor fixes on .commands processing.
+
 2008-09-15  Joerg Jaspert  <joerg@debian.org>
 
        * config: Use 15 delayed dirs. Also change maintainer_mail to
index eebba4dfe4af7cc41e6169aa873fd13164639bdc..eebb91513b9aca8ac3339fa41c7d89e27185380c 100755 (executable)
@@ -4,6 +4,7 @@
 #
 # Copyright (C) 1997 Roman Hodek <Roman.Hodek@informatik.uni-erlangen.de>
 # Copyright (C) 2001-2007 Ryan Murray <rmurray@debian.org>
+# Copyright (C) 2008 Thomas Viehmann <tv@beamnet.de>
 #
 # 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" );