Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37548571
en ru br
Репозитории ALT

Группа :: Разработка/Прочее
Пакет: repocop-report-prometheus

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

pax_global_header00006660000000000000000000000064122310411110014474gustar00rootroot0000000000000052 comment=e5f4b3b45125561adeeb543940ec87feabe1d3cd
repocop-report-prometheus-0.32/000075500000000000000000000000001223104111100165675ustar00rootroot00000000000000repocop-report-prometheus-0.32/.gear/000075500000000000000000000000001223104111100175635ustar00rootroot00000000000000repocop-report-prometheus-0.32/.gear/rules000064400000000000000000000000071223104111100206350ustar00rootroot00000000000000tar: .
repocop-report-prometheus-0.32/repocop-report-prometheus-dump000075500000000000000000000144421223104111100246360ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use Test::Repocop::Options;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;

$Repocop::arg::reportlevel='skip';
my $mysqlver=5;
my $packet_size=131072; #131072= 100kb
#my $repocop_patch_url='http://ftp.linux.kiev.ua/pub/Linux/ALT/people/viy/repocop/reports/diff/by-srpm';
my $repocop_patch_url='http://repocop.altlinux.org/pub/repocop/reports/diff/by-srpm';

&Test::Repocop::Options::get_common_options(
'patchurl=s' => \$repocop_patch_url,
'mysql=f' => \$mysqlver,
'packetsize=i' => \$packet_size,
);
&Test::Repocop::Options::die_if_nothing_to_report();

sub aquote {my @retval;foreach (@_) {push @retval, quote($_)}; return @retval};
#sub quote {$_=$_[0];s/'/''/g;s/\n/\\n/g;return $_};
sub quote {
$_=$_[0];
if (length($_)> 1000) {
$_=substr($_,0,1000)."... [the rest of the message is skipped]"
}
s/'/''/g;
return $_
};
sub max {return $_[1] unless defined $_[0]; if ($_[0]>=$_[1]) {return $_[0]}; return $_[1];}

sub sql_dump_row {
my $ptrinsert_current=shift;
my $ptrinsert=shift;
my $ptrsize=shift;
return unless $_[0];
for (my $i=0; $i<@_;$i++) {
$ptrsize->[$i]=max($ptrsize->[$i],length($_[$i]));
}
my $row="('".join("','",aquote(@_))."')";
if (length($ptrinsert->[$$ptrinsert_current])+length($row)<$packet_size) {
unless ($ptrinsert->[$$ptrinsert_current]) {
$ptrinsert->[$$ptrinsert_current]=$row;
} else {
$ptrinsert->[$$ptrinsert_current].=','.$row;
}
} else {
$ptrinsert->[++$$ptrinsert_current]=$row;
}
}


my $repocop_insert_current=0;
my @repocop_insert=('');
my @repocop_size;

my $metadata=Test::Repocop::Metadata->new();
my $testdb=Test::Repocop::TestDB->new();
my $cache=$testdb->get_pkg_test_status_result_iterator();
while (my ($rpm,$test,$status,$result)=$cache->iterate4_filtered()) {
my $name=$metadata->name($rpm);
my $version=$metadata->version($rpm);
my $release=$metadata->release($rpm);
my $arch=$metadata->arch($rpm);
my $srpm=$metadata->sourceid($rpm);
my $srcname=$metadata->name($srpm);
my $srcversion=$metadata->version($srpm);
my $srcrelease=$metadata->release($srpm);
unless (defined $srcname && defined $name && defined $version && defined $release && defined $arch) {
warn "internal error: broken metadata for $rpm";
next;
}
&sql_dump_row(\$repocop_insert_current,\@repocop_insert,\@repocop_size,
$name,$version,$release,$arch,$srcname,$srcversion,$srcrelease,$test,$status,$result);
}

if ($mysqlver < 4.99) {
# mysql 4.0 varchars are no more 255 bytes
@repocop_size = map {$_>255? 255:$_} @repocop_size;
}

