[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] don't try to remove file --searchdirs, prune some paths from messages



Signed-off-by: Thomas Viehmann <tv@beamnet.de>
---
 tools/debianqueued-0.9/ChangeLog    |    4 ++
 tools/debianqueued-0.9/debianqueued |   54 +++++++++++++++++-----------------
 2 files changed, 31 insertions(+), 27 deletions(-)

diff --git a/tools/debianqueued-0.9/ChangeLog b/tools/debianqueued-0.9/ChangeLog
index d887533..01bf71f 100644
--- a/tools/debianqueued-0.9/ChangeLog
+++ b/tools/debianqueued-0.9/ChangeLog
@@ -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
diff --git a/tools/debianqueued-0.9/debianqueued b/tools/debianqueued-0.9/debianqueued
index eebba4d..eebb915 100755
--- a/tools/debianqueued-0.9/debianqueued
+++ b/tools/debianqueued-0.9/debianqueued
@@ -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" );
-- 
1.5.6.5



Reply to: