[PATCH] testbot/Reconfig: Clone the Wine source repository if it is missing.

Francois Gouget fgouget at codeweavers.com
Mon Sep 16 08:32:13 CDT 2019


This simplifies setting up a new build VM.
Also trace the git commands.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/lib/Build/Utils.pm        | 14 +++++++++++---
 testbot/lib/WineTestBot/Config.pm |  8 ++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/testbot/lib/Build/Utils.pm b/testbot/lib/Build/Utils.pm
index 02253922e..57a5f4b1a 100644
--- a/testbot/lib/Build/Utils.pm
+++ b/testbot/lib/Build/Utils.pm
@@ -79,11 +79,19 @@ sub GitPull($)
 {
   my ($Dir) = @_;
 
-  InfoMsg "\nUpdating the $Dir source\n";
-  system("cd '$DataDir/$Dir' && git pull");
+  if (!-d "$DataDir/$Dir")
+  {
+    InfoMsg "\nRetrieving the $Dir source\n";
+    system("set -x && git clone $RepoURLs{$Dir}");
+  }
+  else
+  {
+    InfoMsg "\nUpdating the $Dir source\n";
+    system("cd '$DataDir/$Dir' && set -x && git pull");
+  }
   if ($? != 0)
   {
-    LogMsg "Git pull failed\n";
+    LogMsg "Git clone/pull failed\n";
     return !1;
   }
 
diff --git a/testbot/lib/WineTestBot/Config.pm b/testbot/lib/WineTestBot/Config.pm
index 7304e1075..3d9214bae 100644
--- a/testbot/lib/WineTestBot/Config.pm
+++ b/testbot/lib/WineTestBot/Config.pm
@@ -26,7 +26,7 @@ WineTestBot::Config - Site-independent configuration settings
 =cut
 
 use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir
-             $DbDataSource $DbUsername $DbPassword $MaxRevertingVMs
+             %RepoURLs $DbDataSource $DbUsername $DbPassword $MaxRevertingVMs
              $MaxRevertsWhileRunningVMs $MaxActiveVMs $MaxRunningVMs
              $MaxVMsWhenIdle $SleepAfterRevert $WaitForToolsInVM
              $VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail $RobotEMail
@@ -42,7 +42,7 @@ use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir
 
 require Exporter;
 @ISA = qw(Exporter);
- at EXPORT = qw($UseSSL $LogDir $DataDir $BinDir
+ at EXPORT = qw($UseSSL $LogDir $DataDir $BinDir %RepoURLs
              $MaxRevertingVMs $MaxRevertsWhileRunningVMs $MaxActiveVMs
              $MaxRunningVMs $MaxVMsWhenIdle $SleepAfterRevert $WaitForToolsInVM
              $VMToolTimeout $MaxVMErrors $MaxTaskTries $AdminEMail
@@ -79,6 +79,10 @@ sub PrependPaths(@)
 }
 
 
+%RepoURLs = (
+  "wine" => "git://source.winehq.org/git/wine.git",
+);
+
 # See the ScheduleOnHost() documentation in lib/WineTestBot/Jobs.pm
 $MaxRevertingVMs = 1;
 $MaxRevertsWhileRunningVMs = 0;
-- 
2.20.1




More information about the wine-devel mailing list