print q{
--
-- Table structure for table `repocop`
--

DROP TABLE IF EXISTS `repocop`;
CREATE TABLE `repocop` (
`name` varchar(}.$repocop_size[0].q{) binary NOT NULL default '',
`version` varchar(}.$repocop_size[1].q{) NOT NULL default '',
`rel` varchar(}.$repocop_size[2].q{) NOT NULL default '',
`arch` varchar(}.$repocop_size[3].q{) NOT NULL default 'i586',
`srcname` varchar(}.$repocop_size[4].q{) binary NOT NULL default '',
`srcversion` varchar(}.$repocop_size[5].q{) NOT NULL default '',
`srcrel` varchar(}.$repocop_size[6].q{) NOT NULL default '',
`testname` varchar(}.$repocop_size[7].q{) NOT NULL default '',
`status` enum('skip','ok','experimental','info','warn','fail') NOT NULL default 'skip',
`message` mediumtext,
KEY `name` (`name`(30)),
KEY `testname` (`testname`(30)),
KEY `srcname` (`srcname`(30))
) TYPE=MyISAM;

--
-- Dumping data for table `repocop`
--
};
&print_dump('repocop',\@repocop_insert);

my $repocop_patchdir="$repocop_cachedir/reports/diff/by-srpm";


unless (-d $repocop_patchdir) {
warn "repocop patches not found. run repocop-fix-* first.\n";
exit;
}

my $patches_insert_current=0;
my @patches_insert=('');
my @patches_size=(50,20,20,200);

foreach (glob "$repocop_patchdir/*") {
s!^$repocop_patchdir/!!;
my $patchname=$_;
s!.diff!.src!;
my $srpm=$_;
my $name=$metadata->name($srpm);
my $version=$metadata->version($srpm);
my $release=$metadata->release($srpm);
my $url=$repocop_patch_url.'/'.$patchname;
&sql_dump_row(\$patches_insert_current,\@patches_insert,\@patches_size,
$name,$version,$release,$url);
}

if ($mysqlver < 4.99) {
# mysql 4.0 varchars are no more 255 bytes
@patches_size = map {$_>255? 255:$_} @patches_size;
}

print q{

--
-- Table structure for table `repocop_patches`
--

DROP TABLE IF EXISTS `repocop_patches`;
-- SET @saved_cs_client = @@character_set_client;
-- SET character_set_client = utf8;
CREATE TABLE `repocop_patches` (
`name` varchar(}.$patches_size[0].q{) binary NOT NULL default '',
`version` varchar(}.$patches_size[1].q{) NOT NULL default '',
`rel` varchar(}.$patches_size[2].q{) NOT NULL default '',
`url` varchar(}.$patches_size[3].q{) NOT NULL default '',
KEY `name` (`name`(20))
) TYPE=MyISAM;
-- SET character_set_client = @saved_cs_client;

--
-- Dumping data for table `repocop_patches`
--

};
&print_dump('repocop_patches',\@patches_insert);

sub print_dump {
my ($tablename,$dataptr)=@_;
print 'LOCK TABLES `'.$tablename.'` WRITE;
';
print 'ALTER TABLE `'.$tablename.'` DISABLE KEYS;
' if $mysqlver>4.0;
foreach (@$dataptr) {
print 'INSERT INTO `'.$tablename.'` VALUES ',$_,";\n" if $_;
}
print 'ALTER TABLE `'.$tablename.'` ENABLE KEYS;
' if $mysqlver>4.0;
print 'UNLOCK TABLES;
';
}

=head1 NAME

repocop-report-prometeus - a tool that reports repocop unit tests results to prometeus.

=head1 SYNOPSIS

B<repocop-report-prometeus>
=include synopsis.pod.in

=head1 DESCRIPTION

B<repocop-report-prometeus> processes results of repocop unit tests,
created with repocop-run command, stored in <cachedir>,
and publishes results to prometeus.
Presize subset of tests can be selected using B<--include>
and B<--exclude> options.

=head1 OPTIONS

=over

=include options-report.pod.in
=include options.pod.in

=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 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

repocop-report-prometheus-0.32/repocop-report-prometheus-mysql000075500000000000000000000101071223104111100250300ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use DBI;
use Test::Repocop::Options;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;

$Repocop::arg::reportlevel='skip';
#my $repocop_patch_url='http://ftp.linux.kiev.ua/pub/Linux/ALT/people/viy/repocop/reports/diff/by-srpm';
my $repocop_patch_url='http://repocop.altlinux.org/pub/repocop/reports/diff/by-srpm';
&Test::Repocop::Options::get_common_options(
'patchurl=s' => \$repocop_patch_url,
);
&Test::Repocop::Options::die_if_nothing_to_report();

