Francois Gouget : testbot/Janitor: Clean up the latest directory too.
Alexandre Julliard
julliard at winehq.org
Tue Jun 26 09:45:37 CDT 2018
Module: tools
Branch: master
Commit: f1b2a7ed3b7399390eaa4a7c85d341df5b295b44
URL: https://source.winehq.org/git/tools.git/?a=commit;h=f1b2a7ed3b7399390eaa4a7c85d341df5b295b44
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Tue Jun 26 11:03:41 2018 +0200
testbot/Janitor: Clean up the latest directory too.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/bin/Janitor.pl | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl
index 9252efa..a9cdd52 100755
--- a/testbot/bin/Janitor.pl
+++ b/testbot/bin/Janitor.pl
@@ -299,6 +299,52 @@ else
Error "Unable to open '$DataDir/staging': $!";
}
+# Check the content of the latest directory
+if (opendir(my $dh, "$DataDir/latest"))
+{
+ # We will be deleting files so read the directory in one go
+ my @Entries = readdir($dh);
+ close($dh);
+
+ my $AllVMs = $VMs->Clone();
+ foreach my $Entry (@Entries)
+ {
+ next if ($Entry eq "." or $Entry eq "..");
+ $Entry =~ m%^([^/]+)$%;
+ my $FileName = "$DataDir/latest/$1";
+ my $Age = int((-M $FileName) + 0.5);
+
+ if ($Entry =~ /^(.*)_[a-z0-9]+\.(?:err|log)$/)
+ {
+ # Keep the reference WineTest reports for all VMs even if they are
+ # retired or scheduled for deletion.
+ my $VMName = $1;
+ next if ($AllVMs->GetItem($VMName));
+ }
+ elsif ($Entry =~ /^(?:TestLauncher[0-9]*\.exe|winefiles.txt|winetest[0-9]*-latest\.exe)$/)
+ {
+ next;
+ }
+
+ Trace "Found a suspicious latest file: $Entry\n";
+ if ($JobPurgeDays != 0)
+ {
+ if ($Age >= $JobPurgeDays + 7)
+ {
+ DeletePath($FileName);
+ }
+ elsif ($Age > $JobPurgeDays)
+ {
+ Trace "'$FileName' will be deleted in ", $JobPurgeDays + 7 - $Age, " day(s).\n";
+ }
+ }
+ }
+}
+else
+{
+ Error "Unable to open '$DataDir/latest': $!";
+}
+
# Delete obsolete record groups
if ($JobPurgeDays != 0)
{
More information about the wine-cvs
mailing list