[Rt-commit] rt branch, 4.2/standardize-upgrade-scripts, created. rt-4.2.3-58-g82f71bc

Alex Vandiver alexmv at bestpractical.com
Mon Mar 24 12:54:19 EDT 2014


The branch, 4.2/standardize-upgrade-scripts has been created
        at  82f71bcfd337a9c58d8f76f296f3c8d9da350be6 (commit)

- Log -----------------------------------------------------------------
commit 82f71bcfd337a9c58d8f76f296f3c8d9da350be6
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

diff --git a/.gitignore b/.gitignore
index 159f895..18991b0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,11 +4,13 @@
 /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/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 cd55c3e..34e56b6 100755
--- a/configure.ac
+++ b/configure.ac
@@ -429,11 +429,13 @@ 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/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 dd21c25..a8edbbb 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
similarity index 97%
rename from etc/upgrade/shrink_cgm_table.pl
rename to etc/upgrade/shrink-cgm-table
index 7157b20..cb15daf 100644
--- a/etc/upgrade/shrink_cgm_table.pl
+++ b/etc/upgrade/shrink-cgm-table
@@ -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
similarity index 97%
rename from etc/upgrade/shrink_transactions_table.pl
rename to etc/upgrade/shrink-transactions-table
index 0b78f0f..be14cb3 100644
--- a/etc/upgrade/shrink_transactions_table.pl
+++ b/etc/upgrade/shrink-transactions-table
@@ -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;
 

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


More information about the rt-commit mailing list