use vars qw($db $dbUser $dbPass $dbHost);
eval {
#require '/usr/share/prometeus/web/cgi-bin/adm/dbinfo';
require '/usr/share/prometeus/scripts/dbinfo';
};
die "can't find prometeus dbinfo file" if $@;

our $dsn = "DBI:mysql:$db:$dbHost";
our $dbh = DBI->connect($dsn,$dbUser,$dbPass) || die "can't connect to mysql\n";

my $sth = $dbh->do("DELETE from repocop");

# name varchar(100) binary NOT NULL default '',
# version varchar(100) NOT NULL default '',
# rel varchar(100) NOT NULL default '',
# arch varchar(10) NOT NULL default 'i586',
# srcname varchar(100) binary NOT NULL default '',
# srcversion varchar(50) NOT NULL default '',
# srcrel varchar(20) NOT NULL default '',
# testname varchar(100) NOT NULL default '',
# status enum('skip','ok','warn','fail') NOT NULL default 'skip',
# message mediumtext,

my $bugz_in_Q = "REPLACE repocop VALUES(?,?,?,?,?,?,?,?,?,?)";

$sth = $dbh->prepare($bugz_in_Q);

my $metadata=Test::Repocop::Metadata->new();
my $testdb=Test::Repocop::TestDB->new();
my $cache=$testdb->get_pkg_test_status_result_iterator();
while (my ($rpm,$test,$status,$result)=$cache->iterate4_filtered()) {
my $name=$metadata->name($rpm);
my $version=$metadata->version($rpm);
my $release=$metadata->release($rpm);
my $arch=$metadata->arch($rpm);
my $srpm=$metadata->sourceid($rpm);
my $srcname=$metadata->name($srpm);
my $srcversion=$metadata->version($srpm);
my $srcrelease=$metadata->release($srpm);
unless (defined $srcname && defined $name && defined $version && defined $release && defined $arch) {
warn "internal error: broken metadata for $rpm";
next;
}
&to_prometeus($name,$version,$release,$arch,$srcname,$srcversion,$srcrelease,$test,$status,$result);
}

sub to_prometeus {
return unless $_[0];
$sth->execute(@_);
}

my $repocop_patchdir="$repocop_cachedir/reports/diff/by-srpm";

unless (-d $repocop_patchdir) {
warn "repocop patches not found. run repocop-fix-* first.\n";
exit;
}

$sth = $dbh->do("DELETE from repocop_patches");

# name varchar(100) binary NOT NULL default '',
# version varchar(50) NOT NULL default '',
# rel varchar(20) NOT NULL default '',
# url varchar(100) NOT NULL default '',

my $patch_Q = "REPLACE repocop_patches VALUES(?,?,?,?)";

$sth = $dbh->prepare($patch_Q);

foreach (glob "$repocop_patchdir/*") {
s!^$repocop_patchdir/!!;
my $patchname=$_;
s!.diff!.src!;
my $srpm=$_;
my $name=$metadata->name($srpm);
my $version=$metadata->version($srpm);
my $release=$metadata->release($srpm);
my $url=$repocop_patch_url.'/'.$patchname;
$sth->execute($name,$version,$release,$url);
}

=head1 NAME

repocop-report-prometeus - a tool that reports repocop unit tests results to prometeus.

=head1 SYNOPSIS

B<repocop-report-prometeus>
=include synopsis.pod.in

=head1 DESCRIPTION

B<repocop-report-prometeus> processes results of repocop unit tests,
created with repocop-run command, stored in <cachedir>,
and publishes results to prometeus.
Presize subset of tests can be selected using B<--include>
and B<--exclude> options.

=head1 OPTIONS

=over

=include options-report.pod.in
=include options.pod.in

=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 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

repocop-report-prometheus-0.32/repocop-report-prometheus.spec000064400000000000000000000056261223104111100246250ustar00rootroot00000000000000Name: repocop-report-prometheus
Version: 0.32
Release: alt1
BuildArch: noarch
Packager: Igor Yu. Vlasenko <viy@altlinux.org>

Summary: repocop report script that dumps test results to prometeus1 format
Group: Development/Other
License: GPL or Artistic
Url: http://repocop.altlinux.org

Requires: repocop > 0.68
#Requires: perl-JSON-XS
Obsoletes: repocop-prometeus < 0.22
Obsoletes: repocop-report-prometeus < 0.31

BuildRequires: perl-devel perldoc
#perl-JSON
BuildRequires: repocop

