[Bps-public-commit] r16193 - in Shipwright/trunk: lib/Shipwright/Source

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Oct 2 07:27:44 EDT 2008


Author: sunnavy
Date: Thu Oct  2 07:27:44 2008
New Revision: 16193

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Source/Base.pm

Log:
 r17000 at sunnavys-mb:  sunnavy | 2008-10-02 18:41:55 +0800
 added skip recommends stuff for source


Modified: Shipwright/trunk/lib/Shipwright/Source/Base.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Source/Base.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Source/Base.pm	Thu Oct  2 07:27:44 2008
@@ -13,8 +13,8 @@
 use base qw/Class::Accessor::Fast/;
 __PACKAGE__->mk_accessors(
     qw/source directory scripts_directory download_directory follow
-      min_perl_version map_path skip map keep_recommends keep_build_requires
-      name log url_path version_path branches_path version/
+      min_perl_version map_path skip map skip_recommends skip_all_recommends
+      keep_build_requires name log url_path version_path branches_path version/
 );
 
 =head1 NAME
@@ -66,6 +66,7 @@
     my $map          = {};
     my $url          = {};
 
+
     unless ( $self->min_perl_version ) {
         no warnings 'once';
         require Config;
@@ -82,6 +83,14 @@
         $url = Shipwright::Util::LoadFile( $self->url_path );
     }
 
+    my @types = qw/requires build_requires/;
+
+    my $reverse_map = { reverse %$map };
+    my $skip_recommends = $self->skip_recommends->{ $self->name }
+      || $self->skip_recommends->{ $reverse_map->{ $self->name } }
+      || $self->skip_all_recommends;
+    push @types, 'recommends' unless $skip_recommends;
+
     if ( !-e $require_path ) {
 
         # if not found, we'll create one according to Build.PL or Makefile.PL
@@ -235,7 +244,7 @@
             Shipwright::Util->run( [ 'rm',   'Makefile.old' ] );
         }
 
-        for my $type (qw/requires recommends build_requires/) {
+        for my $type ( @types ) {
             for my $module ( keys %{ $require->{$type} } ) {
                 $require->{$type}{$module}{version} =
                   delete $require->{$type}{$module};
@@ -257,7 +266,7 @@
             }
         }
 
-        for my $type (qw/requires recommends build_requires/) {
+        for my $type ( @types ) {
             for my $module ( keys %{ $require->{$type} } ) {
 
 #$module shouldn't be undefined, but it _indeed_ happens in reality sometimes
@@ -362,6 +371,9 @@
                 }
             }
         }
+        # don't keep recommends info if we skip them, so we won't encounter
+        # them when update later
+        $require->{recommends} = {} if $skip_recommends;
 
         Shipwright::Util::DumpFile( $require_path, $require );
     }



More information about the Bps-public-commit mailing list