Francois Gouget : testbot/lib: Merge Patches::NewSubmission() and Patches:: NewPatch().

Alexandre Julliard julliard at winehq.org
Thu Aug 30 14:33:57 CDT 2012


Module: tools
Branch: master
Commit: 4f19013f91e0a3dcc0c4cb9bc84c54a100e74ea7
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=4f19013f91e0a3dcc0c4cb9bc84c54a100e74ea7

Author: Francois Gouget <fgouget at codeweavers.com>
Date:   Thu Aug 30 16:28:58 2012 +0200

testbot/lib: Merge Patches::NewSubmission() and Patches::NewPatch().

---

 testbot/bin/Engine.pl              |    4 +-
 testbot/lib/WineTestBot/Patches.pm |   88 +----------------------------------
 2 files changed, 5 insertions(+), 87 deletions(-)

diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index 488c8eb..422e810 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -297,7 +297,7 @@ sub HandleNewWinePatchesSubmission
   my $Parser = new MIME::Parser;
   $Parser->output_dir($WorkDir);
   my $Entity = $Parser->parse_open($FullMessageFileName);
-  CreatePatches()->NewSubmission($Entity);
+  CreatePatches()->NewPatch($Entity);
 
   # Clean up
   system("rm -rf $WorkDir");
@@ -401,7 +401,7 @@ sub HandlePatchRetrieved
   my $Parser = new MIME::Parser;
   $Parser->output_dir($WorkDir);
   my $Entity = $Parser->parse_open($FullFileName);
-  my $ErrMessage = CreatePatches()->NewPatch($PatchId, $Entity);
+  my $ErrMessage = CreatePatches()->NewPatch($Entity, $PatchId);
 
   # Clean up
   system("rm -rf $WorkDir");
diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm
index 5689399..bce6161 100644
--- a/testbot/lib/WineTestBot/Patches.pm
+++ b/testbot/lib/WineTestBot/Patches.pm
@@ -1,6 +1,7 @@
 # Patch collection and items
 #
 # Copyright 2010 Ge van Geldorp
+# Copyright 2012 Francois Gouget
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -363,96 +364,13 @@ sub IsTestPatch
   return !1;
 }
 
-sub NewSubmission
-{
-  my $self = shift;
-  my $MsgEntity = $_[0];
-
-  my $Patch = $self->Add();
-  $Patch->FromSubmission($MsgEntity);
-
-  my @PatchBodies;
-  foreach my $Part ($MsgEntity->parts_DFS)
-  {
-    if (defined($Part->bodyhandle))
-    {
-      if ($Part->effective_type ne "text/html" &&
-          $self->IsPatch($Part->bodyhandle))
-      {
-        $PatchBodies[scalar(@PatchBodies)] = $Part->bodyhandle;
-      }
-      else
-      {
-        $Part->bodyhandle->purge();
-      }
-    }
-  }
-
-  my $ErrMessage;
-  if (scalar(@PatchBodies) == 1)
-  {
-    $Patch->AffectsTests($self->IsTestPatch($PatchBodies[0]));
-    my $Subject = $Patch->Subject;
-    $Subject =~ s/32\/64//;
-    $Subject =~ s/64\/32//;
-    if ($Subject =~ m/\d+\/\d+/)
-    {
-      $Patch->Disposition("Checking series");
-      my $ErrKey;
-      my $ErrProperty;
-      ($ErrKey, $ErrProperty, $ErrMessage) = $self->Save();
-      link($PatchBodies[0]->path, "$DataDir/patches/" . $Patch->Id);
-      if (! defined($ErrMessage))
-      {
-        $ErrMessage = WineTestBot::PendingPatchSets::CreatePendingPatchSets()->NewSubmission($Patch);
-      }
-    }
-    else
-    {
-      $Patch->Disposition("Checking patch");
-      my $ErrKey;
-      my $ErrProperty;
-      ($ErrKey, $ErrProperty, $ErrMessage) = $self->Save();
-      link($PatchBodies[0]->path, "$DataDir/patches/" . $Patch->Id);
-      if (! defined($ErrMessage))
-      {
-        $ErrMessage = $Patch->Submit($PatchBodies[0]->path, !1);
-      }
-    }
-  }
-  elsif (scalar(@PatchBodies) == 0)
-  {
-    $Patch->Disposition("No patch found");
-  }
-  else
-  {
-    $Patch->Disposition("Message contains multiple patches");
-  }
-
-  foreach my $PatchBody (@PatchBodies)
-  {
-    $PatchBody->purge();
-  }
-  
-  if (! defined($ErrMessage))
-  {
-    my ($ErrKey, $ErrProperty, $ErrMessage) = $self->Save();
-    if (defined($ErrMessage))
-    {
-      return $ErrMessage;
-    }
-  }
-
-  return undef;
-}
-
 sub NewPatch
 {
   my $self = shift;
-  my ($PatchId, $MsgEntity) = @_;
+  my ($MsgEntity, $PatchId) = @_;
 
   my $Patch = $self->Add();
-  $Patch->Id($PatchId);
+  $Patch->Id($PatchId) if (defined $PatchId);
   $Patch->FromSubmission($MsgEntity);
 
   my @PatchBodies;




More information about the wine-cvs mailing list