use BSNotify;
use BSPrereleaseOpt;
-my $build_monitor_enabled = eval {
- require plugins::BuildMonitorDB;
- plugins::BuildMonitorDB->import();
- 1;
-};
-if( $build_monitor_enabled ) {
- print "build monitor enabled.!\n";
-} else {
- print "build monitor DISABLED.!\n";
-}
-
=head1 NAME
BSSched::BuildJob
}
+sub get_rawlog_url {
+ my ($proj_name, $repo, $arch, $pkg_name) = @_;
+
+ my $obs_url = $BSConfig::obs_frontend_url || '';
+
+ # for obs 2.7
+ my @arr = (
+ $obs_url,
+ "public/build",
+ $proj_name,
+ $repo,
+ $arch,
+ $pkg_name,
+ "_log"
+ );
+ my $url = join("/", @arr);
+
+ return $url;
+}
+
=head2 killjob - kill a single build job
input: $job - job identificator
# Make symlink for scheduled packages.
BSPrereleaseOpt::make_symlink_rpms($projpacks, $gctx->{'reporoot'}, $projid, $repoid, $myarch, $packid);
writexml("$dst/.status", "$dst/status", { 'status' => 'scheduled', 'readytime' => $now, 'job' => $job}, $BSXML::buildstatus);
- my $build_log_url = "";
- if( $build_monitor_enabled ) {
- $build_log_url = encode_base64(BuildMonitorDB::get_rawlog_url($projid, $repoid, $myarch, $packid), '');
- }
+ my $build_log_url = encode_base64(get_rawlog_url($projid, $repoid, $myarch, $packid), '');
BSNotify::notify('BUILD_START', {'project'=>$projid, 'repository'=>$repoid, 'arch'=>$myarch, 'package'=>$packid, 'reason'=>$reason, 'build_log_url'=>$build_log_url}, undef, $gctx->{'testmode'});
# And store reason and time
$reason->{'time'} = $now;
use strict;
-my $build_monitor_enabled = eval {
- require plugins::BuildMonitorDB;
- plugins::BuildMonitorDB->import();
- 1;
-};
-if( $build_monitor_enabled ) {
- print "build monitor enabled.!\n";
-} else {
- print "build monitor DISABLED.!\n";
-}
-
my $port = 5252; #'RR'
$port = $1 if $BSConfig::reposerver =~ /:(\d+)$/;
my $proxy;
return $job;
}
+sub parse_statistics {
+ my ($filename) = @_;
+
+ if ( ! defined $filename ) {
+ return undef;
+ }
+
+ #print "filename=$filename\n";
+ #if( open(DATA1, "<$filename") ) {
+ #while( <DATA1> ) {
+ #print $_;
+ #}
+ #}
+ my $statistics=BSUtil::readxml($filename, $BSXML::buildstatistics, 1);
+
+ #print Dumper($statistics);
+
+ my $preinstall=$statistics->{'times'}->{'preinstall'}->{'time'}->{'_content'};
+ my $install =$statistics->{'times'}->{'install'}->{'time'}->{'_content'};
+ my $main =$statistics->{'times'}->{'main'}->{'time'}->{'_content'};
+
+ return $preinstall, $install, $main;
+}
+
# add :full repo to pool, make sure repo is up-to-data by
# scanning the directory
sub addrepo_scan {
$ninfo{'previouslyfailed'} = 1 if -e "$reporoot/$prpa/:logfiles.fail/$info->{package}";
- if( $build_monitor_enabled ) {
- my ($pre_install_time, $install_time, $main_build_time) = BuildMonitorDB::parse_statistics("$dir/_statistics");
- $ninfo{'pre_install_time'} = $pre_install_time;
- $ninfo{'install_time'} = $install_time;
- $ninfo{'main_build_time'} = $main_build_time;
- }
+ my ($pre_install_time, $install_time, $main_build_time) = parse_statistics("$dir/_statistics");
+ $ninfo{'pre_install_time'} = $pre_install_time;
+ $ninfo{'install_time'} = $install_time;
+ $ninfo{'main_build_time'} = $main_build_time;
+
if ($cgi->{'code'} && $cgi->{'code'} eq 'unchanged') {
$jobstatus->{'result'} = 'unchanged';
BSNotify::notify('BUILD_UNCHANGED', \%ninfo);