Changeset 8171 for inc

Show
Ignore:
Timestamp:
12/11/05 03:56:59 (3 years ago)
Author:
autrijus
Message:

* Fix PJF++'s GHC probing logic by normalizing the version

numbers in directories, so we are fine even when GHC 6.10.999
is released.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • inc/Module/Install/Pugs.pm

    r8170 r8171  
    192192        if (-d $ghc_root) { 
    193193            # Looks like we've found a GHC directory.  Find the latest 
    194             # ghc inside that.  Sorted from lexically highest to lowest. 
    195  
    196             # XXX - This will bite us should GHC contain a two-digit 
    197             #       revision.  Eg, 6.9.0 vs 6.10.0 
    198  
    199             my @ghc_choices = reverse glob(qq{$ghc_root/ghc-*}); 
     194            # ghc inside that.  Sort versions from highest to lowest. 
     195 
     196            my @ghc_choices = sort { 
     197                _normalize_version($b) cmp _normalize_version($a) 
     198            } glob(qq{$ghc_root/ghc-*}); 
    200199 
    201200            GHC_TEST: 
     
    245244} 
    246245 
     246sub _normalize_version { 
     247    my $dir = shift; 
     248    $dir =~ /.*ghc-(.*)$/i or die "Invalid version: $dir"; 
     249    my $ver = $1; 
     250    $ver =~ s{(\d+)}{sprintf('%09s', $1)}eg; 
     251    return $ver; 
     252} 
     253 
    247254=head2 assert_ghc_pkg 
    248255