#!/usr/bin/perl -w

use strict;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;
use Test::Repocop::CLI::Base;
our @ISA=qw/Test::Repocop::CLI/;
__PACKAGE__->get_and_process_cli_options();
&Test::Repocop::Workdir::die_if_nothing_to_report();
my $mode='fail';
$mode='warn' if ($0=~/warn(?:ing)?s?$/);
$mode='info' if ($0=~/info$/);
$mode='experimental' if ($0=~/experimental$/);

my $metadata=Test::Repocop::Metadata->new();
my $testdb=Test::Repocop::TestDB->new();
my $cache=$testdb->get_pkg_test_status_iterator();
while (my ($rpm,$test,$status)=$cache->iterate3()) {
    my $name=$metadata->name($rpm);
    #print "${name}\t$rpm\t$test\n" if $status eq $mode;
    print "${name}#${test}\t$rpm\t$test\n" if $status eq $mode;
}

=head1	NAME

repocop-report-qa-robot-* - report repocop unit tests results for qa-robot.

=head1	DESCRIPTION

B<repocop-report-qa-robot-{warn,fail}> processes results of repocop unit tests,
created with  repocop-run command and stored in <cachedir>, 
and creates results in form sutable for qa-robot input.

B<repocop-report-qa-robot-warn> lists all packages that got warnings
along with corresponding tests names.

B<repocop-report-qa-robot-fail> lists all packages that failed tests
along with corresponding tests names.

=head1	OPTIONS

=over

see --help

=back

=head1	AUTHOR

Written by Igor Vlasenko <viy@altlinux.org>.

=head1	ACKNOWLEGEMENTS

To Alexey Torbin <at@altlinux.org>, whose qa-robot package
had a strong influence on repocop. 

=head1	COPYING

Copyright (c) 2008-2018 Igor Vlasenko, ALT Linux Team.

This is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.

=cut

