Francois Gouget : testbot: Add section headers and reorder the Utils.pm functions.
Alexandre Julliard
julliard at winehq.org
Wed Jun 20 17:12:28 CDT 2018
Module: tools
Branch: master
Commit: 1a1fd2c7e62bad68dcd8b7b19974e75c7aa57b5a
URL: https://source.winehq.org/git/tools.git/?a=commit;h=1a1fd2c7e62bad68dcd8b7b19974e75c7aa57b5a
Author: Francois Gouget <fgouget at codeweavers.com>
Date: Wed Jun 20 02:43:35 2018 +0200
testbot: Add section headers and reorder the Utils.pm functions.
Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
testbot/lib/WineTestBot/Utils.pm | 100 +++++++++++++++++++++------------------
1 file changed, 54 insertions(+), 46 deletions(-)
diff --git a/testbot/lib/WineTestBot/Utils.pm b/testbot/lib/WineTestBot/Utils.pm
index 81a2eda..8b0bfeb 100644
--- a/testbot/lib/WineTestBot/Utils.pm
+++ b/testbot/lib/WineTestBot/Utils.pm
@@ -35,6 +35,10 @@ use Fcntl;
use WineTestBot::Config;
+#
+# Web helpers
+#
+
sub MakeSecureURL($)
{
my ($URL) = @_;
@@ -53,6 +57,56 @@ sub SecureConnection()
return defined($ENV{"HTTPS"}) && $ENV{"HTTPS"} eq "on";
}
+sub DurationToString($;$)
+{
+ my ($Secs, $Raw) = @_;
+
+ return "n/a" if (!defined $Secs);
+
+ my @Parts;
+ if (!$Raw)
+ {
+ my $Mins = int($Secs / 60);
+ $Secs -= 60 * $Mins;
+ my $Hours = int($Mins / 60);
+ $Mins -= 60 * $Hours;
+ my $Days = int($Hours / 24);
+ $Hours -= 24 * $Days;
+ push @Parts, "${Days}d" if ($Days);
+ push @Parts, "${Hours}h" if ($Hours);
+ push @Parts, "${Mins}m" if ($Mins);
+ }
+ if (!@Parts or int($Secs) != 0)
+ {
+ push @Parts, (@Parts or int($Secs) == $Secs) ?
+ int($Secs) ."s" :
+ sprintf('%.1fs', $Secs);
+ }
+ return join(" ", @Parts);
+}
+
+sub BuildEMailRecipient($$)
+{
+ my ($EMailAddress, $Name) = @_;
+
+ if (! defined($EMailAddress))
+ {
+ return undef;
+ }
+ my $Recipient = "<" . $EMailAddress . ">";
+ if ($Name)
+ {
+ $Recipient .= " ($Name)";
+ }
+
+ return $Recipient;
+}
+
+
+#
+# Temporary file helpers
+#
+
sub GenerateRandomString($)
{
my ($Len) = @_;
@@ -119,50 +173,4 @@ sub CreateNewDir($$)
}
}
-sub DurationToString($;$)
-{
- my ($Secs, $Raw) = @_;
-
- return "n/a" if (!defined $Secs);
-
- my @Parts;
- if (!$Raw)
- {
- my $Mins = int($Secs / 60);
- $Secs -= 60 * $Mins;
- my $Hours = int($Mins / 60);
- $Mins -= 60 * $Hours;
- my $Days = int($Hours / 24);
- $Hours -= 24 * $Days;
- push @Parts, "${Days}d" if ($Days);
- push @Parts, "${Hours}h" if ($Hours);
- push @Parts, "${Mins}m" if ($Mins);
- }
- if (!@Parts or int($Secs) != 0)
- {
- push @Parts, (@Parts or int($Secs) == $Secs) ?
- int($Secs) ."s" :
- sprintf('%.1fs', $Secs);
- }
- return join(" ", @Parts);
-}
-
-sub BuildEMailRecipient($$)
-{
- my ($EMailAddress, $Name) = @_;
-
- if (! defined($EMailAddress))
- {
- return undef;
- }
- my $Recipient = "<" . $EMailAddress . ">";
- if ($Name)
- {
- $Recipient .= " ($Name)";
- }
-
- return $Recipient;
-}
-
-
1;
More information about the wine-cvs
mailing list