Source: %name-%version.tar

%description
Repocop is a repository unit tests platform.
%summary

%package -n repocop-report-prometheus2
Summary: repocop report script that dumps test results to prometheus2 format
Group: Development/Other
License: GPL or Artistic
Requires: repocop > 0.15
Obsoletes: repocop-report-heroku < 0.4
Obsoletes: repocop-report-prometeus2 < 0.31

%description -n repocop-report-prometheus2
Repocop is a repository unit tests platform.
%summary

%prep
%setup
rm -f *.spec

%build

%install
mkdir -p %buildroot/%_bindir
install -m 755 repocop-report-prometheus* %buildroot/%_bindir/

%files
#doc README ChangeLog
%_bindir/repocop-report-prometheus-*
#%_man1dir/repocop-report-prometheus-*

%files -n repocop-report-prometheus2
%_bindir/repocop-report-prometheus2*

%changelog
* Sun Oct 20 2013 Igor Vlasenko <viy@altlinux.ru> 0.32-alt1
- support for TestDB

* Tue Nov 27 2012 Igor Vlasenko <viy@altlinux.ru> 0.31-alt2
- added Obsoletes

* Tue Nov 27 2012 Igor Vlasenko <viy@altlinux.ru> 0.31-alt1
- renamed to prometheus (closes: 28131)

* Sun Jul 08 2012 Igor Vlasenko <viy@altlinux.ru> 0.30-alt2
- code cleanup; but still has old txt support for prometeus2.

* Fri Jul 06 2012 Igor Vlasenko <viy@altlinux.ru> 0.30-alt1
- added sqlite report

* Thu Dec 22 2011 Igor Vlasenko <viy@altlinux.ru> 0.29-alt1
- bugfix release (closes: 26741)

* Thu Dec 22 2011 Igor Vlasenko <viy@altlinux.ru> 0.28-alt1
- bugfix release

* Tue Dec 06 2011 Igor Vlasenko <viy@altlinux.ru> 0.27-alt1
- added branch to sql

* Wed Aug 31 2011 Igor Vlasenko <viy@altlinux.ru> 0.26-alt1
- added branch option

* Tue Aug 30 2011 Igor Vlasenko <viy@altlinux.ru> 0.25-alt2
- added repository option

* Tue Aug 30 2011 Igor Vlasenko <viy@altlinux.ru> 0.25-alt1
- new version

* Sun Nov 08 2009 Igor Vlasenko <viy@altlinux.ru> 0.24-alt2
- fix in repocop-report-prometeus2-patches

* Fri Nov 06 2009 Igor Vlasenko <viy@altlinux.ru> 0.24-alt1
- added repocop-report-prometeus2-patches

* Mon Nov 02 2009 Igor Vlasenko <viy@altlinux.ru> 0.23-alt1
- bugfixed format4 (prometeus2)

* Mon Nov 02 2009 Igor Vlasenko <viy@altlinux.ru> 0.22-alt1
- format4

* Tue Oct 20 2009 Igor Vlasenko <viy@altlinux.ru> 0.20-alt1
- renamed; now contains prometeus and prometeus2 reports

* Thu Sep 24 2009 Igor Vlasenko <viy@altlinux.ru> 0.3-alt1
- format3

* Wed Sep 23 2009 Igor Vlasenko <viy@altlinux.ru> 0.2-alt1
- format2

* Wed Sep 23 2009 Igor Vlasenko <viy@altlinux.ru> 0.1-alt1
- First build for Sisyphus.
repocop-report-prometheus-0.32/repocop-report-prometheus2000075500000000000000000000053701223104111100237550ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use Test::Repocop::Options;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;
#use Test::Repocop::ALTLinuxACL;

$Repocop::arg::reportlevel='skip';
my $branch='sisyphus';
&Test::Repocop::Options::get_common_options(
'b|branch=s' => \$branch,
);
&Test::Repocop::Options::die_if_nothing_to_report();
my $branch_id=1;
$branch_id=4 if $branch and $branch eq 't6';
my $sqlprefix='INSERT INTO repocops (name, version, release, arch, srcname, srcversion, srcrel, testname, status, message) VALUES (';
$sqlprefix='INSERT INTO repocops (branch_id, name, version, release, arch, srcname, srcversion, srcrel, testname, status, message) VALUES ('."'$branch_id',";

