[Rt-commit] rt branch, 3.8-trunk, updated. rt-3.8.5-178-gbd456fc

Ruslan Zakirov ruz at bestpractical.com
Tue Sep 29 17:48:22 EDT 2009


The branch, 3.8-trunk has been updated
       via  bd456fc5e712e1cebb8c53f7ba3f9ea65d2cfb7a (commit)
       via  9c518399495dcaf4877902b0335eafac89460151 (commit)
       via  6cad39ad71694cd86de7caf4af7189bcb68f2fc2 (commit)
       via  d57f18aef33715b64ebefb715c778a8073f87bcc (commit)
       via  1cb615cf3f2da7dc49cd7db2420ed589acf8e7b2 (commit)
       via  c6f4d077494b9790aa85fb43e4b9fd357fe5c4d0 (commit)
       via  1a224d9e1e10c44dbf1ff08fa187fa464b562622 (commit)
      from  cfe9758ece6021697b114b6d27c0e4434fe78649 (commit)

Summary of changes:
 Makefile.in                               |    2 +-
 bin/webmux.pl.in                          |    5 +-
 configure.ac                              |    3 +-
 lib/RT/Test.pm                            |  175 +++++++++++++++++++++++++----
 share/html/Search/Results.tsv             |    1 +
 share/html/Ticket/ModifyAll.html          |    4 +-
 share/html/Ticket/ModifyDates.html        |    1 +
 share/html/Ticket/ModifyLinks.html        |    1 +
 share/html/Ticket/ModifyPeople.html       |    1 +
 t/data/configs/apache2.2+mod_perl.conf.in |   99 ++++++++++++++++
 10 files changed, 265 insertions(+), 27 deletions(-)
 create mode 100644 t/data/configs/apache2.2+mod_perl.conf.in

- Log -----------------------------------------------------------------
commit 1a224d9e1e10c44dbf1ff08fa187fa464b562622
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Fri Sep 25 05:45:56 2009 +0400

    init handler later otherwise it may failure plugins loading

