| 64 |
sub patch_all (@); |
sub patch_all (@); |
| 65 |
sub scan_facet ($$); |
sub scan_facet ($$); |
| 66 |
sub fix_patch (); |
sub fix_patch (); |
| 67 |
|
sub fix_patch1 (); |
| 68 |
|
|
| 69 |
|
|
| 70 |
## |
## |
| 95 |
given package. |
given package. |
| 96 |
fixpatch Reads a patch from stdin and only output those parts that are |
fixpatch Reads a patch from stdin and only output those parts that are |
| 97 |
confirmed by dbacl. |
confirmed by dbacl. |
| 98 |
|
fixpatch1 Reads a patch from stdin and only output those parts on which |
| 99 |
|
dbacl does not disagree. |
| 100 |
Options are: |
Options are: |
| 101 |
--help, -h Print this help message. |
--help, -h Print this help message. |
| 102 |
--verbose, -v Be verbose. A number can be provided for more verbose |
--verbose, -v Be verbose. A number can be provided for more verbose |
| 199 |
check_training(); |
check_training(); |
| 200 |
read_apt(); |
read_apt(); |
| 201 |
fix_patch(); |
fix_patch(); |
| 202 |
|
} elsif ($cmd eq 'fixpatch1') { |
| 203 |
|
check_training(); |
| 204 |
|
read_apt(); |
| 205 |
|
fix_patch1(); |
| 206 |
} else { |
} else { |
| 207 |
usage(); |
usage(); |
| 208 |
} |
} |
| 456 |
push @res, "-$tag"; |
push @res, "-$tag"; |
| 457 |
} |
} |
| 458 |
} |
} |
| 459 |
|
print "$pkg: ", join(', ', @res), "\n" if @res; |
| 460 |
|
} |
| 461 |
|
printf STDERR "Could not evaluate %d tags.\n", $failed if $failed; |
| 462 |
|
} |
| 463 |
|
|
| 464 |
|
# Reads a patch, and removes those parts that dbacl does not like |
| 465 |
|
sub fix_patch1 () |
| 466 |
|
{ |
| 467 |
|
# Filter out tags for which we know the bayesian doesn't do a good job |
| 468 |
|
# for my $tag (keys %tags) |
| 469 |
|
# { |
| 470 |
|
# push @interesting_tags, $tag |
| 471 |
|
# if scalar keys %{$tags{$tag}} >= $tag_min_card |
| 472 |
|
# and $tag !~ $tag_blacklist; |
| 473 |
|
# } |
| 474 |
|
|
| 475 |
|
my $failed = 0; |
| 476 |
|
while (<STDIN>) |
| 477 |
|
{ |
| 478 |
|
chop; |
| 479 |
|
my ($pkg, $patch) = split(': ', $_); |
| 480 |
|
next if not exists $pkgdata{$pkg}; |
| 481 |
|
my @res; |
| 482 |
|
for my $p (split(', ', $patch)) |
| 483 |
|
{ |
| 484 |
|
my ($op, $tag) = (substr($p, 0, 1), substr($p, 1)); |
| 485 |
|
my $perc = testtag($pkg, $tag); |
| 486 |
|
if (not defined $perc) |
| 487 |
|
{ |
| 488 |
|
$failed++; |
| 489 |
|
# print STDERR "Error evaluating $tag for $pkg\n"; |
| 490 |
|
next; |
| 491 |
|
} |
| 492 |
|
if ($op eq '+' && $perc >= -$sure_perc) |
| 493 |
|
{ |
| 494 |
|
push @res, "+$tag"; |
| 495 |
|
} elsif ($op eq '-' && $perc <= $sure_perc) { |
| 496 |
|
push @res, "-$tag"; |
| 497 |
|
} |
| 498 |
|
} |
| 499 |
print "$pkg: ", join(', ', @res), "\n" if @res; |
print "$pkg: ", join(', ', @res), "\n" if @res; |
| 500 |
} |
} |
| 501 |
printf STDERR "Could not evaluate %d tags.\n", $failed if $failed; |
printf STDERR "Could not evaluate %d tags.\n", $failed if $failed; |