[Debtags-commits] [svn] r1417 - autodebtag/trunk/dbacl
Enrico Zini
enrico at costa.debian.org
Thu Oct 27 21:33:23 UTC 2005
Author: enrico
Date: Thu Oct 27 21:33:23 2005
New Revision: 1417
Modified:
autodebtag/trunk/dbacl/debtags-ai
Log:
added feature fixpatch1
Modified: autodebtag/trunk/dbacl/debtags-ai
==============================================================================
--- autodebtag/trunk/dbacl/debtags-ai (original)
+++ autodebtag/trunk/dbacl/debtags-ai Thu Oct 27 21:33:23 2005
@@ -64,6 +64,7 @@
sub patch_all (@);
sub scan_facet ($$);
sub fix_patch ();
+sub fix_patch1 ();
##
@@ -94,6 +95,8 @@
given package.
fixpatch Reads a patch from stdin and only output those parts that are
confirmed by dbacl.
+ fixpatch1 Reads a patch from stdin and only output those parts on which
+ dbacl does not disagree.
Options are:
--help, -h Print this help message.
--verbose, -v Be verbose. A number can be provided for more verbose
@@ -196,6 +199,10 @@
check_training();
read_apt();
fix_patch();
+ } elsif ($cmd eq 'fixpatch1') {
+ check_training();
+ read_apt();
+ fix_patch1();
} else {
usage();
}
@@ -454,6 +461,46 @@
printf STDERR "Could not evaluate %d tags.\n", $failed if $failed;
}
+# Reads a patch, and removes those parts that dbacl does not like
+sub fix_patch1 ()
+{
+ # Filter out tags for which we know the bayesian doesn't do a good job
+# for my $tag (keys %tags)
+# {
+# push @interesting_tags, $tag
+# if scalar keys %{$tags{$tag}} >= $tag_min_card
+# and $tag !~ $tag_blacklist;
+# }
+
+ my $failed = 0;
+ while (<STDIN>)
+ {
+ chop;
+ my ($pkg, $patch) = split(': ', $_);
+ next if not exists $pkgdata{$pkg};
+ my @res;
+ for my $p (split(', ', $patch))
+ {
+ my ($op, $tag) = (substr($p, 0, 1), substr($p, 1));
+ my $perc = testtag($pkg, $tag);
+ if (not defined $perc)
+ {
+ $failed++;
+# print STDERR "Error evaluating $tag for $pkg\n";
+ next;
+ }
+ if ($op eq '+' && $perc >= -$sure_perc)
+ {
+ push @res, "+$tag";
+ } elsif ($op eq '-' && $perc <= $sure_perc) {
+ push @res, "-$tag";
+ }
+ }
+ print "$pkg: ", join(', ', @res), "\n" if @res;
+ }
+ printf STDERR "Could not evaluate %d tags.\n", $failed if $failed;
+}
+
##
## Training
More information about the Debtags-commits
mailing list