[Bps-public-commit] r15158 - in Shipwright/trunk: lib/Shipwright/Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Aug 14 09:42:11 EDT 2008


Author: sunnavy
Date: Thu Aug 14 09:42:11 2008
New Revision: 15158

Modified:
   Shipwright/trunk/   (props changed)
   Shipwright/trunk/lib/Shipwright/Backend/FS.pm

Log:
 r15723 at sunnavys-mb:  sunnavy | 2008-08-14 21:39:23 +0800
 delete before import if imported before


Modified: Shipwright/trunk/lib/Shipwright/Backend/FS.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/FS.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/FS.pm	Thu Aug 14 09:42:11 2008
@@ -3,7 +3,7 @@
 use warnings;
 use strict;
 use Carp;
-use File::Spec::Functions qw/catfile catdir/;
+use File::Spec::Functions qw/catfile catdir splitdir/;
 use Shipwright::Util;
 use File::Copy qw/copy/;
 use File::Copy::Recursive qw/dircopy/;
@@ -65,21 +65,26 @@
         }
         else {
             if ( my $script_dir = $args{build_script} ) {
-                @cmd = [
+                push @cmd, [
                     'cp',        '-r',
                     "$script_dir/", $self->repository . "/scripts/$args{name}",
                 ];
             }
             else {
                 if ( $self->has_branch_support ) {
-                    unless ( -e $self->repository
-                        . "/sources/$args{name}/$args{as}" )
+                    my @dirs = splitdir( $args{name} );
+                    unless (
+                          -e $self->repository
+                        . "/sources/$args{name}/"
+                        . join '/',
+                        @dirs[ 0 .. $#dirs - 1 ]
+                      )
                     {
-                        push @cmd,
-                          [
+                        push @cmd, [
                             'mkdir', '-p',
-                            $self->repository . "/sources/$args{name}/$args{as}"
-                          ];
+                            $self->repository . "/sources/$args{name}/" . join
+                              '/', @dirs[ 0 .. $#dirs - 1 ]
+                        ];
                     }
 
                     push @cmd,
@@ -184,6 +189,16 @@
     copy( $latest, $file );
 }
 
+=item import
+
+=cut
+
+sub import {
+    my $self = shift;
+    return unless @_;
+    return $self->SUPER::import( @_, delete => 1 );
+}
+
 =back
 
 =cut



More information about the Bps-public-commit mailing list