[PATCH] testbot/WineReconfig: Make sure not to leave obsolete wineprefixes behind.

Francois Gouget fgouget at codeweavers.com
Thu Oct 18 04:12:54 CDT 2018


Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/build/WineReconfig.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/testbot/bin/build/WineReconfig.pl b/testbot/bin/build/WineReconfig.pl
index 2416eebfa4..63d72e89d3 100755
--- a/testbot/bin/build/WineReconfig.pl
+++ b/testbot/bin/build/WineReconfig.pl
@@ -37,6 +37,9 @@ sub BEGIN
   $::BuildEnv = 1;
 }
 
+use File::Basename;
+use File::Path;
+
 use Build::Utils;
 use WineTestBot::Config;
 
@@ -95,6 +98,16 @@ sub UpdateWinePrefixes($)
 {
   my ($Targets) = @_;
 
+  # Make sure no obsolete wineprefix is left behind in case WineReconfig
+  # is called with a different set of targets
+  foreach my $Dir (glob("'$DataDir/wineprefix-*'"))
+  {
+    if (basename($Dir) =~ /^(wineprefix-[a-zA-Z0-9\@_.-]+)$/) # untaint
+    {
+      rmtree("$DataDir/$1");
+    }
+  }
+
   # Set up brand new WinePrefixes ready for use for testing.
   # This way we do it once instead of doing it for every test, thus saving
   # time. Note that this requires using a different wineprefix for each build.
-- 
2.19.1



More information about the wine-devel mailing list