[Debtags-commits] [svn] r1405 - autodebtag/trunk/dbacl

Enrico Zini enrico at costa.debian.org
Thu Oct 27 14:26:49 UTC 2005


Author: enrico
Date: Thu Oct 27 14:26:49 2005
New Revision: 1405

Modified:
   autodebtag/trunk/dbacl/trainall
Log:
Improved interaction a bit

Modified: autodebtag/trunk/dbacl/trainall
==============================================================================
--- autodebtag/trunk/dbacl/trainall	(original)
+++ autodebtag/trunk/dbacl/trainall	Thu Oct 27 14:26:49 2005
@@ -34,6 +34,7 @@
 } elsif ($cmd eq 'patch') {
 	read_apt();
 
+	# Filter out tags for which we know the bayesian doesn't do a good job
 	for my $tag (keys %tags)
 	{
 		push @interesting_tags, $tag 
@@ -41,11 +42,12 @@
 	}
 
 	my %pkgs_done;
-	print STDERR "Generating patch.  Create a file called 'patch-stop' to interrupt (you can resume later using $0 patch resume < partial-patch).\n" if $verbose > 0;
-	if (@ARGV && $ARGV[0] eq 'resume')
+	print STDERR "Generating patch.  Create a file called 'patch-stop' to interrupt (you can resume later).\n" if $verbose > 0;
+	if (-f 'patch-resume')
 	{
 		# If asked to resume, read the partial patch from stdin
-		while (<STDIN>)
+		open IN, "patch-resume" or die "Can't open patch-resume: $!";
+		while (<IN>)
 		{
 			print;
 			if (/^(\S+): /)
@@ -56,10 +58,16 @@
 				print STDERR "Could not parse $_\n";
 			}
 		}
+		close(IN);
 	}
 	for my $pkg (keys %pkgdata)
 	{
-		last if -f 'patch-stop';
+		if -f 'patch-stop'
+		{
+			print STDERR "Interrupted.  Put the partial results in a file called 'patch-resume' to resume the computation from this point.\n".
+			unlink ('patch-stop');
+			last;
+		}
 
 		if (not exists $pkgs_done{$pkg})
 		{
@@ -67,8 +75,6 @@
 			patch_package($pkg)
 		}
 	}
-
-	unlink ('patch-stop');
 } else {
 	usage();
 }



More information about the Debtags-commits mailing list