[Rt-commit] rt branch, 4.2/upgrade-and-policy, created. rt-4.2.6-25-gc22f86b

Alex Vandiver alexmv at bestpractical.com
Mon Jul 21 18:18:19 EDT 2014


The branch, 4.2/upgrade-and-policy has been created
        at  c22f86bfa013b29de5ed632e4e7db9abea58a529 (commit)

- Log -----------------------------------------------------------------
commit 3d9b2879c9ac20fa78269a3e820de879d4160d79
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Mar 24 12:52:49 2014 -0400

    Move all etc/upgrade scrips to .in files, and standardize their init
    
    Fixes: I#18856

diff --git a/.gitignore b/.gitignore
index 159f895..855514b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,11 +4,15 @@
 /etc/RT_Config.pm
 /etc/upgrade/3.8-ical-extension
 /etc/upgrade/4.0-customfield-checkbox-extension
-/etc/upgrade/split-out-cf-categories
 /etc/upgrade/generate-rtaddressregexp
+/etc/upgrade/sanity-check-stylesheets
+/etc/upgrade/shrink-cgm-table
+/etc/upgrade/shrink-transactions-table
+/etc/upgrade/split-out-cf-categories
+/etc/upgrade/switch-templates-to
+/etc/upgrade/time-worked-history
 /etc/upgrade/upgrade-articles
 /etc/upgrade/vulnerable-passwords
-/etc/upgrade/switch-templates-to
 /lib/RT/Generated.pm
 /Makefile
 /t/data/gnupg/keyrings/random_seed
