summaryrefslogtreecommitdiff
path: root/rt/sbin
diff options
context:
space:
mode:
Diffstat (limited to 'rt/sbin')
-rw-r--r--rt/sbin/extract-message-catalog2
-rw-r--r--rt/sbin/factory1
-rw-r--r--rt/sbin/license_tag6
-rw-r--r--rt/sbin/rt-setup-database46
-rw-r--r--rt/sbin/rt-setup-database.in46
-rw-r--r--rt/sbin/rt-test-dependencies84
-rw-r--r--rt/sbin/rt-test-dependencies.in84
7 files changed, 201 insertions, 68 deletions
diff --git a/rt/sbin/extract-message-catalog b/rt/sbin/extract-message-catalog
index af7b2c7..a7ba633 100644
--- a/rt/sbin/extract-message-catalog
+++ b/rt/sbin/extract-message-catalog
@@ -41,7 +41,7 @@ $DEBUG = 1;
$FILECAT = {};
# extract all strings and stuff them into $FILECAT
-File::Find::find( { wanted => \&extract_strings_from_code, follow => 0 }, '.' );
+File::Find::find( { wanted => \&extract_strings_from_code, follow => 1 }, '.' );
# ensure proper escaping and [_1] => %1 transformation
foreach my $str ( sort keys %{$FILECAT} ) {
diff --git a/rt/sbin/factory b/rt/sbin/factory
index 8abb192..64b0ae3 100644
--- a/rt/sbin/factory
+++ b/rt/sbin/factory
@@ -61,6 +61,7 @@ my $LicenseBlock = << '.';
#
#
# END LICENSE BLOCK
+
.
my $Attribution = << '.';
diff --git a/rt/sbin/license_tag b/rt/sbin/license_tag
index 33da2e0..689b246 100644
--- a/rt/sbin/license_tag
+++ b/rt/sbin/license_tag
@@ -5,7 +5,7 @@
#
# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
#
-# (Except where explictly superceded by other copyright notices)
+# (Except where explicitly superseded by other copyright notices)
#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
@@ -29,7 +29,7 @@ my $LICENSE = <<EOL;
Copyright (c) 1996-2003 Jesse Vincent <jesse\@bestpractical.com>
-(Except where explictly superceded by other copyright notices)
+(Except where explicitly superseded by other copyright notices)
This work is made available to you under the terms of Version 2 of
the GNU General Public License. A copy of that license should have
@@ -57,7 +57,7 @@ File::Find::find({ no_chdir => 1, wanted => \&tag_pm}, 'lib');
File::Find::find({ no_chdir => 1, wanted => \&tag_mason}, 'html');
File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'sbin');
File::Find::find({ no_chdir => 1, wanted => \&tag_script}, 'bin');
-tag_makefile ('Makefile');
+tag_makefile ('Makefile.in');
tag_makefile ('README');
diff --git a/rt/sbin/rt-setup-database b/rt/sbin/rt-setup-database
index f84f290..58f882f 100644
--- a/rt/sbin/rt-setup-database
+++ b/rt/sbin/rt-setup-database
@@ -80,7 +80,12 @@ if ( $args{'action'} eq 'init' ) {
$dbh = DBI->connect( get_system_dsn(), $args{'dba'}, $args{'dba-password'} )
|| die "Failed to connect to " . get_system_dsn() . " as $args{'dba'}: $DBI::errstr";
print "Now creating a database for RT.\n";
+ if ($RT::DatabaseType ne 'Oracle' ||
+ $args{'dba'} ne $RT::DatabaseUser) {
create_db();
+ } else {
+ print "...skipped as ".$args{'dba'} ." is not " . $RT::DatabaseUser . " or we're working with Oracle.\n";
+ }
$dbh->disconnect;
$dbh = DBI->connect( $Handle->DSN, $args{'dba'}, $args{'dba-password'} )
@@ -89,7 +94,7 @@ if ( $args{'action'} eq 'init' ) {
print "Now populating database schema.\n";
insert_schema();
print "Now inserting database ACLs\n";
- insert_acl();
+ insert_acl() unless ($RT::DatabaseType eq 'Oracle');
print "Now inserting RT core system objects\n";
insert_initial_data();
print "Now inserting RT data\n";
@@ -137,8 +142,9 @@ sub insert_schema {
open( SCHEMA_LOCAL, "<" . $RT::LocalEtcPath . "/schema." . $RT::DatabaseType );
my $statement = "";
- foreach my $line (<SCHEMA>, <SCHEMA_LOCAL>) {
+ foreach my $line (<SCHEMA>, ($_ = ';;'), <SCHEMA_LOCAL>) {
$line =~ s/\#.*//g;
+ $line =~ s/--.*//g;
$statement .= $line;
if ( $line =~ /;(\s*)$/ ) {
$statement =~ s/;(\s*)$//g;
@@ -147,10 +153,13 @@ sub insert_schema {
}
}
+ local $SIG{__WARN__} = sub {};
+ my $is_local = 0; # local/etc/schema needs to be nonfatal.
foreach my $statement (@schema) {
- print STDERR $statement if $args{'debug'};
+ if ($statement =~ /^\s*;$/) { $is_local = 1; next; }
+ print STDERR "SQL: $statement\n" if defined $args{'debug'};
my $sth = $dbh->prepare($statement) or die $dbh->errstr;
- unless ( $sth->execute ) {
+ unless ( $sth->execute or $is_local ) {
die "Problem with statement:\n $statement\n" . $sth->errstr;
}
}
@@ -168,6 +177,16 @@ sub insert_schema {
# {{{ sub drop_db
sub drop_db {
return if ( $RT::DatabaseType eq 'SQLite' );
+ if ( $RT::DatabaseType eq 'Oracle' ) {
+ print <<END;
+
+To delete the tables and sequences of the RT Oracle database by running
+ \@etc/drop.Oracle
+through SQLPlus.
+
+END
+ return;
+ }
unless ( $args{'force'} ) {
print <<END;
@@ -198,6 +217,13 @@ sub create_db {
$dbh->do("CREATE DATABASE $RT::DatabaseName") || die $DBI::errstr;
}
}
+ elsif ($RT::DatabaseType eq 'Oracle') {
+ insert_acl();
+ }
+ elsif ( $RT::DatabaseType eq 'Informix' ) {
+ $ENV{DB_LOCALE} = 'en_us.utf8';
+ $dbh->do("CREATE DATABASE $RT::DatabaseName WITH BUFFERED LOG");
+ }
else {
$dbh->do("CREATE DATABASE $RT::DatabaseName") or die $DBI::errstr;
}
@@ -248,6 +274,10 @@ sub insert_acl {
do $base_path . "/acl.mysql"
|| die "Couldn't find ACLS for mysql in " . $RT::EtcPath . "\n" . $@;
}
+ elsif ( $RT::DatabaseType =~ /^informix$/i ) {
+ do $base_path . "/acl.Informix"
+ || die "Couldn't find ACLS for Informix in " . $RT::EtcPath . "\n" . $@;
+ }
elsif ( $RT::DatabaseType =~ /^SQLite$/i ) {
return;
}
@@ -287,6 +317,10 @@ sub get_system_dsn {
elsif ( $RT::DatabaseType eq 'Pg' ) {
$dsn =~ s/dbname=$RT::DatabaseName/dbname=template1/;
}
+ elsif ( $RT::DatabaseType eq 'Informix' ) {
+ # with Informix, you want to connect sans database:
+ $dsn =~ s/Informix:$RT::DatabaseName/Informix:/;
+ }
return $dsn;
}
@@ -302,7 +336,7 @@ sub insert_initial_data {
#Put together a current user object so we can create a User object
my $CurrentUser = new RT::CurrentUser();
- print "Checking for existing system user...";
+ print "Checking for existing system user ($CurrentUser)...";
my $test_user = RT::User->new($CurrentUser);
$test_user->Load('RT_System');
if ( $test_user->id ) {
@@ -330,7 +364,7 @@ sub insert_initial_data {
exit(1);
}
print "done.\n";
- $RT::Handle->dbh->disconnect();
+ $RT::Handle->Disconnect();
}
diff --git a/rt/sbin/rt-setup-database.in b/rt/sbin/rt-setup-database.in
index e49a32e..9e990e5 100644
--- a/rt/sbin/rt-setup-database.in
+++ b/rt/sbin/rt-setup-database.in
@@ -80,7 +80,12 @@ if ( $args{'action'} eq 'init' ) {
$dbh = DBI->connect( get_system_dsn(), $args{'dba'}, $args{'dba-password'} )
|| die "Failed to connect to " . get_system_dsn() . " as $args{'dba'}: $DBI::errstr";
print "Now creating a database for RT.\n";
+ if ($RT::DatabaseType ne 'Oracle' ||
+ $args{'dba'} ne $RT::DatabaseUser) {
create_db();
+ } else {
+ print "...skipped as ".$args{'dba'} ." is not " . $RT::DatabaseUser . " or we're working with Oracle.\n";
+ }
$dbh->disconnect;
$dbh = DBI->connect( $Handle->DSN, $args{'dba'}, $args{'dba-password'} )
@@ -89,7 +94,7 @@ if ( $args{'action'} eq 'init' ) {
print "Now populating database schema.\n";
insert_schema();
print "Now inserting database ACLs\n";
- insert_acl();
+ insert_acl() unless ($RT::DatabaseType eq 'Oracle');
print "Now inserting RT core system objects\n";
insert_initial_data();
print "Now inserting RT data\n";
@@ -137,8 +142,9 @@ sub insert_schema {
open( SCHEMA_LOCAL, "<" . $RT::LocalEtcPath . "/schema." . $RT::DatabaseType );
my $statement = "";
- foreach my $line (<SCHEMA>, <SCHEMA_LOCAL>) {
+ foreach my $line (<SCHEMA>, ($_ = ';;'), <SCHEMA_LOCAL>) {
$line =~ s/\#.*//g;
+ $line =~ s/--.*//g;
$statement .= $line;
if ( $line =~ /;(\s*)$/ ) {
$statement =~ s/;(\s*)$//g;
@@ -147,10 +153,13 @@ sub insert_schema {
}
}
+ local $SIG{__WARN__} = sub {};
+ my $is_local = 0; # local/etc/schema needs to be nonfatal.
foreach my $statement (@schema) {
- print STDERR $statement if $args{'debug'};
+ if ($statement =~ /^\s*;$/) { $is_local = 1; next; }
+ print STDERR "SQL: $statement\n" if defined $args{'debug'};
my $sth = $dbh->prepare($statement) or die $dbh->errstr;
- unless ( $sth->execute ) {
+ unless ( $sth->execute or $is_local ) {
die "Problem with statement:\n $statement\n" . $sth->errstr;
}
}
@@ -168,6 +177,16 @@ sub insert_schema {
# {{{ sub drop_db
sub drop_db {
return if ( $RT::DatabaseType eq 'SQLite' );
+ if ( $RT::DatabaseType eq 'Oracle' ) {
+ print <<END;
+
+To delete the tables and sequences of the RT Oracle database by running
+ \@etc/drop.Oracle
+through SQLPlus.
+
+END
+ return;
+ }
unless ( $args{'force'} ) {
print <<END;
@@ -198,6 +217,13 @@ sub create_db {
$dbh->do("CREATE DATABASE $RT::DatabaseName") || die $DBI::errstr;
}
}
+ elsif ($RT::DatabaseType eq 'Oracle') {
+ insert_acl();
+ }
+ elsif ( $RT::DatabaseType eq 'Informix' ) {
+ $ENV{DB_LOCALE} = 'en_us.utf8';
+ $dbh->do("CREATE DATABASE $RT::DatabaseName WITH BUFFERED LOG");
+ }
else {
$dbh->do("CREATE DATABASE $RT::DatabaseName") or die $DBI::errstr;
}
@@ -248,6 +274,10 @@ sub insert_acl {
do $base_path . "/acl.mysql"
|| die "Couldn't find ACLS for mysql in " . $RT::EtcPath . "\n" . $@;
}
+ elsif ( $RT::DatabaseType =~ /^informix$/i ) {
+ do $base_path . "/acl.Informix"
+ || die "Couldn't find ACLS for Informix in " . $RT::EtcPath . "\n" . $@;
+ }
elsif ( $RT::DatabaseType =~ /^SQLite$/i ) {
return;
}
@@ -287,6 +317,10 @@ sub get_system_dsn {
elsif ( $RT::DatabaseType eq 'Pg' ) {
$dsn =~ s/dbname=$RT::DatabaseName/dbname=template1/;
}
+ elsif ( $RT::DatabaseType eq 'Informix' ) {
+ # with Informix, you want to connect sans database:
+ $dsn =~ s/Informix:$RT::DatabaseName/Informix:/;
+ }
return $dsn;
}
@@ -302,7 +336,7 @@ sub insert_initial_data {
#Put together a current user object so we can create a User object
my $CurrentUser = new RT::CurrentUser();
- print "Checking for existing system user...";
+ print "Checking for existing system user ($CurrentUser)...";
my $test_user = RT::User->new($CurrentUser);
$test_user->Load('RT_System');
if ( $test_user->id ) {
@@ -330,7 +364,7 @@ sub insert_initial_data {
exit(1);
}
print "done.\n";
- $RT::Handle->dbh->disconnect();
+ $RT::Handle->Disconnect();
}
diff --git a/rt/sbin/rt-test-dependencies b/rt/sbin/rt-test-dependencies
index 637d33a..c1591b1 100644
--- a/rt/sbin/rt-test-dependencies
+++ b/rt/sbin/rt-test-dependencies
@@ -36,10 +36,14 @@ my %args;
my %deps;
GetOptions(\%args,'install', 'with-MYSQL', 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE', 'with-ORACLE', 'with-FASTCGI', 'with-SPEEDYCGI', 'with-MODPERL1', 'with-MODPERL2' ,'with-DEV');
-if (!keys %args) {
-help();
-exit(0);
+if (!keys %args) {
+ help();
+ exit(0);
+}
+if ($args{'with-MODPERL2'}) {
+ warn_modperl2();
}
+
$args{'with-MASON'} = 1;
$args{'with-CORE'} = 1;
$args{'with-DEV'} =1;
@@ -49,10 +53,20 @@ if ($] < 5.007) {
$args{'with-I18N-COMPAT'} = 1;
}
+sub warn_modperl2 {
+ print <<'.';
+ NOTE: mod_perl 2.0 isn't quite ready for prime_time just yet;
+ Best Practical Solutions strongly recommends that sites use
+ Apache 1.3 or FastCGI. If you MUST use mod_perl 2.0 (or 1.99),
+ please read the mailing list archives before asking for help.
+.
+ sleep 5;
+}
+
sub help {
-print <<'.'
+ print <<'.';
By default, testdeps determine whether you have
installed all the perl modules RT needs to run.
@@ -81,18 +95,18 @@ sub _ {
}
$deps{'CORE'} = [ _( << '.') ];
-Digest::MD5
-DBI 1.18
+Digest::MD5 2.27
+DBI 1.37
Test::Inline
Class::ReturnValue 0.40
-DBIx::SearchBuilder 0.86
+DBIx::SearchBuilder 0.97
Text::Template
File::Spec 0.8
HTML::Entities
Net::Domain
Log::Dispatch 2.0
-Locale::Maketext 1.04
-Locale::Maketext::Lexicon 0.25
+Locale::Maketext 1.06
+Locale::Maketext::Lexicon 0.32
Locale::Maketext::Fuzzy
MIME::Entity 5.108
Mail::Mailer 1.57
@@ -102,7 +116,8 @@ Time::ParseDate
File::Temp
Term::ReadKey
Text::Autoformat
-Text::Quoted
+Text::Quoted 1.3
+Scalar::Util
.
$deps{'MASON'} = [ _( << '.') ];
@@ -113,9 +128,9 @@ HTML::Mason 1.16
MLDBM
Errno
FreezeThaw
-Digest::MD5
+Digest::MD5 2.27
CGI::Cookie 1.20
-Storable
+Storable 2.08
Apache::Session 1.53
.
@@ -138,25 +153,25 @@ WWW::Mechanize
.
$deps{'FASTCGI'} = [ _( << '.') ];
-CGI
+CGI 2.92
FCGI
CGI::Fast
.
$deps{'SPEEDYCGI'} = [ _( << '.') ];
-CGI
+CGI 2.92
CGI::SpeedyCGI
.
$deps{'MODPERL1'} = [ _( << '.') ];
-CGI
+CGI 2.92
Apache::Request
-Apache::DBI
+Apache::DBI 0.92
.
$deps{'MODPERL2'} = [ _( << '.') ];
-CGI 2.89
+CGI 2.92
Apache::DBI
.
@@ -175,6 +190,23 @@ $deps{'POSTGRESQL'} = [ _( << '.') ];
DBD::Pg
.
+print "perl:\n";
+print "\t5.8.0";
+eval {require 5.008};
+if ($@) {
+print "...missing.\n";
+ eval {require 5.006001};
+ if ($@) {
+ print " RT is known to be non-functional on versions of perl older than 5.6.1. Please upgrade to 5.8.0 or newer";
+ die;
+ } else {
+ print " RT is not supported on perl 5.6.1\n";
+ }
+} else {
+ print "...found\n";
+
+}
+
foreach my $type (keys %args) {
next unless ($type =~ /^with-(.*?)$/);
@@ -196,17 +228,17 @@ sub test_dep {
my $module = shift;
my $version = shift;
- print "\t$module $version";
- eval "use $module $version" ;
- if ($@) {
- my $error = $@;
- $error =~ s/\n(.*)$//s;
- print "...MISSING\n";
- print "\t\t$error\n" if $error =~ /this is only/;
+ print "\t$module $version";
+ eval "use $module $version" ;
+ if ($@) {
+ my $error = $@;
+ $error =~ s/\n(.*)$//s;
+ print "...MISSING\n";
+ print "\t\t$error\n" if $error =~ /this is only/;
- return undef;
+ return undef;
} else {
- print "...found\n";
+ print "...found\n";
return 1;
}
}
diff --git a/rt/sbin/rt-test-dependencies.in b/rt/sbin/rt-test-dependencies.in
index 6951290..7a15080 100644
--- a/rt/sbin/rt-test-dependencies.in
+++ b/rt/sbin/rt-test-dependencies.in
@@ -36,10 +36,14 @@ my %args;
my %deps;
GetOptions(\%args,'install', 'with-MYSQL', 'with-POSTGRESQL|with-pg|with-pgsql', 'with-SQLITE', 'with-ORACLE', 'with-FASTCGI', 'with-SPEEDYCGI', 'with-MODPERL1', 'with-MODPERL2' ,'with-DEV');
-if (!keys %args) {
-help();
-exit(0);
+if (!keys %args) {
+ help();
+ exit(0);
+}
+if ($args{'with-MODPERL2'}) {
+ warn_modperl2();
}
+
$args{'with-MASON'} = 1;
$args{'with-CORE'} = 1;
$args{'with-DEV'} =1;
@@ -49,10 +53,20 @@ if ($] < 5.007) {
$args{'with-I18N-COMPAT'} = 1;
}
+sub warn_modperl2 {
+ print <<'.';
+ NOTE: mod_perl 2.0 isn't quite ready for prime_time just yet;
+ Best Practical Solutions strongly recommends that sites use
+ Apache 1.3 or FastCGI. If you MUST use mod_perl 2.0 (or 1.99),
+ please read the mailing list archives before asking for help.
+.
+ sleep 5;
+}
+
sub help {
-print <<'.'
+ print <<'.';
By default, testdeps determine whether you have
installed all the perl modules RT needs to run.
@@ -81,18 +95,18 @@ sub _ {
}
$deps{'CORE'} = [ _( << '.') ];
-Digest::MD5
-DBI 1.18
+Digest::MD5 2.27
+DBI 1.37
Test::Inline
Class::ReturnValue 0.40
-DBIx::SearchBuilder 0.86
+DBIx::SearchBuilder 0.97
Text::Template
File::Spec 0.8
HTML::Entities
Net::Domain
Log::Dispatch 2.0
-Locale::Maketext 1.04
-Locale::Maketext::Lexicon 0.25
+Locale::Maketext 1.06
+Locale::Maketext::Lexicon 0.32
Locale::Maketext::Fuzzy
MIME::Entity 5.108
Mail::Mailer 1.57
@@ -102,7 +116,8 @@ Time::ParseDate
File::Temp
Term::ReadKey
Text::Autoformat
-Text::Quoted
+Text::Quoted 1.3
+Scalar::Util
.
$deps{'MASON'} = [ _( << '.') ];
@@ -113,9 +128,9 @@ HTML::Mason 1.16
MLDBM
Errno
FreezeThaw
-Digest::MD5
+Digest::MD5 2.27
CGI::Cookie 1.20
-Storable
+Storable 2.08
Apache::Session 1.53
.
@@ -138,25 +153,25 @@ WWW::Mechanize
.
$deps{'FASTCGI'} = [ _( << '.') ];
-CGI
+CGI 2.92
FCGI
CGI::Fast
.
$deps{'SPEEDYCGI'} = [ _( << '.') ];
-CGI
+CGI 2.92
CGI::SpeedyCGI
.
$deps{'MODPERL1'} = [ _( << '.') ];
-CGI
+CGI 2.92
Apache::Request
-Apache::DBI
+Apache::DBI 0.92
.
$deps{'MODPERL2'} = [ _( << '.') ];
-CGI 2.89
+CGI 2.92
Apache::DBI
.
@@ -175,6 +190,23 @@ $deps{'POSTGRESQL'} = [ _( << '.') ];
DBD::Pg
.
+print "perl:\n";
+print "\t5.8.0";
+eval {require 5.008};
+if ($@) {
+print "...missing.\n";
+ eval {require 5.006001};
+ if ($@) {
+ print " RT is known to be non-functional on versions of perl older than 5.6.1. Please upgrade to 5.8.0 or newer";
+ die;
+ } else {
+ print " RT is not supported on perl 5.6.1\n";
+ }
+} else {
+ print "...found\n";
+
+}
+
foreach my $type (keys %args) {
next unless ($type =~ /^with-(.*?)$/);
@@ -196,17 +228,17 @@ sub test_dep {
my $module = shift;
my $version = shift;
- print "\t$module $version";
- eval "use $module $version" ;
- if ($@) {
- my $error = $@;
- $error =~ s/\n(.*)$//s;
- print "...MISSING\n";
- print "\t\t$error\n" if $error =~ /this is only/;
+ print "\t$module $version";
+ eval "use $module $version" ;
+ if ($@) {
+ my $error = $@;
+ $error =~ s/\n(.*)$//s;
+ print "...MISSING\n";
+ print "\t\t$error\n" if $error =~ /this is only/;
- return undef;
+ return undef;
} else {
- print "...found\n";
+ print "...found\n";
return 1;
}
}