mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-05 20:07:54 +00:00
Final update-modules before the release
This commit is contained in:
@@ -3953,12 +3953,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -4005,7 +4006,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -4020,6 +4021,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4855,7 +4858,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -3068,12 +3068,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3120,7 +3121,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3135,6 +3136,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -3970,7 +3973,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -2512,12 +2512,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -2564,7 +2565,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -2579,6 +2580,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -3414,7 +3417,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -3623,12 +3623,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3675,7 +3676,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3690,6 +3691,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4525,7 +4528,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -3469,12 +3469,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3521,7 +3522,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3536,6 +3537,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4371,7 +4374,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,17 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
Daemon
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +57,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +299,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +438,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +979,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
15
bin/pt-find
15
bin/pt-find
@@ -2309,12 +2309,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -2361,7 +2362,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -2376,6 +2377,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -3211,7 +3214,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,18 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
QueryParser
|
||||
QueryRewriter
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +58,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +300,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +439,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +980,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
@@ -2216,12 +2216,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -2268,7 +2269,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -2283,6 +2284,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -3118,7 +3121,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -3393,12 +3393,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3445,7 +3446,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3460,6 +3461,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4295,7 +4298,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -4975,12 +4975,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -5027,7 +5028,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -5042,6 +5043,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -5877,7 +5880,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
15
bin/pt-kill
15
bin/pt-kill
@@ -4984,12 +4984,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -5036,7 +5037,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -5051,6 +5052,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -5886,7 +5889,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,22 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
SlowLogParser
|
||||
BinaryLogParser
|
||||
GeneralLogParser
|
||||
LogSplitter
|
||||
DSNParser
|
||||
Daemon
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +62,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +304,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +443,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +984,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
@@ -6006,12 +6006,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -6058,7 +6059,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -6073,6 +6074,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -6908,7 +6911,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6160,12 +6160,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -6212,7 +6213,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -6227,6 +6228,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -7062,7 +7065,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -12009,12 +12009,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -12061,7 +12062,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -12076,6 +12077,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -12911,7 +12914,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,18 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
DSNParser
|
||||
Daemon
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +58,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +300,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +439,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +980,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
@@ -2625,12 +2625,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -2677,7 +2678,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -2692,6 +2693,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -3527,7 +3530,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,22 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
Mo
|
||||
DSNParser
|
||||
MasterSlave
|
||||
Daemon
|
||||
VersionParser
|
||||
Transformers
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +62,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +304,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +443,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +984,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
@@ -3248,12 +3248,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3300,7 +3301,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3315,6 +3316,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4150,7 +4153,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -906,18 +906,21 @@ fio_status_minus_a () {
|
||||
print "${adapter}_modules @connected_modules";
|
||||
|
||||
for my $module (@connected_modules) {
|
||||
my ($attached, $general, $firmware, $temperature, $media_status) = /
|
||||
my ($rest, $attached, $general, $firmware, $temperature, $media_status) = /(
|
||||
^ \s* $module \s+ (Attached[^\n]+) \n
|
||||
\s+ ([^\n]+) \n # All the second line
|
||||
.+? (Firmware\s+[^\n]+) \n
|
||||
.+? (Internal \s+ temperature:[^\n]+) \n
|
||||
.+? ((?:Media | Reserve \s+ space) \s+ status:[^\n]+)
|
||||
/xsm;
|
||||
.+? ((?:Media | Reserve \s+ space) \s+ status:[^\n]+) \n
|
||||
.+?(?:\n\n|\z)
|
||||
)/xsm;
|
||||
my ($pbw) = $rest =~ /.+?(Rated \s+ PBW:[^\n]+)/xsm;
|
||||
print "${adapter}_${module}_attached_as $attached";
|
||||
print "${adapter}_${module}_general $general";
|
||||
print "${adapter}_${module}_firmware $firmware";
|
||||
print "${adapter}_${module}_media_status $media_status";
|
||||
print "${adapter}_${module}_temperature $temperature";
|
||||
print "${adapter}_${module}_rated_pbw $pbw" if $pbw;
|
||||
}
|
||||
} while <>;
|
||||
|
||||
@@ -2080,6 +2083,9 @@ report_fio_minus_a () {
|
||||
name_val "" "$(get_var "${adapter}_${module}_firmware" "$file")"
|
||||
name_val "" "$(get_var "${adapter}_${module}_temperature" "$file")"
|
||||
name_val "" "$(get_var "${adapter}_${module}_media_status" "$file")"
|
||||
if [ "$(get_var "${adapter}_${module}_rated_pbw" "$file")" ]; then
|
||||
name_val "" "$(get_var "${adapter}_${module}_rated_pbw" "$file")"
|
||||
fi
|
||||
local NAME_VAL_LEN=$name_val_len_orig;
|
||||
done
|
||||
done
|
||||
|
@@ -174,12 +174,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -226,7 +227,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -241,6 +242,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -1076,7 +1079,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -6,7 +6,21 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
Transformers
|
||||
Progress
|
||||
FileIterator
|
||||
SimpleTCPDumpParser
|
||||
TCPRequestAggregator
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +61,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +303,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +442,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +983,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
29
bin/pt-trend
29
bin/pt-trend
@@ -6,7 +6,21 @@
|
||||
|
||||
use strict;
|
||||
use warnings FATAL => 'all';
|
||||
use constant PTDEBUG => $ENV{PTDEBUG} || 0;
|
||||
|
||||
# This tool is "fat-packed": most of its dependent modules are embedded
|
||||
# in this file. Setting %INC to this file for each module makes Perl aware
|
||||
# of this so it will not try to load the module from @INC. See the tool's
|
||||
# documentation for a full list of dependencies.
|
||||
BEGIN {
|
||||
$INC{$_} = __FILE__ for map { (my $pkg = "$_.pm") =~ s!::!/!g; $pkg } (qw(
|
||||
OptionParser
|
||||
Daemon
|
||||
Progress
|
||||
FileIterator
|
||||
TimeSeriesTrender
|
||||
Transformers
|
||||
));
|
||||
}
|
||||
|
||||
# ###########################################################################
|
||||
# OptionParser package
|
||||
@@ -47,6 +61,7 @@ sub new {
|
||||
'default' => 1,
|
||||
'cumulative' => 1,
|
||||
'negatable' => 1,
|
||||
'value_is_optional' => 1,
|
||||
);
|
||||
|
||||
my $self = {
|
||||
@@ -288,9 +303,10 @@ sub _parse_specs {
|
||||
$opt->{short} = undef;
|
||||
}
|
||||
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
$opt->{is_negatable} = $opt->{spec} =~ m/!/ ? 1 : 0;
|
||||
$opt->{is_cumulative} = $opt->{spec} =~ m/\+/ ? 1 : 0;
|
||||
$opt->{optional_value} = $opt->{spec} =~ m/:/ ? 1 : 0;
|
||||
$opt->{is_required} = $opt->{desc} =~ m/required/ ? 1 : 0;
|
||||
|
||||
$opt->{group} ||= 'default';
|
||||
$self->{groups}->{ $opt->{group} }->{$long} = 1;
|
||||
@@ -426,7 +442,7 @@ sub _set_option {
|
||||
if ( $opt->{is_cumulative} ) {
|
||||
$opt->{value}++;
|
||||
}
|
||||
else {
|
||||
elsif ( !($opt->{optional_value} && !$val) ) {
|
||||
$opt->{value} = $val;
|
||||
}
|
||||
$opt->{got} = 1;
|
||||
@@ -967,11 +983,12 @@ sub _parse_size {
|
||||
sub _parse_attribs {
|
||||
my ( $self, $option, $attribs ) = @_;
|
||||
my $types = $self->{types};
|
||||
my $eq = $attribs->{'value_is_optional'} ? ':' : '=';
|
||||
return $option
|
||||
. ($attribs->{'short form'} ? '|' . $attribs->{'short form'} : '' )
|
||||
. ($attribs->{'negatable'} ? '!' : '' )
|
||||
. ($attribs->{'cumulative'} ? '+' : '' )
|
||||
. ($attribs->{'type'} ? '=' . $types->{$attribs->{type}} : '' );
|
||||
. ($attribs->{'type'} ? $eq . $types->{$attribs->{type}} : '' );
|
||||
}
|
||||
|
||||
sub _parse_synopsis {
|
||||
|
@@ -4815,7 +4815,7 @@ sub make_fetch_back_query {
|
||||
map {
|
||||
my $col = $_;
|
||||
if ( $self->{hex_blob}
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/blob|text|binary/ ) {
|
||||
&& $tbl_struct->{type_for}->{$col} =~ m/b(?:lob|inary)/ ) {
|
||||
$col = "IF(BINARY(`$col`)='', '', CONCAT('0x', HEX(`$col`))) AS `$col`";
|
||||
}
|
||||
else {
|
||||
@@ -10450,12 +10450,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -10502,7 +10503,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -10517,6 +10518,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -11352,7 +11355,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
@@ -3537,12 +3537,13 @@ sub valid_item {
|
||||
sub get_os_version {
|
||||
my ($self) = @_;
|
||||
|
||||
if ( $OSNAME eq 'MSWin32' ) {
|
||||
require Win32;
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
|
||||
chomp(my $platform = `uname -s`);
|
||||
PTDEBUG && _d('platform:', $platform);
|
||||
if ( !$platform ) {
|
||||
return $OSNAME if $OSNAME ne 'MSWin32';
|
||||
return Win32::GetOSDisplayName();
|
||||
}
|
||||
return $OSNAME unless $platform;
|
||||
|
||||
chomp(my $lsb_release
|
||||
@@ -3589,7 +3590,7 @@ sub get_os_version {
|
||||
}
|
||||
}
|
||||
}
|
||||
elsif ( $platform =~ m/^(BSD|Darwin)$/ ) {
|
||||
elsif ( $platform =~ m/(?:BSD|^Darwin)$/ ) {
|
||||
my $rel = `uname -r`;
|
||||
$release = "$platform $rel";
|
||||
}
|
||||
@@ -3604,6 +3605,8 @@ sub get_os_version {
|
||||
}
|
||||
chomp($release);
|
||||
|
||||
$release =~ s/^"|"$//g;
|
||||
|
||||
PTDEBUG && _d('OS version =', $release);
|
||||
return $release;
|
||||
}
|
||||
@@ -4439,7 +4442,7 @@ sub update_checks_file {
|
||||
|
||||
sub _touch {
|
||||
my ($file) = @_;
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT|O_NONBLOCK
|
||||
sysopen my $fh, $file, O_WRONLY|O_CREAT
|
||||
or die "Cannot create $file : $!";
|
||||
close $fh or die "Cannot close $file : $!";
|
||||
utime(undef, undef, $file);
|
||||
|
Reference in New Issue
Block a user