mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
- added more files to support-files/MacOSX and added them to the
distribution - added Bootstrap, logger.pm and Do-pkg to Build-tools: Bootstrap is used to build the source distribution for the binary builds logger.pm includes some helper functions Do-pkg converts a binary distribution into a Mac OS X PKG (still needs some polishing)
This commit is contained in:
51
Build-tools/logger.pm
Normal file
51
Build-tools/logger.pm
Normal file
@ -0,0 +1,51 @@
|
||||
#
|
||||
# Create a log entry
|
||||
#
|
||||
sub logger
|
||||
{
|
||||
my $message=$_[0];
|
||||
print timestamp() . " " . $message . "\n" if $opt_verbose;
|
||||
if (defined $opt_log && !$opt_dry_run)
|
||||
{
|
||||
open LOG, ">>$logfile" or die "Can't open logfile $logfile!";
|
||||
print LOG timestamp() . " " . $message . "\n";
|
||||
close LOG;
|
||||
}
|
||||
}
|
||||
|
||||
# Create a time stamp for logging purposes
|
||||
sub timestamp
|
||||
{
|
||||
return &ymd() . " " . &hms();
|
||||
}
|
||||
|
||||
#
|
||||
# return the current time as a string (HH:MM:SS)
|
||||
#
|
||||
sub hms
|
||||
{
|
||||
my @ta= localtime(time());
|
||||
my $h= $ta[2];
|
||||
$h= "0" . "$h" if ($h <= 9);
|
||||
my $m= $ta[1];
|
||||
$m= "0" . "$m" if ($m <= 9);
|
||||
my $s= $ta[0];
|
||||
$s="0" . "$s" if ($s <= 9);
|
||||
|
||||
return "$h:$m:$s";
|
||||
}
|
||||
|
||||
#
|
||||
# return the current date as a string (YYYYMMDD)
|
||||
#
|
||||
sub ymd
|
||||
{
|
||||
my @ta=localtime(time());
|
||||
my $d=$ta[3];
|
||||
$d="0" . "$d" if ($d <= 9);
|
||||
my $m=$ta[4]+1;
|
||||
$m="0" . "$m" if ($m <= 9);
|
||||
my $y=1900+$ta[5];
|
||||
|
||||
return "$y$m$d";
|
||||
}
|
Reference in New Issue
Block a user