Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
049ae4ae
Commit
049ae4ae
authored
Apr 19, 2010
by
Max Kanat-Alexander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 560284: Make all errors that checksetup.pl throws be red
r=mkanat, a=mkanat (module owner)
parent
3944a53b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
47 additions
and
28 deletions
+47
-28
Constants.pm
Bugzilla/Constants.pm
+5
-0
DB.pm
Bugzilla/DB.pm
+8
-14
Mysql.pm
Bugzilla/DB/Mysql.pm
+1
-2
DB.pm
Bugzilla/Install/DB.pm
+7
-7
Requirements.pm
Bugzilla/Install/Requirements.pm
+9
-5
Util.pm
Bugzilla/Install/Util.pm
+17
-0
No files found.
Bugzilla/Constants.pm
View file @
049ae4ae
...
@@ -143,6 +143,8 @@ use File::Basename;
...
@@ -143,6 +143,8 @@ use File::Basename;
ERROR_MODE_DIE_SOAP_FAULT
ERROR_MODE_DIE_SOAP_FAULT
ERROR_MODE_JSON_RPC
ERROR_MODE_JSON_RPC
COLOR_ERROR
INSTALLATION_MODE_INTERACTIVE
INSTALLATION_MODE_INTERACTIVE
INSTALLATION_MODE_NON_INTERACTIVE
INSTALLATION_MODE_NON_INTERACTIVE
...
@@ -445,6 +447,9 @@ use constant ERROR_MODE_DIE => 1;
...
@@ -445,6 +447,9 @@ use constant ERROR_MODE_DIE => 1;
use
constant
ERROR_MODE_DIE_SOAP_FAULT
=>
2
;
use
constant
ERROR_MODE_DIE_SOAP_FAULT
=>
2
;
use
constant
ERROR_MODE_JSON_RPC
=>
3
;
use
constant
ERROR_MODE_JSON_RPC
=>
3
;
# The ANSI colors of messages that command-line scripts use
use
constant
COLOR_ERROR
=>
'red'
;
# The various modes that checksetup.pl can run in.
# The various modes that checksetup.pl can run in.
use
constant
INSTALLATION_MODE_INTERACTIVE
=>
0
;
use
constant
INSTALLATION_MODE_INTERACTIVE
=>
0
;
use
constant
INSTALLATION_MODE_NON_INTERACTIVE
=>
1
;
use
constant
INSTALLATION_MODE_NON_INTERACTIVE
=>
1
;
...
...
Bugzilla/DB.pm
View file @
049ae4ae
...
@@ -147,7 +147,7 @@ sub bz_check_requirements {
...
@@ -147,7 +147,7 @@ sub bz_check_requirements {
my
$dbd_mod
=
$dbd
->
{
module
};
my
$dbd_mod
=
$dbd
->
{
module
};
my
$dbd_ver
=
$dbd
->
{
version
};
my
$dbd_ver
=
$dbd
->
{
version
};
my
$version
=
$dbd_ver
?
" $dbd_ver or higher"
:
''
;
my
$version
=
$dbd_ver
?
" $dbd_ver or higher"
:
''
;
print
<<EOT;
die
<<EOT;
For $sql_server, Bugzilla requires that perl's $dbd_mod $dbd_ver or later be
For $sql_server, Bugzilla requires that perl's $dbd_mod $dbd_ver or later be
installed. To install this module, run the following command (as $root):
installed. To install this module, run the following command (as $root):
...
@@ -155,7 +155,6 @@ installed. To install this module, run the following command (as $root):
...
@@ -155,7 +155,6 @@ installed. To install this module, run the following command (as $root):
$command
$command
EOT
EOT
exit
;
}
}
# We don't try to connect to the actual database if $db_check is
# We don't try to connect to the actual database if $db_check is
...
@@ -178,14 +177,13 @@ EOT
...
@@ -178,14 +177,13 @@ EOT
if
(
vers_cmp
(
$sql_vers
,
$sql_want
)
>
-
1
)
{
if
(
vers_cmp
(
$sql_vers
,
$sql_want
)
>
-
1
)
{
print
"ok: found v$sql_vers\n"
if
$output
;
print
"ok: found v$sql_vers\n"
if
$output
;
}
else
{
}
else
{
print
<<EOT;
die
<<EOT;
Your $sql_server v$sql_vers is too old. Bugzilla requires version
Your $sql_server v$sql_vers is too old. Bugzilla requires version
$sql_want or later of $sql_server. Please download and install a
$sql_want or later of $sql_server. Please download and install a
newer version.
newer version.
EOT
EOT
exit
;
}
}
print
"\n"
if
$output
;
print
"\n"
if
$output
;
...
@@ -213,10 +211,9 @@ sub bz_create_database {
...
@@ -213,10 +211,9 @@ sub bz_create_database {
if
(
!
$success
)
{
if
(
!
$success
)
{
my
$error
=
$dbh
->
errstr
||
$@
;
my
$error
=
$dbh
->
errstr
||
$@
;
chomp
(
$error
);
chomp
(
$error
);
print
STDERR
"The '$db_name' database could not be created."
,
die
"The '$db_name' database could not be created."
,
" The error returned was:\n\n $error\n\n"
,
" The error returned was:\n\n $error\n\n"
,
_bz_connect_error_reasons
();
_bz_connect_error_reasons
();
exit
;
}
}
}
}
...
@@ -237,9 +234,8 @@ sub _get_no_db_connection {
...
@@ -237,9 +234,8 @@ sub _get_no_db_connection {
# Can't use $dbh->errstr because $dbh is undef.
# Can't use $dbh->errstr because $dbh is undef.
my
$error
=
$
DBI::
errstr
||
$@
;
my
$error
=
$
DBI::
errstr
||
$@
;
chomp
(
$error
);
chomp
(
$error
);
print
STDERR
"There was an error connecting to $sql_server:\n\n"
,
die
"There was an error connecting to $sql_server:\n\n"
,
" $error\n\n"
,
_bz_connect_error_reasons
();
" $error\n\n"
,
_bz_connect_error_reasons
(),
"\n"
;
exit
;
}
}
return
$dbh
;
return
$dbh
;
}
}
...
@@ -1309,13 +1305,11 @@ sub _check_references {
...
@@ -1309,13 +1305,11 @@ sub _check_references {
}
}
}
}
else
{
else
{
print
"\n"
,
get_text
(
'install_fk_invalid'
,
die
"\n"
,
get_text
(
'install_fk_invalid'
,
{
table
=>
$table
,
column
=>
$column
,
{
table
=>
$table
,
column
=>
$column
,
foreign_table
=>
$foreign_table
,
foreign_table
=>
$foreign_table
,
foreign_column
=>
$foreign_column
,
foreign_column
=>
$foreign_column
,
'values'
=>
$bad_values
}),
"\n"
;
'values'
=>
$bad_values
}),
"\n"
;
# I just picked a number above 2, to be considered "abnormal exit"
exit
3
}
}
}
}
}
}
...
...
Bugzilla/DB/Mysql.pm
View file @
049ae4ae
...
@@ -311,13 +311,12 @@ sub bz_setup_database {
...
@@ -311,13 +311,12 @@ sub bz_setup_database {
my
(
$innodb_on
)
=
@
{
$self
->
selectcol_arrayref
(
my
(
$innodb_on
)
=
@
{
$self
->
selectcol_arrayref
(
q{SHOW VARIABLES LIKE '%have_innodb%'}
,
{
Columns
=>
[
2
]})};
q{SHOW VARIABLES LIKE '%have_innodb%'}
,
{
Columns
=>
[
2
]})};
if
(
$innodb_on
ne
'YES'
)
{
if
(
$innodb_on
ne
'YES'
)
{
print
<<EOT;
die
<<EOT;
InnoDB is disabled in your MySQL installation.
InnoDB is disabled in your MySQL installation.
Bugzilla requires InnoDB to be enabled.
Bugzilla requires InnoDB to be enabled.
Please enable it and then re-run checksetup.pl.
Please enable it and then re-run checksetup.pl.
EOT
EOT
exit
3
;
}
}
...
...
Bugzilla/Install/DB.pm
View file @
049ae4ae
...
@@ -3080,11 +3080,11 @@ sub _check_content_length {
...
@@ -3080,11 +3080,11 @@ sub _check_content_length {
WHERE CHAR_LENGTH($field_name) > ?"
,
{
Columns
=>
[
1
,
2
]},
$max_length
)
};
WHERE CHAR_LENGTH($field_name) > ?"
,
{
Columns
=>
[
1
,
2
]},
$max_length
)
};
if
(
scalar
keys
%
contents
)
{
if
(
scalar
keys
%
contents
)
{
print
install_string
(
'install_data_too_long'
,
my
$error
=
install_string
(
'install_data_too_long'
,
{
column
=>
$field_name
,
{
column
=>
$field_name
,
id_column
=>
$id_field
,
id_column
=>
$id_field
,
table
=>
$table_name
,
table
=>
$table_name
,
max_length
=>
$max_length
});
max_length
=>
$max_length
});
foreach
my
$id
(
keys
%
contents
)
{
foreach
my
$id
(
keys
%
contents
)
{
my
$string
=
$contents
{
$id
};
my
$string
=
$contents
{
$id
};
# Don't dump the whole string--it could be 16MB.
# Don't dump the whole string--it could be 16MB.
...
@@ -3092,9 +3092,9 @@ sub _check_content_length {
...
@@ -3092,9 +3092,9 @@ sub _check_content_length {
$string
=
substr
(
$string
,
0
,
30
)
.
"..."
$string
=
substr
(
$string
,
0
,
30
)
.
"..."
.
substr
(
$string
,
-
30
)
.
"\n"
;
.
substr
(
$string
,
-
30
)
.
"\n"
;
}
}
print
"$id: $string\n"
;
$error
.=
"$id: $string\n"
;
}
}
exit
3
;
die
$error
;
}
}
}
}
...
...
Bugzilla/Install/Requirements.pm
View file @
049ae4ae
...
@@ -425,8 +425,11 @@ sub print_module_instructions {
...
@@ -425,8 +425,11 @@ sub print_module_instructions {
if
(
vers_cmp
(
$perl_ver
,
'5.10'
)
>
-
1
)
{
if
(
vers_cmp
(
$perl_ver
,
'5.10'
)
>
-
1
)
{
$url_to_theory58S
=
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/'
;
$url_to_theory58S
=
'http://cpan.uwinnipeg.ca/PPMPackages/10xx/'
;
}
}
print
colored
(
install_string
(
'ppm_repo_add'
,
print
colored
(
{
theory_url
=>
$url_to_theory58S
}),
'red'
);
install_string
(
'ppm_repo_add'
,
{
theory_url
=>
$url_to_theory58S
}),
COLOR_ERROR
);
# ActivePerls older than revision 819 require an additional command.
# ActivePerls older than revision 819 require an additional command.
if
(
ON_ACTIVESTATE
<
819
)
{
if
(
ON_ACTIVESTATE
<
819
)
{
print
install_string
(
'ppm_repo_up'
);
print
install_string
(
'ppm_repo_up'
);
...
@@ -459,7 +462,7 @@ sub print_module_instructions {
...
@@ -459,7 +462,7 @@ sub print_module_instructions {
}
}
if
(
my
@missing
=
@
{
$check_results
->
{
missing
}})
{
if
(
my
@missing
=
@
{
$check_results
->
{
missing
}})
{
print
colored
(
install_string
(
'commands_required'
),
'red'
)
.
"\n"
;
print
colored
(
install_string
(
'commands_required'
),
COLOR_ERROR
),
"\n"
;
foreach
my
$package
(
@missing
)
{
foreach
my
$package
(
@missing
)
{
my
$command
=
install_command
(
$package
);
my
$command
=
install_command
(
$package
);
print
" $command\n"
;
print
" $command\n"
;
...
@@ -472,7 +475,8 @@ sub print_module_instructions {
...
@@ -472,7 +475,8 @@ sub print_module_instructions {
print
install_string
(
'install_all'
,
{
perl
=>
$^X
});
print
install_string
(
'install_all'
,
{
perl
=>
$^X
});
}
}
if
(
!
$check_results
->
{
pass
})
{
if
(
!
$check_results
->
{
pass
})
{
print
colored
(
install_string
(
'installation_failed'
),
'red'
)
.
"\n\n"
;
print
colored
(
install_string
(
'installation_failed'
),
COLOR_ERROR
),
"\n\n"
;
}
}
}
}
...
@@ -565,7 +569,7 @@ sub have_vers {
...
@@ -565,7 +569,7 @@ sub have_vers {
$ok
=
"$ok:"
if
$ok
;
$ok
=
"$ok:"
if
$ok
;
my
$str
=
sprintf
"%s %19s %-9s $ok $vstr $black_string\n"
,
my
$str
=
sprintf
"%s %19s %-9s $ok $vstr $black_string\n"
,
install_string
(
'checking_for'
),
$package
,
"($want_string)"
;
install_string
(
'checking_for'
),
$package
,
"($want_string)"
;
print
$vok
?
$str
:
colored
(
$str
,
'red'
);
print
$vok
?
$str
:
colored
(
$str
,
COLOR_ERROR
);
}
}
return
$vok
?
1
:
0
;
return
$vok
?
1
:
0
;
...
...
Bugzilla/Install/Util.pm
View file @
049ae4ae
...
@@ -32,6 +32,7 @@ use File::Basename;
...
@@ -32,6 +32,7 @@ use File::Basename;
use
POSIX
qw(setlocale LC_CTYPE)
;
use
POSIX
qw(setlocale LC_CTYPE)
;
use
Safe
;
use
Safe
;
use
Scalar::
Util
qw(tainted)
;
use
Scalar::
Util
qw(tainted)
;
use
Term::
ANSIColor
qw(colored)
;
use
base
qw(Exporter)
;
use
base
qw(Exporter)
;
our
@EXPORT_OK
=
qw(
our
@EXPORT_OK
=
qw(
...
@@ -559,9 +560,25 @@ sub get_console_locale {
...
@@ -559,9 +560,25 @@ sub get_console_locale {
sub
init_console
{
sub
init_console
{
eval
{
ON_WINDOWS
&&
require
Win32::Console::
ANSI
;
};
eval
{
ON_WINDOWS
&&
require
Win32::Console::
ANSI
;
};
$ENV
{
'ANSI_COLORS_DISABLED'
}
=
1
if
(
$@
||
!-
t
*
STDOUT
);
$ENV
{
'ANSI_COLORS_DISABLED'
}
=
1
if
(
$@
||
!-
t
*
STDOUT
);
$SIG
{
__DIE__
}
=
\&
_console_die
;
prevent_windows_dialog_boxes
();
prevent_windows_dialog_boxes
();
}
}
sub
_console_die
{
my
(
$message
)
=
@_
;
# $^S means "we are in an eval"
if
(
$^S
)
{
die
$message
;
}
# Remove newlines from the message before we color it, and then
# add them back in on display. Otherwise the ANSI escape code
# for resetting the color comes after the newline, and Perl thinks
# that it should put "at Bugzilla/Install.pm line 1234" after the
# message.
$message
=~
s/\n+$//
;
die
colored
(
$message
,
COLOR_ERROR
)
.
"\n"
;
}
sub
prevent_windows_dialog_boxes
{
sub
prevent_windows_dialog_boxes
{
# This code comes from http://bugs.activestate.com/show_bug.cgi?id=82183
# This code comes from http://bugs.activestate.com/show_bug.cgi?id=82183
# and prevents Perl modules from popping up dialog boxes, particularly
# and prevents Perl modules from popping up dialog boxes, particularly
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment