/[debtags]/autodebtag/trunk/dbacl/debtags-ai
ViewVC logotype

Diff of /autodebtag/trunk/dbacl/debtags-ai

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1416 by enrico, Thu Oct 27 20:59:46 2005 UTC revision 1417 by enrico, Thu Oct 27 21:33:23 2005 UTC
# Line 64  sub read_apt (); Line 64  sub read_apt ();
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  ##  ##
# Line 94  Commands are: Line 95  Commands are:
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
# Line 196  sub main () Line 199  sub main ()
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          }          }
# Line 449  sub fix_patch () Line 456  sub fix_patch ()
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;

Legend:
Removed from v.1416  
changed lines
  Added in v.1417

  ViewVC Help
Powered by ViewVC 1.1.5