my $aclmap;
#$aclmap=Test::Repocop::ALTLinuxACL->new($Repocop::arg::aclfile) if $Repocop::arg::aclfile;
my $metadata=Test::Repocop::Metadata->new();
my $testdb=Test::Repocop::TestDB->new();
my $cache=$testdb->get_pkg_test_status_result_iterator();
while (my ($rpm,$test,$status,$result)=$cache->iterate4_filtered()) {
# linearize
$result=~s/\n/; /gs;
my $srpm=$metadata->sourceid($rpm);
my $packager=$metadata->nick($rpm);
my $name=$metadata->name($rpm);
my $version=$metadata->version($rpm);
my $release=$metadata->release($rpm);
my $arch=$metadata->arch($rpm);
my $srcname=$metadata->name($srpm);
my $srcversion=$metadata->version($srpm);
my $srcrelease=$metadata->release($srpm);
#print "$name|||$version|||$release|||$arch|||$srcname|||$srcversion|||$srcrelease|||$test|||$status|||$result\n";
my $pre="$name|||$version|||$release|||$arch|||$srcname|||$srcversion|||$srcrelease|||$test|||$status";
$pre=~s/'/''/g;
$pre=~s/\|\|\|/','/g;
$result=~s/'/''/g;
$result=~s/\\/\\\\/g;
$result=~s/\r/\\r/g;
$result=~s/\n/\\n/g;
print $sqlprefix,"'$pre',E'$result');\n";
}

#print STDERR "done.\n" if $verbose;

=head1 NAME

repocop-report-heroku - a tool that creates repocop reports for sisyphus.heroku.com.

=head1 SYNOPSIS

see repocop-report-txt

=head1 DESCRIPTION

B<repocop-report-heroku> processes results of repocop unit tests, created with
repocop-run command, stored in <cachedir> and creates results in txt form.
Presize subset of tests can be selected using B<--include>
and B<--exclude> options.

=head1 OPTIONS

see repocop-report-txt

=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 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

repocop-report-prometheus-0.32/repocop-report-prometheus2-patches000075500000000000000000000047561223104111100254110ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use Test::Repocop::Options;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;

$Repocop::arg::reportlevel='skip';
my $branch;
&Test::Repocop::Options::get_common_options(
'b|branch=s' => \$branch,
);
&Test::Repocop::Options::die_if_nothing_to_report();

my $baseurl=$branch eq 't6' ? "http://autoports.altlinux.org/pub/repocop" :
"http://repocop.altlinux.org/pub/repocop";
my $branch_id=1;
$branch_id=4 if $branch eq 't6';
my $sqlprefix='INSERT INTO repocop_patches (name, version, release, url) VALUES (';
$sqlprefix='INSERT INTO repocop_patches (branch_id, name, version, release, url) VALUES ('."'$branch_id'," if $branch;

my %patch;


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_filtered()) {
my $srpm=$metadata->sourceid($rpm);
if ($srpm eq $rpm) {
my $patchid=$srpm;
$patchid=~s/\.src$//;
my $suffix='/reports/diff/by-srpm/'.$patchid.'.diff';
if (-e $repocop_cachedir.$suffix) {
my $name=$metadata->name($rpm);
my $version=$metadata->version($rpm);
my $release=$metadata->release($rpm);
my $arch=$metadata->arch($rpm);
my $url=$baseurl.$suffix;
#my $sql=$sqlprefix."'$name','$version','$release','$url');\n";
print $sqlprefix,"'$name','$version','$release','$url');\n";
#$patch{$srpm}=$sql;
#} else {
#print STDERR "skipped $rpm $repocop_cachedir$suffix\n";
}
}
}

#foreach (keys (%patch)) {
# print $patch{$_};
#}

#print STDERR "done.\n" if $verbose;

=head1 NAME

repocop-report-heroku - a tool that creates repocop reports for sisyphus.heroku.com.

=head1 SYNOPSIS

see repocop-report-txt

=head1 DESCRIPTION

B<repocop-report-heroku> processes results of repocop unit tests, created with
repocop-run command, stored in <cachedir> and creates results in txt form.
Presize subset of tests can be selected using B<--include>
and B<--exclude> options.

=head1 OPTIONS

see repocop-report-txt

=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 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

repocop-report-prometheus-0.32/repocop-report-prometheus2-sqlite000075500000000000000000000076261223104111100252620ustar00rootroot00000000000000#!/usr/bin/perl -w

