Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/WineTestBot/Patches.pm | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm index 4f428133f..e349dfe88 100644 --- a/testbot/lib/WineTestBot/Patches.pm +++ b/testbot/lib/WineTestBot/Patches.pm @@ -166,7 +166,6 @@ sub Submit($$$)
# Create a new job for this patch my $NewJob = $Jobs->Add(); - $NewJob->Status("queued"); $NewJob->User($User); $NewJob->Priority(6); my $PropertyDescriptor = $Jobs->GetPropertyDescriptorByName("Remarks"); @@ -181,11 +180,9 @@ sub Submit($$$) # Add build step to the job my $Steps = $NewJob->Steps; my $NewStep = $Steps->Add(); - # Create a link to the patch file in the staging dir - my $StagingFileName = CreateNewLink($PatchFileName, "$DataDir/staging", "_patch.diff"); - $NewStep->FileName(basename($StagingFileName)); + $NewStep->FileName("patch.diff"); $NewStep->FileType($TestInfo->{Type}); - $NewStep->InStaging(1); + $NewStep->InStaging(!1); $NewStep->Type("build"); $NewStep->DebugLevel(0);
@@ -198,7 +195,7 @@ sub Submit($$$) $Task->VM($BuildVM); $Task->Timeout($BuildTimeout);
- # Save this step (&job+task) so the others can reference it + # Save the build step so other steps can reference it my ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save(); if (defined($ErrMessage)) { @@ -206,6 +203,13 @@ sub Submit($$$) return $ErrMessage; }
+ # Stage the patch so it can be picked up by the job + if (!link($PatchFileName, "$DataDir/staging/job". $NewJob->Id ."_patch.diff")) + { + $self->Disposition("Failed to prepare patch file"); + return $!; + } + foreach my $Unit (sort keys %{$TestInfo->{Units}}) { # Add 32 and 64-bit tasks @@ -217,7 +221,7 @@ sub Submit($$$) if (@{$VMs->GetKeys()}) { # Create the corresponding Step - $NewStep = $Steps->Add(); + my $NewStep = $Steps->Add(); $NewStep->PreviousNo(1); my $FileName = $TestInfo->{ExeBase}; $FileName .= "64" if ($Bits eq "64"); @@ -240,13 +244,23 @@ sub Submit($$$) } }
+ # Save it all ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save(); - if (defined($ErrMessage)) + if (defined $ErrMessage) { $self->Disposition("Failed to submit job"); return $ErrMessage; }
+ # Switch Status to staging to indicate we are done setting up the job + $NewJob->Status("staging"); + ($ErrKey, $ErrProperty, $ErrMessage) = $Jobs->Save(); + if (defined $ErrMessage) + { + $self->Disposition("Failed to submit job (staging)"); + return $ErrMessage; + } + if ($First) { $First = !1;