[Bps-public-commit] r10784 - in Shipwright/lib/Shipwright: Script

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Feb 10 01:31:12 EST 2008


Author: sunnavy
Date: Sun Feb 10 01:31:12 2008
New Revision: 10784

Modified:
   Shipwright/lib/Shipwright/Script/Import.pm
   Shipwright/lib/Shipwright/Source/Base.pm

Log:
hash structure for skip is better

Modified: Shipwright/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Import.pm	(original)
+++ Shipwright/lib/Shipwright/Script/Import.pm	Sun Feb 10 01:31:12 2008
@@ -52,7 +52,7 @@
 
     $self->source($source) if $source;
     $self->follow(1) unless defined $self->follow;
-    $self->skip( [ split /\s*,\s*/, $self->skip || '' ] );
+    $self->skip( { map { $_ => 1 } split /\s*,\s*/, $self->skip || '' } );
 
     for (qw/repository source/) {
         die "need $_ arg" unless $self->$_();
@@ -85,9 +85,8 @@
         unless ( $self->overwrite ) {
 
             # skip already imported dists
-            push @{ $self->skip() },
-              map { "^$_\$" } @{ $shipwright->backend->order() || [] };
-            $shipwright->source->skip( $self->skip );
+            $shipwright->source->skip(Hash::Merge::merge( $self->skip,
+                        $shipwright->backend->map || {} ));
         }
 
         Shipwright::Util::DumpFile( $shipwright->source->map_path,
@@ -192,15 +191,6 @@
 
                 unless ( $imported{$dist}++ ) {
 
-                    if ( !$self->overwrite && grep { $dist =~ /$_/ }
-                        @{ $self->skip } )
-                    {
-                        $self->log->warn(
-"have $dist in repo already, skip it. you can use --overwrite to overwrite"
-                        );
-                        next;
-                    }
-
                     my ($s) = grep { $_ eq $dist } @sources;
                     unless ($s) {
                         $self->log->warn(

Modified: Shipwright/lib/Shipwright/Source/Base.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/Base.pm	(original)
+++ Shipwright/lib/Shipwright/Source/Base.pm	Sun Feb 10 01:31:12 2008
@@ -35,7 +35,7 @@
     for ( $self->_cmd ) {
         Shipwright::Util->run($_);
     }
-    $self->_copy( %{$args{copy}} ) if $args{copy};
+    $self->_copy( %{ $args{copy} } ) if $args{copy};
 }
 
 # you should subclass this method.
@@ -252,13 +252,9 @@
     my $self   = shift;
     my $module = shift;
 
-    if ( $self->skip ) {
-        for ( @{ $self->skip } ) {
-            if ( $module =~ /$_/ ) {
-                $self->log->warn("$module is skipped");
-            }
-            return 1 if $module =~ /$_/;
-        }
+    if ( $self->skip && defined $self->skip->{$module} ) {
+        $self->log->warn("$module is skipped");
+        return 1 if $module =~ /$_/;
     }
 
     return;



More information about the Bps-public-commit mailing list