diff --git a/bin/webmux.pl.in b/bin/webmux.pl.in
index 827632d..7e61b27 100755
--- a/bin/webmux.pl.in
+++ b/bin/webmux.pl.in
@@ -124,7 +124,6 @@ BEGIN {
 
 use RT::Interface::Web;
 use RT::Interface::Web::Handler;
-$Handler = RT::Interface::Web::Handler->new(RT->Config->Get('MasonParameters'));
 
 if ($ENV{'MOD_PERL'} && !RT->Config->Get('DevelMode')) {
     # Under static_source, we need to purge the component cache
@@ -158,6 +157,10 @@ sub handler {
 
     RT::Init();
 
+    $Handler ||= RT::Interface::Web::Handler->new(
+        RT->Config->Get('MasonParameters')
+    );
+
     my %session;
     my $status;
     eval { $status = $Handler->handle_request($r) };

commit c6f4d077494b9790aa85fb43e4b9fd357fe5c4d0
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Sep 28 14:48:16 2009 +0400

    config for testing RT with apache 2.2 and mod_perl

diff --git a/t/data/configs/apache2.2+mod_perl.conf.in b/t/data/configs/apache2.2+mod_perl.conf.in
new file mode 100644
index 0000000..d347efa
--- /dev/null
+++ b/t/data/configs/apache2.2+mod_perl.conf.in
@@ -0,0 +1,99 @@
+ServerRoot %%SERVER_ROOT%%
+ServerAdmin root at localhost
+#LoadModule authn_file_module modules/mod_authn_file.so
+#LoadModule authn_dbm_module modules/mod_authn_dbm.so
+#LoadModule authn_anon_module modules/mod_authn_anon.so
+#LoadModule authn_dbd_module modules/mod_authn_dbd.so
+#LoadModule authn_default_module modules/mod_authn_default.so
+LoadModule authz_host_module modules/mod_authz_host.so
+#LoadModule authz_groupfile_module modules/mod_authz_groupfile.so
+#LoadModule authz_user_module modules/mod_authz_user.so
+#LoadModule authz_dbm_module modules/mod_authz_dbm.so
+#LoadModule authz_owner_module modules/mod_authz_owner.so
+#LoadModule authz_default_module modules/mod_authz_default.so
+#LoadModule auth_basic_module modules/mod_auth_basic.so
+#LoadModule auth_digest_module modules/mod_auth_digest.so
+#LoadModule file_cache_module modules/mod_file_cache.so
+#LoadModule cache_module modules/mod_cache.so
+#LoadModule disk_cache_module modules/mod_disk_cache.so
+#LoadModule mem_cache_module modules/mod_mem_cache.so
+#LoadModule dbd_module modules/mod_dbd.so
+#LoadModule dumpio_module modules/mod_dumpio.so
+#LoadModule ext_filter_module modules/mod_ext_filter.so
+#LoadModule include_module modules/mod_include.so
+#LoadModule filter_module modules/mod_filter.so
+#LoadModule substitute_module modules/mod_substitute.so
+#LoadModule deflate_module modules/mod_deflate.so
+LoadModule log_config_module modules/mod_log_config.so
+#LoadModule log_forensic_module modules/mod_log_forensic.so
+#LoadModule logio_module modules/mod_logio.so
+LoadModule env_module modules/mod_env.so
+#LoadModule mime_magic_module modules/mod_mime_magic.so
+#LoadModule cern_meta_module modules/mod_cern_meta.so
+#LoadModule expires_module modules/mod_expires.so
+#LoadModule headers_module modules/mod_headers.so
+#LoadModule ident_module modules/mod_ident.so
+#LoadModule usertrack_module modules/mod_usertrack.so
+#LoadModule unique_id_module modules/mod_unique_id.so
+#LoadModule setenvif_module modules/mod_setenvif.so
+#LoadModule version_module modules/mod_version.so
+#LoadModule proxy_module modules/mod_proxy.so
+#LoadModule proxy_connect_module modules/mod_proxy_connect.so
+#LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
+#LoadModule proxy_http_module modules/mod_proxy_http.so
+#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
+#LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
+#LoadModule ssl_module modules/mod_ssl.so
+#LoadModule mime_module modules/mod_mime.so
+#LoadModule dav_module modules/mod_dav.so
+#LoadModule status_module modules/mod_status.so
+#LoadModule autoindex_module modules/mod_autoindex.so
+#LoadModule asis_module modules/mod_asis.so
+#LoadModule info_module modules/mod_info.so
+#LoadModule cgi_module modules/mod_cgi.so
+#LoadModule dav_fs_module modules/mod_dav_fs.so
+#LoadModule vhost_alias_module modules/mod_vhost_alias.so
+#LoadModule negotiation_module modules/mod_negotiation.so
+#LoadModule dir_module modules/mod_dir.so
+#LoadModule imagemap_module modules/mod_imagemap.so
+#LoadModule actions_module modules/mod_actions.so
+#LoadModule speling_module modules/mod_speling.so
+#LoadModule userdir_module modules/mod_userdir.so
+LoadModule alias_module modules/mod_alias.so
+#LoadModule rewrite_module modules/mod_rewrite.so
+#LoadModule rewrite_module modules/mod_rewrite.so
+LoadModule perl_module modules/mod_perl.so
+
+<IfModule !mpm_netware_module>
+<IfModule !mpm_winnt_module>
+User @WEB_USER@
+Group @WEB_GROUP@
+</IfModule>
+</IfModule>
+
+Listen %%LISTEN%%
+
+ErrorLog "%%LOG_FILE%%"
+LogLevel debug
+
+<Directory />
+    Options FollowSymLinks
+    AllowOverride None
+    Order deny,allow
+    Deny from all
+</Directory>
+
+AddDefaultCharset UTF-8
+PerlRequire %%RT_BIN_PATH%%/webmux.pl
+
+RedirectMatch permanent (.*)/$ $1/index.html
+
+DocumentRoot "%%DOCUMENT_ROOT%%"
+<Directory "%%DOCUMENT_ROOT%%">
+    Order allow,deny
+    Allow from all
+
+    SetHandler perl-script
+    PerlResponseHandler RT::Mason
+</Directory>
+

commit 1cb615cf3f2da7dc49cd7db2420ed589acf8e7b2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Sep 28 14:48:45 2009 +0400

    delete rt- prefix from snapshots as it's already there

diff --git a/Makefile.in b/Makefile.in
index 2cb66c2..032edcf 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -509,7 +509,7 @@ apachectl:
 	$(APACHECTL) start
 	sleep 5
 
-SNAPSHOT=rt-$(shell git describe --tags)
+SNAPSHOT=$(shell git describe --tags)
 snapshot:
 	git archive --prefix "$(SNAPSHOT)/"  HEAD | tar -xf -
 	( cd $(SNAPSHOT) && autoconf && ./configure )

commit d57f18aef33715b64ebefb715c778a8073f87bcc
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Sep 28 14:50:56 2009 +0400

    process web server config within configure

diff --git a/configure.ac b/configure.ac
index d6b3eda..5fc93b1 100755
--- a/configure.ac
+++ b/configure.ac
@@ -415,6 +415,7 @@ AC_CONFIG_FILES([
                  etc/RT_Config.pm
                  lib/RT.pm
                  bin/mason_handler.svc
-                 bin/webmux.pl],
+                 bin/webmux.pl
+                 t/data/configs/apache2.2+mod_perl.conf],
                )
 AC_OUTPUT

commit 6cad39ad71694cd86de7caf4af7189bcb68f2fc2
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Sep 28 14:51:52 2009 +0400

    * don't sort values as we stack them differently anyway

diff --git a/share/html/Search/Results.tsv b/share/html/Search/Results.tsv
index 5dd0949..bb3ac44 100644
--- a/share/html/Search/Results.tsv
+++ b/share/html/Search/Results.tsv
@@ -132,6 +132,7 @@ while ( my $Ticket = $Tickets->Next()) {
     }
 
     my $values = $Ticket->CustomFieldValues;
+    $values->OrderByCols; # don't sort them
     while (my $value = $values->Next) {
         my $pos = $cf_name_to_pos{ $cf_id_to_name{ $value->CustomField } };
         next unless $pos;

commit 9c518399495dcaf4877902b0335eafac89460151
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Mon Sep 28 14:53:25 2009 +0400

    refactor ::Test so we can start more servers, for example apache
    
    now we can start apache + mod_perl, but we can not stop it
    properly, yet. other servers and configurations is easy to
    add.

diff --git a/lib/RT/Test.pm b/lib/RT/Test.pm
index f32b720..649d1b8 100644
--- a/lib/RT/Test.pm
+++ b/lib/RT/Test.pm
@@ -127,8 +127,6 @@ use File::Path 'mkpath';
 unshift @RT::Interface::Web::Standalone::ISA, 'Test::HTTP::Server::Simple::StashWarnings';
 sub RT::Interface::Web::Standalone::test_warning_path { "/__test_warnings" }
 
-my @server;
-
 sub import {
     my $class = shift;
     my %args = @_;
@@ -362,19 +360,6 @@ sub bootstrap_plugins {
     }
 }
 
-my @SERVERS;
-sub started_ok {
-    require RT::Test::Web;
-    my $s = RT::Interface::Web::Standalone->new($port);
-    push @server, $s;
-    my $ret = $s->started_ok;
-    @SERVERS = $s->pids;
-    $RT::Handle = new RT::Handle;
-    $RT::Handle->dbh( undef );
-    RT->ConnectToDatabase;
-    return ($ret, RT::Test::Web->new);
-}
-
 sub _get_dbh {
     my ($dsn, $user, $pass) = @_;
     if ( $dsn =~ /Oracle/i ) {
@@ -930,16 +915,164 @@ sub trust_gnupg_key {
     return %res;
 }
 
+my @SERVERS;
+sub started_ok {
+    my $self = shift;
+
+    require RT::Test::Web;
+
+    my $which = $ENV{'RT_TEST_WEB_HANDLER'} || 'standalone';
+    my ($server, $variant) = split /\+/, $which, 2;
+
+    my $function = 'start_'. $server .'_server';
+    unless ( $self->can($function) ) {
+        die "Don't know how to start server '$server'";
+    }
+    return $self->$function( $variant, @_ );
+}
+
+sub start_standalone_server {
+    my $self = shift;
+
+    my $s = RT::Interface::Web::Standalone->new($port);
+
+    my $ret = $s->started_ok;
+    push @SERVERS, $s->pids;
+
+    $RT::Handle = new RT::Handle;
+    $RT::Handle->dbh( undef );
+    RT->ConnectToDatabase;
+
+    return ($ret, RT::Test::Web->new);
+}
+
+use File::Temp qw(tempfile);
+
+sub start_apache_server {
+    my $self = shift;
+    my $variant = shift || 'mod_perl2';
+
+    my $apache_bin = $ENV{'RT_TEST_APACHE'} || $self->find_apache_server
+        || Test::More::BAIL_OUT("Couldn't find apache server, use RT_TEST_APACHE");
+
+    Test::More::diag("Using apache - '$apache_bin'") if $ENV{'TEST_VERBOSE'};
+
+    my $apache_info = `$apache_bin -V`;
+    my ($version) = ($apache_info =~ m{Server\s+version:\s+Apache/(\d+\.\d+)\.});
+    die "Couldn't figure out version of the server" unless $version;
+
+    my %apache_opts = ($apache_info =~ m/^\s*-D\s+([A-Z_]+)="(.*)"$/mg);
+
+    my ($log_fh, $log_fn) = tempfile();
+    my $tmpl = File::Spec->rel2abs( File::Spec->catfile(
+        't', 'data', 'configs', 'apache'. $version .'+'. $variant .'.conf'
+    ) );
+    my %opt = (
+        listen => $port,
+        server_root   => $apache_opts{'HTTPD_ROOT'}
+            || Test::More::BAIL_OUT("Couldn't figure out server root"),
+        document_root => $RT::MasonComponentRoot,
+        rt_bin_path   => $RT::BinPath,
+        log_file      => $log_fn,
+    );
+    my ($conf_fh, $conf_fn) = $self->process_in_file(
+        in => $tmpl, options => \%opt, out => $tmpl .'.final',
+    );
+
+    my $pid = $self->fork_exec($apache_bin, '-f', $conf_fn);
+    Test::More::diag("Started apache server #$pid");
+    push @SERVERS, $pid;
+
+    sleep 1;
+
+    return (RT->Config->Get('WebURL'), RT::Test::Web->new);
+}
+
+sub find_apache_server {
+    my $self = shift;
+    return $_ foreach grep defined,
+        map $self->find_bin($_),
+        qw(httpd apache apache2 apache1);
+    return undef;
+}
+
+sub stop_server {
+    my $self = shift;
+
+    my $sig = 'TERM';
+    $sig = 'INT' if !$ENV{'RT_TEST_WEB_HANDLER'}
+                    || $ENV{'RT_TEST_WEB_HANDLER'} =~/^standalone(?:\+|\z)/;
+    kill $sig, @SERVERS;
+    foreach my $pid (@SERVERS) {
+        waitpid $pid, 0;
+    }
+}
+
+sub find_bin {
+    my $self = shift;
+    my $name = shift;
+
+    return $_ foreach
+        grep -e $_ && -x $_,
+        map File::Spec->catfile($_, $name),
+        split /:/, $ENV{'PATH'};
+    return undef;
+}
+
+sub fork_exec {
+    my $self = shift;
+
+    my $pid = fork;
+    unless ( defined $pid ) {
+        die "cannot fork: $!";
+    } elsif ( !$pid ) {
+        exec @_;
+        die "can't exec `". join(' ', @_) ."` program: $!";
+    } else {
+        return $pid;
+    }
+}
+
+sub process_in_file {
+    my $self = shift;
+    my %args = ( in => undef, options => undef, @_ );
+
+    my $in_fn = $args{'in'};
+    my $text = do {
+        open my $fh, '<', $in_fn
+            or die "Couldn't open '$in_fn': $!";
+        local $/;
+        <$fh>
+    };
+    while ( my ($opt) = ($text =~ /\%\%(.+)\%\%/) ) {
+        my $value = $args{'options'}{ lc $opt };
+        die "no value for $opt" unless defined $value;
+
+        $text =~ s/\%\%\Q$opt\E\%\%/$value/g;
+    }
+
+    my ($out_fh, $out_conf);
+    if ( $args{'out'} ) {
+        ($out_fh, $out_conf) = tempfile();
+    } else {
+        $out_conf = $args{'out'};
+        open $out_fh, '>', $out_conf
+            or die "couldn't open '$out_conf': $!";
+    }
+    print $out_fh $text;
+    seek $out_fh, 0, 0;
+
+    return ($out_fh, $out_conf);
+}
+
 END {
     my $Test = RT::Test->builder;
     return if $Test->{Original_Pid} != $$;
+    Test::More::diag("Cleaning");
+
+    RT::Test->stop_server;
+
     if ( $ENV{RT_TEST_PARALLEL} && $created_new_db ) {
-        {
-            kill 'INT', @SERVERS;
-            foreach my $pid (@SERVERS) {
-                waitpid $pid, 0;
-            }
-        }
 
         # Pg doesn't like if you issue a DROP DATABASE while still connected
         my $dbh = $RT::Handle->dbh;

commit bd456fc5e712e1cebb8c53f7ba3f9ea65d2cfb7a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Tue Sep 29 08:20:40 2009 +0400

    use explicit batch application in more modify pages

diff --git a/share/html/Ticket/ModifyAll.html b/share/html/Ticket/ModifyAll.html
index 9b4a507..7628700 100755
--- a/share/html/Ticket/ModifyAll.html
+++ b/share/html/Ticket/ModifyAll.html
@@ -227,9 +227,7 @@ unless ($OnlySearchForPeople or $OnlySearchForGroup or $ARGS{'AddMoreAttach'} )
     push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
 }
 
-# undef so that TransactionBatch scrips run and update the ticket
-$Ticket = undef;
-$Ticket = LoadTicket($id);
+$Ticket->ApplyTransactionBatch;
 
 # If they've gone and moved the ticket to somewhere they can't see, etc...
 # TODO: display the results, even if we can't display the ticket.
diff --git a/share/html/Ticket/ModifyDates.html b/share/html/Ticket/ModifyDates.html
index 645a9be..69bfde8 100755
--- a/share/html/Ticket/ModifyDates.html
+++ b/share/html/Ticket/ModifyDates.html
@@ -69,6 +69,7 @@
 my $TicketObj = LoadTicket($id);
 $m->callback( TicketObj => $TicketObj, ARGSRef => \%ARGS );
 my @results = ProcessTicketDates( TicketObj => $TicketObj, ARGSRef => \%ARGS);
+$TicketObj->ApplyTransactionBatch;
 
 </%INIT>
 
diff --git a/share/html/Ticket/ModifyLinks.html b/share/html/Ticket/ModifyLinks.html
index af1ecc3..efd026d 100755
--- a/share/html/Ticket/ModifyLinks.html
+++ b/share/html/Ticket/ModifyLinks.html
@@ -75,6 +75,7 @@ my $Ticket = LoadTicket($id);
 my @results;  
 $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS, Results => \@results );
 push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS );
+$TicketObj->ApplyTransactionBatch;
     
 </%INIT>
       
diff --git a/share/html/Ticket/ModifyPeople.html b/share/html/Ticket/ModifyPeople.html
index b1f6a3d..90bca56 100755
--- a/share/html/Ticket/ModifyPeople.html
+++ b/share/html/Ticket/ModifyPeople.html
@@ -74,6 +74,7 @@ $m->callback( TicketObj => $Ticket, ARGSRef => \%ARGS );
 unless ($OnlySearchForPeople or $OnlySearchForGroup) {
     push @results, ProcessTicketBasics( TicketObj => $Ticket, ARGSRef => \%ARGS);
     push @results, ProcessTicketWatchers( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    $Ticket->ApplyTransactionBatch;
 }
 </%INIT>
 

-----------------------------------------------------------------------


More information about the Rt-commit mailing list