[Collab-qa-commits] r1200 - buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller
goneri at alioth.debian.org
goneri at alioth.debian.org
Tue Sep 2 10:56:15 UTC 2008
Author: goneri
Date: 2008-09-02 10:56:14 +0000 (Tue, 02 Sep 2008)
New Revision: 1200
Modified:
buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
Log:
get first the VCS build to process (before those from Debian mirror)
add a value in the .ini file to know if the .deb need to be send back (sendbackdebs=yes)
use changelogentry.changesuri
Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm 2008-09-02 10:42:19 UTC (rev 1199)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm 2008-09-02 10:56:14 UTC (rev 1200)
@@ -62,6 +62,10 @@
vcs
ON
vcs.id = repository.vcs_id
+ LEFT JOIN
+ vcs AS vcs2
+ ON
+ vcs2.id = repository.vcs_id AND vcs2.name = 'apt'
WHERE
repositoryentry.".$params->{arch}." = true
AND
@@ -76,6 +80,7 @@
)
ORDER BY
build.id IS NOT NULL,
+ vcs2.name IS NOT NULL,
build.time,
changelogentry.date
LIMIT 1";
@@ -84,7 +89,6 @@
my $changelogentry_id = $tobuild->[0][1];
my $vcs_name = $tobuild->[0][0];
- die if $vcs_name eq 'apt';
die "Can't find a package to build" unless $changelogentry_id;
my $changelogentry = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search ({id => $changelogentry_id})->first;
@@ -99,12 +103,18 @@
#my $repositoryuri = $c->config->{path}->{weburi}."/static/files";
my $repositoryuri = "http://buildstat.debian.net/repository";
$dscuri =~ s/\@REPOSITORY_URL@/$repositoryuri/;
- # TODO
- $dscuri =~ s/\@DEB_MIRROR\@/http:\/\/ftp.fr.debian.org\/debian/;
# TODO create the qajob entry here!
+ my $reply = "action=build\ndsc=$dscuri\nid=".$changelogentry->id."\n";
+ # No reason to post back the .deb with the source package come from
+ # Debian repositories
+ if ($vcs_name ne 'apt') {
+ $reply .= "sendbackdebs=yes\n";
+ } else {
+ $reply .= "sendbackdebs=no\n";
+ }
- $c->response->body("action=build\ndsc=$dscuri\nid=".$changelogentry->id."\n");
+ $c->response->body($reply);
}
@@ -128,11 +138,13 @@
my $dbh = $c->model('DB')->storage->dbh;
- my $request = "
+ my %request;
+
+ $request{source} = "
SELECT
- changelogentry.id,
- changelogentry.dscuri,
- build.id
+ changelogentry.id AS changelogentry_id,
+ changelogentry.dscuri AS dscuri,
+ build.id AS build_id
FROM
build,
changelogentry
@@ -145,19 +157,49 @@
WHERE
build.changelogentry_id=changelogentry.id
AND
+ changelogentry.dscuri IS NOT NULL
+ ORDER BY
+ lastjobstart IS NOT NULL,
+ lastjobstart
+ LIMIT 1";
+
+ $request{build} = "
+SELECT
+ changelogentry.id AS changelogentry_id,
+ changelogentry.changesuri AS changesuri,
+ build.id AS build_id
+FROM
+ build,
+ changelogentry
+ LEFT JOIN
+ qajob
+ ON
+ changelogentry.id=qajob.changelogentry_id
+ AND
+ qajob.qatool_id=".$qatool->id."
+WHERE
+ build.changelogentry_id=changelogentry.id
+ AND
isbuildok='1'
+ AND
+ changelogentry.changesuri IS NOT NULL
ORDER BY
lastjobstart IS NOT NULL,
lastjobstart
LIMIT 1";
- my @array = $dbh->selectrow_array($request);
- my $changelogentry_id = $array[0];
- my $dscuri = $array[1];
- my $build_id = $array[2];
+
+
+
+
+
+ my $hashref = $dbh->selectrow_hashref($request{$params->{target}});
+ die unless $hashref;
+# my $changelogentry_id = $;
+# my $dscuri = $array[1];
+# my $build_id = $array[2];
my $cookie = int (rand(0xfffffff));
- die unless $changelogentry_id && $dscuri && $build_id;
- my $changelogentry = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search({id => $changelogentry_id})->first;
+ my $changelogentry = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search({id => $hashref->{changelogentry_id}})->first;
die unless $changelogentry;
# die unless $c->config->{path}->{weburi}; TODO
@@ -168,32 +210,32 @@
$qajob = $c->model('SvnBuildStat::Model::DB::Qajob')->find_or_create(
qatool_id => $qatool->id,
- changelogentry_id => $changelogentry_id,
+ changelogentry_id => $hashref->{changelogentry_id},
build_id => undef,
);
$qajob->cookie($cookie);
$qajob->lastjobstart("NOW");
$qajob->update;
- $ret .= "qajob_id=".$qajob->id."\ndsc=$dscuri\n";
+ $ret .= "qajob_id=".$qajob->id."\ndsc=".$hashref->{dscuri}."\n";
} elsif ($params->{target} eq 'binary') {
$qajob = $c->model('SvnBuildStat::Model::DB::Qajob')->find_or_create(
qatool_id => $qatool->id,
- changelogentry_id => $changelogentry_id,
- build_id => $build_id,
+ changelogentry_id => $hashref->{changelogentry_id},
+ build_id => $hashref->{build_id},
);
$qajob->cookie($cookie);
$qajob->lastjobstart("NOW");
$qajob->update;
#my $changesfile = bsd_glob($c->config->{path}->{staticdir}.'/files/'.$changelogentry->repositoryentry_id->repository_id->team_id->shortname.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$build_id."/deb/*.changes");
- my $changesfile = bsd_glob('/var/lib/buildstat-server/repository/'.$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$build_id."/deb/*.changes");
- print STDERR $changesfile."\n";
- my $changesuri = "http://buildstat.debian.net/repository/".$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$build_id."/deb/".basename($changesfile);
+# my $changesfile = bsd_glob('/var/lib/buildstat-server/repository/'.$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$hashref->{build_id}."/deb/*.changes");
+# print STDERR $changesfile."\n";
+# my $changesuri = "http://buildstat.debian.net/repository/".$changelogentry->repositoryentry_id->repository_id->id.'/'.$changelogentry->repositoryentry_id->sourcepackage_id->name.'/'.$changelogentry->repositoryentry_id->changelogentry_id->id.'/build/'.$hashref->{build_id}."/deb/".basename($changesfile);
- $ret .= "qajob_id=".$qajob->id."\nchangesuri=".$changesuri."\n";
+ $ret .= "qajob_id=".$qajob->id."\nchangesuri=".$hashref->{changesuri}."\n";
}
die unless $qajob;
More information about the Collab-qa-commits
mailing list