[Bps-public-commit] r12130 - Shipwright/trunk/lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Wed May 7 05:09:57 EDT 2008


Author: sunnavy
Date: Wed May  7 05:09:56 2008
New Revision: 12130

Modified:
   Shipwright/trunk/lib/Shipwright/Source/CPAN.pm

Log:
hack CPAN source to handle module with specified version

Modified: Shipwright/trunk/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source/CPAN.pm	Wed May  7 05:09:56 2008
@@ -75,18 +75,31 @@
         return;
     }
 
-    $module->distribution->get;
+    my $source = $module->cpan_file;
 
     my $info = CPAN::DistnameInfo->new( $module->cpan_file );
     my $dist = $info->dist;
 
+    my $distribution = $module->distribution;
+    if ( $self->version ) {
+        my $latest_version = $info->version;
+        my $version = $self->version;
+        if ( $latest_version =~ /^v/ && $version !~ /^v/ ) {
+            $version = 'v' . $version;
+        }
+        $distribution->{ID} =~ s/$latest_version/$version/;
+        $source =~ s/$latest_version/$version/;
+    }
+
+    $distribution->get;
+
     $self->name( 'cpan-' . $dist );
     $self->_update_map( $self->source, 'cpan-' . $dist );
 
     $self->source(
         File::Spec->catfile(
             $CPAN::Config->{keep_source_where}, 'authors',
-            'id',                               $module->cpan_file
+            'id',                               $source
         )
     );
     return 1;



More information about the Bps-public-commit mailing list