[Rt-commit] rt branch, 4.0/missed-upgrade-steps-regression, created. rt-4.0.16-2-ga3acf47

Thomas Sibley trs at bestpractical.com
Fri Aug 2 13:38:27 EDT 2013


The branch, 4.0/missed-upgrade-steps-regression has been created
        at  a3acf475a0a3826ef27a9fe753d517428b825c64 (commit)

- Log -----------------------------------------------------------------
commit 3e68ccb5a43023591dfbac90ab9973d24eb613c9
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Aug 2 10:24:03 2013 -0700

    Fix regression in upgrade step logic which filtered out rc dirs
    
    feeccd1 incorrectly anchored the end of the directory names in order to
    weed out false positives.  Unfortunately, in doing so, it also filtered
    out rc upgrade directories (creating false negatives).
    
    Fix this regression by using RT::Handle's version words and the standard
    regex used in two other places in rt-setup-database.  This regex
    accounts for rc dirs while also filtering out false positives.

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index fd82fe2..e5c8f1c 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -410,7 +410,8 @@ sub get_versions_from_to {
     my ($base_dir, $from, $to) = @_;
 
     opendir( my $dh, $base_dir ) or die "couldn't open dir: $!";
-    my @versions = grep -d "$base_dir/$_" && /^\d+\.\d+\.\d+$/, readdir $dh;
+    my $version_word_regex = join '|', RT::Handle->version_words;
+    my @versions = grep -d "$base_dir/$_" && /^\d+\.\d+\.\d+(?:$version_word_regex)?\d*$/, readdir $dh;
     closedir $dh;
 
     die "\nERROR: No upgrade data found in '$base_dir'!  Perhaps you specified the wrong --datadir?\n"

commit a3acf475a0a3826ef27a9fe753d517428b825c64
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Fri Aug 2 10:31:15 2013 -0700

    Consolidate version dir matching into a standard regex available everywhere
    
    Hopefully this will avoid divergent restrictions in the future.

diff --git a/sbin/rt-setup-database.in b/sbin/rt-setup-database.in
index e5c8f1c..a53d02b 100644
--- a/sbin/rt-setup-database.in
+++ b/sbin/rt-setup-database.in
@@ -191,6 +191,9 @@ if ($args{'skip-create'}) {
     }
 }
 
+my $version_word_regex = join '|', RT::Handle->version_words;
+my $version_dir = qr/^\d+\.\d+\.\d+(?:$version_word_regex)?\d*$/;
+
 print "Working with:\n"
     ."Type:\t$db_type\nHost:\t$db_host\nPort:\t$db_port\nName:\t$db_name\n"
     ."User:\t$db_user\nDBA:\t$dba_user" . ($args{'skip-create'} ? ' (No DBA)' : '') . "\n";
@@ -308,7 +311,6 @@ sub action_upgrade {
     return (0, "Couldn't read dir '$base_dir' with upgrade data")
         unless -d $base_dir || -r _;
 
-    my $version_word_regex = join '|', RT::Handle->version_words;
     my $upgrading_from = undef;
     do {
         if ( defined $upgrading_from ) {
@@ -319,7 +321,7 @@ sub action_upgrade {
         $upgrading_from = scalar <STDIN>;
         chomp $upgrading_from;
         $upgrading_from =~ s/\s+//g;
-    } while $upgrading_from !~ /^\d+\.\d+\.\d+(?:$version_word_regex)?\d*$/;
+    } while $upgrading_from !~ /$version_dir/;
 
     my $upgrading_to = $RT::VERSION;
     return (0, "The current version $upgrading_to is lower than $upgrading_from")
@@ -354,7 +356,7 @@ sub action_upgrade {
             chomp $custom_upgrading_to;
             $custom_upgrading_to =~ s/\s+//g;
             last unless $custom_upgrading_to;
-        } while $custom_upgrading_to !~ /^\d+\.\d+\.\d+(?:$version_word_regex)?\d*$/;
+        } while $custom_upgrading_to !~ /$version_dir/;
 
         if ( $custom_upgrading_to ) {
             return (
@@ -410,8 +412,7 @@ sub get_versions_from_to {
     my ($base_dir, $from, $to) = @_;
 
     opendir( my $dh, $base_dir ) or die "couldn't open dir: $!";
-    my $version_word_regex = join '|', RT::Handle->version_words;
-    my @versions = grep -d "$base_dir/$_" && /^\d+\.\d+\.\d+(?:$version_word_regex)?\d*$/, readdir $dh;
+    my @versions = grep -d "$base_dir/$_" && /$version_dir/, readdir $dh;
     closedir $dh;
 
     die "\nERROR: No upgrade data found in '$base_dir'!  Perhaps you specified the wrong --datadir?\n"

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


More information about the Rt-commit mailing list