[PATCH 1/2] testbot/Janitor: Add DeletePath() to simplify deleting file/directories.
Francois Gouget
fgouget at codeweavers.com
Tue Jun 26 04:03:28 CDT 2018
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
testbot/bin/Janitor.pl | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl
index 9fb38efde..9252efa65 100755
--- a/testbot/bin/Janitor.pl
+++ b/testbot/bin/Janitor.pl
@@ -116,6 +116,17 @@ if (defined $Usage)
# Main
#
+sub DeletePath($)
+{
+ my ($Path) = @_;
+
+ Trace "Deleting '$Path'\n";
+ if (!$DryRun and !rmtree($Path))
+ {
+ Error "Could not delete '$Path': $!\n";
+ }
+}
+
# Delete obsolete Jobs
if ($JobPurgeDays != 0)
{
@@ -268,11 +279,7 @@ if (opendir(my $dh, "$DataDir/staging"))
{
if ($Age >= $JobPurgeDays + 7)
{
- Trace "Deleting '$FileName'\n";
- if (!$DryRun and !rmtree($FileName))
- {
- Error "Could not delete '$FileName': $!\n";
- }
+ DeletePath($FileName);
}
elsif ($Age > $JobPurgeDays)
{
@@ -282,12 +289,8 @@ if (opendir(my $dh, "$DataDir/staging"))
}
elsif ($Age >= 1)
{
- Trace "Deleting '$FileName'\n";
- if (!$DryRun and !unlink $FileName)
- {
- # The user abandoned the submit procedure half-way through
- Error "Could not delete '$FileName': $!\n";
- }
+ # The user abandoned the submit procedure half-way through
+ DeletePath($FileName);
}
}
}
--
2.18.0
More information about the wine-devel
mailing list