diff --git a/configure.ac b/configure.ac
index 8cd71d0..26fb8e9 100755
--- a/configure.ac
+++ b/configure.ac
@@ -429,11 +429,15 @@ dnl Binaries that should be +x
 AC_CONFIG_FILES([
                  etc/upgrade/3.8-ical-extension
                  etc/upgrade/4.0-customfield-checkbox-extension
-                 etc/upgrade/split-out-cf-categories
                  etc/upgrade/generate-rtaddressregexp
+                 etc/upgrade/sanity-check-stylesheets
+                 etc/upgrade/shrink-cgm-table
+                 etc/upgrade/shrink-transactions-table
+                 etc/upgrade/split-out-cf-categories
+                 etc/upgrade/switch-templates-to
+                 etc/upgrade/time-worked-history
                  etc/upgrade/upgrade-articles
                  etc/upgrade/vulnerable-passwords
-                 etc/upgrade/switch-templates-to
                  sbin/rt-attributes-viewer
                  sbin/rt-preferences-viewer
                  sbin/rt-session-viewer
diff --git a/docs/UPGRADING-3.8 b/docs/UPGRADING-3.8
index ba71777..9c3f93f 100644
--- a/docs/UPGRADING-3.8
+++ b/docs/UPGRADING-3.8
@@ -7,13 +7,13 @@ authentication itself, it may still store these weak password hashes -- using
 ExternalAuth does not guarantee that you are not vulnerable!  To upgrade
 stored passwords to a stronger hash, run:
 
-    perl etc/upgrade/vulnerable-passwords
+    /opt/rt4/etc/upgrade/vulnerable-passwords
 
 We have also proved that it's possible to delete a notable set of records from
 Transactions table without losing functionality. To delete these records, run
 the following script:
 
-    perl -I /opt/rt4/local/lib -I /opt/rt4/lib etc/upgrade/shrink_transactions_table.pl
+    /opt/rt4/etc/upgrade/shrink-transactions-table
 
 If you chose not to run the shrink_cgm_table.pl script when you upgraded to
 3.8, you should read more about it below and run it at this point.
@@ -63,7 +63,7 @@ Custom fields with categories can optionally be split out into hierarchical
 custom fields.  If you wish to convert your old category-based custom fields,
 run:
 
-    perl etc/upgrade/split-out-cf-categories
+    /opt/rt4/etc/upgrade/split-out-cf-categories
 
 It will prompt you for each custom field with categories that it finds, and
 the name of the custom field to create to store the categories.
@@ -138,7 +138,7 @@ CachedGroupMembers table without losing functionality; in fact, failing to do
 so may result in occasional problems where RT miscounts users, particularly in
 the chart functionality.  To delete these records run the following script:
 
-    perl -I /opt/rt4/local/lib -I /opt/rt4/lib etc/upgrade/shrink_cgm_table.pl
+    /opt/rt4/etc/upgrade/shrink-cgm-table
 
 After you run this, you will have significantly reduced the number of records
 in your CachedGroupMembers table, and may need to tell your database to
@@ -174,7 +174,7 @@ RT::Action::LinearEscalate extension has been integrated into core, so you
 MUST uninstall it before upgrading.
 
 RT::Extension::iCal has been integrated into core, so you MUST uninstall it
-before upgrading. In addition, you must run etc/upgrade/3.8-ical-extension
+before upgrading. In addition, you must run /opt/rt4/etc/upgrade/3.8-ical-extension
 script to convert old data.
 
 
diff --git a/docs/UPGRADING-4.2 b/docs/UPGRADING-4.2
index ccd8575..2ed98e4 100644
--- a/docs/UPGRADING-4.2
+++ b/docs/UPGRADING-4.2
@@ -131,7 +131,7 @@ extra transactions, and keeping the summed time spent consistent.
 In order to fix the history records of old ticket you can run the following
 command:
 
-    perl -I /opt/rt4/local/lib/ -I /opt/rt4/lib/ etc/upgrade/time-worked-history.pl
+    /opt/rt4/etc/upgrade/time-worked-history
 
 This command deletes records from the Transactions table. This script can only fix
 TimeWorked mismatches, but not TimeLeft or TimeEstimated.
diff --git a/etc/upgrade/3.8-ical-extension.in b/etc/upgrade/3.8-ical-extension.in
index 47b1846..ebb03a1 100644
--- a/etc/upgrade/3.8-ical-extension.in
+++ b/etc/upgrade/3.8-ical-extension.in
@@ -46,16 +46,16 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
+use RT -init;
 
-use RT;
-RT::LoadConfig();
-RT::Init();
+$| = 1;
 
 use RT::Attributes;
 my $attrs = RT::Attributes->new( RT->SystemUser );
diff --git a/etc/upgrade/4.0-customfield-checkbox-extension.in b/etc/upgrade/4.0-customfield-checkbox-extension.in
index 9e0d1bf..74dfbf4 100644
--- a/etc/upgrade/4.0-customfield-checkbox-extension.in
+++ b/etc/upgrade/4.0-customfield-checkbox-extension.in
@@ -46,15 +46,16 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
-RT::LoadConfig();
-RT::Init();
+use RT -init;
+
+$| = 1;
 
 use RT::CustomFields;
 my $cfs = RT::CustomFields->new( RT->SystemUser );
diff --git a/etc/upgrade/generate-rtaddressregexp.in b/etc/upgrade/generate-rtaddressregexp.in
index 1f91c9f..2cb207e 100644
--- a/etc/upgrade/generate-rtaddressregexp.in
+++ b/etc/upgrade/generate-rtaddressregexp.in
@@ -46,16 +46,15 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
-RT::LoadConfig();
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
 
 $| = 1;
 
diff --git a/etc/upgrade/sanity-check-stylesheets.pl b/etc/upgrade/sanity-check-stylesheets.in
similarity index 97%
rename from etc/upgrade/sanity-check-stylesheets.pl
rename to etc/upgrade/sanity-check-stylesheets.in
index 2019f25..ded82eb 100644
--- a/etc/upgrade/sanity-check-stylesheets.pl
+++ b/etc/upgrade/sanity-check-stylesheets.in
@@ -1,3 +1,4 @@
+#!@PERL@
 # BEGIN BPS TAGGED BLOCK {{{
 #
 # COPYRIGHT:
@@ -45,13 +46,15 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
-use RT;
-RT::LoadConfig();
+use lib "@LOCAL_LIB_PATH@";
+use lib "@RT_LIB_PATH@";
+
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
 
 $| = 1;
 
diff --git a/etc/upgrade/shrink_cgm_table.pl b/etc/upgrade/shrink-cgm-table.in
similarity index 97%
rename from etc/upgrade/shrink_cgm_table.pl
rename to etc/upgrade/shrink-cgm-table.in
index 7157b20..cb15daf 100644
--- a/etc/upgrade/shrink_cgm_table.pl
+++ b/etc/upgrade/shrink-cgm-table.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!@PERL@
 # BEGIN BPS TAGGED BLOCK {{{
 #
 # COPYRIGHT:
@@ -50,10 +50,13 @@ use 5.10.1;
 use strict;
 use warnings;
 
-use RT;
-RT::LoadConfig();
+use lib "@LOCAL_LIB_PATH@";
+use lib "@RT_LIB_PATH@";
+
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
+
+$| = 1;
 
 use RT::CachedGroupMembers;
 my $cgms = RT::CachedGroupMembers->new( RT->SystemUser );
@@ -89,7 +92,6 @@ $cgms->Limit(
     ENTRYAGGREGATOR => 'AND',
 );
 
-$| = 1;
 my $total = $cgms->Count;
 my $i = 0;
 
diff --git a/etc/upgrade/shrink_transactions_table.pl b/etc/upgrade/shrink-transactions-table.in
similarity index 97%
rename from etc/upgrade/shrink_transactions_table.pl
rename to etc/upgrade/shrink-transactions-table.in
index 0b78f0f..be14cb3 100644
--- a/etc/upgrade/shrink_transactions_table.pl
+++ b/etc/upgrade/shrink-transactions-table.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!@PERL@
 # BEGIN BPS TAGGED BLOCK {{{
 #
 # COPYRIGHT:
@@ -50,10 +50,13 @@ use 5.10.1;
 use strict;
 use warnings;
 
-use RT;
-RT::LoadConfig();
+use lib "@LOCAL_LIB_PATH@";
+use lib "@RT_LIB_PATH@";
+
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
+
+$| = 1;
 
 use RT::Transactions;
 my $txns = RT::Transactions->new( RT->SystemUser );
@@ -91,7 +94,6 @@ $txns->Limit(
     ENTRYAGGREGATOR => 'AND',
 );
 
-$| = 1;
 my $total = $txns->Count;
 my $i = 0;
 
diff --git a/etc/upgrade/split-out-cf-categories.in b/etc/upgrade/split-out-cf-categories.in
index a774501..12ce5ee 100644
--- a/etc/upgrade/split-out-cf-categories.in
+++ b/etc/upgrade/split-out-cf-categories.in
@@ -46,16 +46,15 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
-RT::LoadConfig();
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
 
 $| = 1;
 
diff --git a/etc/upgrade/switch-templates-to.in b/etc/upgrade/switch-templates-to.in
index 974ec64..f41ff68 100644
--- a/etc/upgrade/switch-templates-to.in
+++ b/etc/upgrade/switch-templates-to.in
@@ -46,13 +46,17 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
+use RT -init;
+RT->Config->Set('LogToSTDERR' => 'info');
+
+$| = 1;
 
 my $to = shift || '';
 my $from;
@@ -66,11 +70,6 @@ if ($to =~ /html|text/i) {
     exit 1;
 }
 
-RT::LoadConfig();
-RT->Config->Set('LogToSTDERR' => 'info');
-RT::Init();
-
-$| = 1;
 
 my @templates = (
     "Autoreply",
diff --git a/etc/upgrade/time-worked-history.pl b/etc/upgrade/time-worked-history.in
similarity index 98%
rename from etc/upgrade/time-worked-history.pl
rename to etc/upgrade/time-worked-history.in
index 46961aa..1596265 100644
--- a/etc/upgrade/time-worked-history.pl
+++ b/etc/upgrade/time-worked-history.in
@@ -1,4 +1,4 @@
-#!/usr/bin/env perl
+#!@PERL@
 # BEGIN BPS TAGGED BLOCK {{{
 #
 # COPYRIGHT:
@@ -50,10 +50,11 @@ use 5.10.1;
 use strict;
 use warnings;
 
-use RT;
-RT::LoadConfig();
+use lib "@LOCAL_LIB_PATH@";
+use lib "@RT_LIB_PATH@";
+
+use RT -init;
 RT->Config->Set('LogToSTDERR' => 'info');
-RT::Init();
 
 my $dbh = $RT::Handle->dbh;
 my $ids = $dbh->selectcol_arrayref(
diff --git a/etc/upgrade/upgrade-articles.in b/etc/upgrade/upgrade-articles.in
index 17128e9..2619c11 100644
--- a/etc/upgrade/upgrade-articles.in
+++ b/etc/upgrade/upgrade-articles.in
@@ -46,16 +46,16 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
-RT::LoadConfig();
+use RT -init;
+
 RT->Config->Set('LogToSTDERR' => 'debug');
-RT::Init();
 
 $| = 1;
 
diff --git a/etc/upgrade/vulnerable-passwords.in b/etc/upgrade/vulnerable-passwords.in
old mode 100755
new mode 100644
index b1027a4..f16319f
--- a/etc/upgrade/vulnerable-passwords.in
+++ b/etc/upgrade/vulnerable-passwords.in
@@ -46,15 +46,14 @@
 # those contributions and any derivatives thereof.
 #
 # END BPS TAGGED BLOCK }}}
+use 5.10.1;
 use strict;
 use warnings;
 
 use lib "@LOCAL_LIB_PATH@";
 use lib "@RT_LIB_PATH@";
 
-use RT;
-RT::LoadConfig;
-RT::Init;
+use RT -init;
 
 $| = 1;
 

commit 6c9083827c094dcded1da22f748621f8ca42da71
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:27:21 2014 -0400

    Add policy tests for etc/upgrade/ files

diff --git a/t/99-policy.t b/t/99-policy.t
index 7e6d4a3..e0212ba 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -135,4 +135,10 @@ check( $_, exec => -1, bps_tag => -1 )
 check( $_, warnings => 1, strict => 1, compile_perl => 1, no_tabs => 1 )
     for grep {m{^etc/upgrade/.*/content$}} @files;
 
+check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no_tabs => 1 )
+    for grep {m{^etc/upgrade/[^/]+$}} @files;
+
+check( $_, compile_perl => 1, exec => 1 )
+    for grep{ -f $_} map {s/\.in$//; $_} grep {m{^etc/upgrade/[^/]+$}} @files;
+
 done_testing;

commit 028f04409d65b0003195f14b3e16d40a52c188c8
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:29:33 2014 -0400

    \Q and \E only affect within their given string
    
    Splitting the \Q and \E into differing double-quoted strings has no
    effect -- and as $domain is not substituted into either of them, it does
    not gain the beneficial effects.  That is, if $domain is "example.com"
    the generated string will contain "(?:foo|bar)\@example.com" without the
    "." escaped.
    
    Embed the $domain substitution between the \Q and \E so it is effective.
    This was detected by a warning found in the previous commit.

diff --git a/etc/upgrade/generate-rtaddressregexp.in b/etc/upgrade/generate-rtaddressregexp.in
index 2cb207e..84d8ad1 100644
--- a/etc/upgrade/generate-rtaddressregexp.in
+++ b/etc/upgrade/generate-rtaddressregexp.in
@@ -85,7 +85,7 @@ for my $domain (sort keys %merged) {
         }
     }
     if (@addresses > 1) {
-        push @domains, "(?:".join("|", @addresses).")\Q\@".$domain."\E";
+        push @domains, "(?:".join("|", @addresses).")\Q\@$domain\E";
     } else {
         push @domains, "$addresses[0]\Q\@$domain\E";
     }

commit d62bd15498b819f8a91ec513435d8cbff68138a3
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:31:30 2014 -0400

    Make sure the non-.in bin/ and sbin/ files are +x

diff --git a/t/99-policy.t b/t/99-policy.t
index e0212ba..79f2bba 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -111,7 +111,7 @@ check( $_, shebang => -1, exec => -1, warnings => 1, strict => 1, bps_tag => -1,
 check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no_tabs => 1 )
     for grep {m{^s?bin/}} @files;
 
-check( $_, compile_perl => 1 )
+check( $_, compile_perl => 1, exec => 1 )
     for grep { -f $_ } map { s/\.in$//; $_ } grep {m{^s?bin/}} @files;
 
 check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no_tabs => 1 )

commit 5e9b098b67a386cc134f7be8e4a2fd1dae47b314
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:31:50 2014 -0400

    There is no reason for config, acl, schema, and initialdata to be +x

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
old mode 100755
new mode 100644
diff --git a/etc/RT_SiteConfig.pm b/etc/RT_SiteConfig.pm
old mode 100755
new mode 100644
diff --git a/etc/acl.Oracle b/etc/acl.Oracle
old mode 100755
new mode 100644
diff --git a/etc/acl.Pg b/etc/acl.Pg
old mode 100755
new mode 100644
diff --git a/etc/acl.mysql b/etc/acl.mysql
old mode 100755
new mode 100644
diff --git a/etc/schema.Oracle b/etc/schema.Oracle
old mode 100755
new mode 100644
diff --git a/etc/schema.Pg b/etc/schema.Pg
old mode 100755
new mode 100644
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
old mode 100755
new mode 100644
diff --git a/etc/schema.mysql b/etc/schema.mysql
old mode 100755
new mode 100644
diff --git a/t/99-policy.t b/t/99-policy.t
index 79f2bba..16fc5be 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -130,6 +130,9 @@ check( $_, exec => -1 )
     for grep {m{^t/data/}} @files;
 
 check( $_, exec => -1, bps_tag => -1 )
+    for grep {m{^etc/[^/]+$}} @files;
+
+check( $_, exec => -1, bps_tag => -1 )
     for grep {m{^etc/upgrade/[^/]+/}} @files;
 
 check( $_, warnings => 1, strict => 1, compile_perl => 1, no_tabs => 1 )

commit 6153463c34707ccc5c5b74504ff84c0e485b4297
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:42:05 2014 -0400

    There is no reason for doc files to be +x

diff --git a/docs/schema.dot b/docs/schema.dot
old mode 100755
new mode 100644
diff --git a/t/99-policy.t b/t/99-policy.t
index 16fc5be..b08ab96 100644
--- a/t/99-policy.t
+++ b/t/99-policy.t
@@ -11,7 +11,7 @@ find( { wanted   => sub {
             $File::Find::prune = 1 if $_ eq "t/tmp" or m{/\.git$};
         },
         no_chdir => 1 },
-      qw{etc lib share t bin sbin devel/tools} );
+      qw{etc lib share t bin sbin devel/tools docs} );
 
 if ( my $dir = `git rev-parse --git-dir 2>/dev/null` ) {
     # We're in a git repo, use the ignore list
@@ -144,4 +144,7 @@ check( $_, shebang => 1, exec => 1, warnings => 1, strict => 1, bps_tag => 1, no
 check( $_, compile_perl => 1, exec => 1 )
     for grep{ -f $_} map {s/\.in$//; $_} grep {m{^etc/upgrade/[^/]+$}} @files;
 
+check( $_, exec => -1 )
+    for grep {m{^docs/}} @files;
+
 done_testing;

commit c22f86bfa013b29de5ed632e4e7db9abea58a529
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Mon Jul 21 17:43:22 2014 -0400

    These top-level files need not be +x

diff --git a/Makefile.in b/Makefile.in
old mode 100755
new mode 100644
diff --git a/aclocal.m4 b/aclocal.m4
old mode 100755
new mode 100644
diff --git a/config.layout b/config.layout
old mode 100755
new mode 100644

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


More information about the rt-commit mailing list