forked from lix-project/hydra
Merge branch 'queue-17'
This commit is contained in:
parent
9eaaa0c1e9
commit
8fb3d901cb
|
@ -6,7 +6,7 @@ use File::Basename;
|
|||
use POSIX qw(dup2 :sys_wait_h);
|
||||
use Hydra::Schema;
|
||||
use Hydra::Helper::Nix;
|
||||
|
||||
use Nix;
|
||||
|
||||
chdir getHydraPath or die;
|
||||
my $db = openHydraDB;
|
||||
|
@ -50,6 +50,21 @@ sub unlockDeadBuilds {
|
|||
});
|
||||
}
|
||||
|
||||
sub findBuildDependencyInQueue {
|
||||
my ($build) = @_;
|
||||
my $drvpath = $build->drvpath;
|
||||
my @paths = reverse(split '\n', `nix-store -qR $drvpath`);
|
||||
|
||||
foreach my $path (@paths) {
|
||||
if($path ne $drvpath) {
|
||||
(my $depBuild) = $db->resultset('Builds')->search(
|
||||
{ drvpath => $path, finished => 0, busy => 0, enabled => 1, disabled => 0 },
|
||||
{ join => ['schedulingInfo', 'project'], rows => 1 } ) ;
|
||||
return $depBuild if defined $depBuild;
|
||||
}
|
||||
}
|
||||
return $build ;
|
||||
}
|
||||
|
||||
sub checkBuilds {
|
||||
print "looking for runnable builds...\n";
|
||||
|
@ -90,6 +105,8 @@ sub checkBuilds {
|
|||
"starting ", scalar(@builds), " builds\n";
|
||||
|
||||
foreach my $build (@builds) {
|
||||
$build = findBuildDependencyInQueue($build);
|
||||
|
||||
my $logfile = getcwd . "/logs/" . $build->id;
|
||||
mkdir(dirname $logfile);
|
||||
unlink($logfile);
|
||||
|
|
Loading…
Reference in a new issue