use strict;
use warnings;
use Test::Repocop::Options;
use Test::Repocop::TestDB;
use Test::Repocop::Metadata;
use DBI;
use DBD::SQLite;

$Repocop::arg::reportlevel='skip';
my $distro='altlinux';
my $branch='sisyphus';
my $component='classic';
my $dbfile;
my $repocop_patch_url=$branch eq 't6' ? "http://autoports.altlinux.org/pub/repocop" :
"http://repocop.altlinux.org/pub/repocop";

&Test::Repocop::Options::get_common_options(
'patchurl=s' => \$repocop_patch_url,
"distribution=s" => \$distro,
"b|branch=s" => \$branch,
"component=s" => \$component,
"out=s" => \$dbfile,
);
&Test::Repocop::Options::die_if_nothing_to_report();
#my $branch_id=1;
#$branch_id=4 if $branch and $branch eq 't6';
my ($dbUser,$dbPass);
our $dsn = "DBI:SQLite:dbname=$dbfile";
if (-e $dbfile) {
warn "$dbfile already exists - removing\n";
unlink $dbfile;
}
our $dbh = DBI->connect($dsn,$dbUser,$dbPass) || die "can't connect to SQLite\n";
$dbh->do("PRAGMA synchronous=OFF");
$dbh->do("CREATE TABLE repocop_metadata (
distribution TEXT,
branch TEXT,
component TEXT
)");
$dbh->do("INSERT INTO repocop_metadata (distribution,branch,component) VALUES ('$distro','$branch','$component')");
$dbh->do("CREATE TABLE repocop (
name TEXT,
version TEXT,
release TEXT,
arch TEXT,
srcname TEXT,
srcversion TEXT,
srcrel TEXT,
testname TEXT,
status TEXT,
message TEXT
)");
my $report_sth=$dbh->prepare('INSERT INTO repocop (name, version, release, arch, srcname, srcversion, srcrel, testname, status, message) VALUES (?,?,?,?,?,?,?,?,?,?)');
$dbh->do("CREATE TABLE repocop_patches (
name TEXT,
version TEXT,
release TEXT,
url TEXT
)");
my $patch_sth=$dbh->prepare('INSERT INTO repocop_patches (name, version, release, url) VALUES (?,?,?,?)');
$dbh->begin_work;
my $aclmap;
#$aclmap=Test::Repocop::ALTLinuxACL->new($Repocop::arg::aclfile) if $Repocop::arg::aclfile;
my $metadata=Test::Repocop::Metadata->new();
my $testdb=Test::Repocop::TestDB->new();
my $cache=$testdb->get_pkg_test_status_result_iterator();
while (my ($rpm,$test,$status,$result)=$cache->iterate4_filtered()) {
# linearize -no need
# $result=~s/\n/; /gs;
# semi - linearize as we write directly into a database.
$result=~s/\n/;\n/gs;
my $srpm=$metadata->sourceid($rpm);
my $packager=$metadata->nick($rpm);
my $name=$metadata->name($rpm);
my $version=$metadata->version($rpm);
my $release=$metadata->release($rpm);
my $arch=$metadata->arch($rpm);
my $srcname=$metadata->name($srpm);
my $srcversion=$metadata->version($srpm);
my $srcrelease=$metadata->release($srpm);
$report_sth->execute($name,$version,$release,$arch,$srcname,$srcversion,$srcrelease,$test,$status,$result);
if ($srpm eq $rpm) {
my $patchid=$srpm;
$patchid=~s/\.src$//;
my $suffix='/reports/diff/by-srpm/'.$patchid.'.diff';
if (-e $repocop_cachedir.$suffix) {
my $url=$repocop_patch_url.$suffix;
$patch_sth->execute($name,$version,$release,$url);
}
}
}
$dbh->commit;

#print STDERR "done.\n" if $verbose;

=head1 NAME

repocop-report-prometeus2 - a tool that creates repocop reports for sisyphus.heroku.com.

=head1 SYNOPSIS

see repocop-report-txt

=head1 DESCRIPTION

B<repocop-report-heroku> processes results of repocop unit tests, created with
repocop-run command, stored in <cachedir> and creates results in txt form.
Presize subset of tests can be selected using B<--include>
and B<--exclude> options.

=head1 OPTIONS

see repocop-report-txt

=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-2012 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

 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin