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

sunnavy at bestpractical.com sunnavy at bestpractical.com
Mon Aug 25 09:19:24 EDT 2008


Author: sunnavy
Date: Mon Aug 25 09:19:15 2008
New Revision: 15421

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

Log:
 r16043 at sunnavys-mb:  sunnavy | 2008-08-25 21:01:54 +0800
 perltidy Backend/Base.pm


Modified: Shipwright/trunk/lib/Shipwright/Backend/Base.pm
==============================================================================
--- Shipwright/trunk/lib/Shipwright/Backend/Base.pm	(original)
+++ Shipwright/trunk/lib/Shipwright/Backend/Base.pm	Mon Aug 25 09:19:15 2008
@@ -9,7 +9,7 @@
 use File::Copy qw/copy/;
 use File::Copy::Recursive qw/dircopy/;
 use File::Path;
-use List::MoreUtils qw/uniq/;
+use List::MoreUtils qw/uniq firstidx/;
 
 our %REQUIRE_OPTIONS = ( import => [qw/source/] );
 
@@ -117,7 +117,7 @@
                 );
             }
             else {
-                $self->delete( path =>  "/scripts/$name" ) if $args{delete};
+                $self->delete( path => "/scripts/$name" ) if $args{delete};
 
                 $self->log->info(
                     "import $args{source}'s scripts to " . $self->repository );
@@ -129,14 +129,16 @@
             }
         }
         else {
-            if ( $self->info( path => "/sources/$name/$args{as}" ) && not $args{overwrite} )
+            if ( $self->info( path => "/sources/$name/$args{as}" )
+                && not $args{overwrite} )
             {
                 $self->log->warn(
 "path sources/$name/$args{as} alreay exists, need to set overwrite arg to overwrite"
                 );
             }
             else {
-                $self->delete( path =>  "/sources/$name/$args{as}" ) if $args{delete};
+                $self->delete( path => "/sources/$name/$args{as}" )
+                  if $args{delete};
                 $self->log->info(
                     "import $args{source} to " . $self->repository );
                 $self->_add_to_order($name);
@@ -147,7 +149,8 @@
 
                 my $branches = $self->branches;
                 if ( $args{branches} ) {
-            # mostly this happens when import from another shipwright repo
+
+                  # mostly this happens when import from another shipwright repo
                     $branches->{$name} = $args{branches};
                     $self->branches($branches);
                 }
@@ -188,7 +191,7 @@
     $self->log->info(
         'export ' . $self->repository . "/$path to $args{target}" );
     for my $cmd ( $self->_cmd( export => %args ) ) {
-        Shipwright::Util->run( $cmd );
+        Shipwright::Util->run($cmd);
     }
 }
 
@@ -203,7 +206,7 @@
     $self->log->info(
         'export ' . $self->repository . "/$path to $args{target}" );
     for my $cmd ( $self->_cmd( checkout => %args ) ) {
-        Shipwright::Util->run( $cmd );
+        Shipwright::Util->run($cmd);
     }
 }
 
@@ -217,12 +220,11 @@
     my $self = shift;
     my %args = @_;
     $self->log->info( 'commit ' . $args{path} );
-    for my $cmd (  $self->_cmd( commit => @_ ) ) {
+    for my $cmd ( $self->_cmd( commit => @_ ) ) {
         Shipwright::Util->run( $cmd, 1 );
     }
 }
 
-
 sub _add_to_order {
     my $self = shift;
     my $name = shift;
@@ -258,6 +260,7 @@
     my $require = {};
 
     for (@dists) {
+
         $self->_fill_deps( %args, require => $require, name => $_ );
     }
 
@@ -280,10 +283,10 @@
     my $name    = $args{name};
 
     return if $require->{$name};
-    my $out = Shipwright::Util->run( $self->_cmd( 'cat', path =>
-                "/scripts/$name/require.yml" ), 1 );
+    my $out = Shipwright::Util->run(
+        $self->_cmd( 'cat', path => "/scripts/$name/require.yml" ), 1 );
 
-    my $req = Shipwright::Util::Load( $out ) || {};
+    my $req = Shipwright::Util::Load($out) || {};
 
     if ( $req->{requires} ) {
         for (qw/requires recommends build_requires/) {
@@ -355,7 +358,7 @@
 sub source {
     my $self   = shift;
     my $source = shift;
-    my $path = '/shipwright/source.yml';
+    my $path   = '/shipwright/source.yml';
     return $self->_yml( $path, $source );
 }
 
@@ -394,7 +397,7 @@
 =cut
 
 sub branches {
-    my $self    = shift;
+    my $self     = shift;
     my $branches = shift;
 
     my $path = '/shipwright/branches.yml';
@@ -423,7 +426,7 @@
 
 sub refs {
     my $self = shift;
-    my $refs  = shift;
+    my $refs = shift;
     my $path = '/shipwright/refs.yml';
 
     return $self->_yml( $path, $refs );
@@ -529,8 +532,7 @@
     my %args = @_;
     my $name = $args{name};
 
-    return $self->_yml(
-        catfile( 'scripts', $name, 'require.yml' ) );
+    return $self->_yml( catfile( 'scripts', $name, 'require.yml' ) );
 }
 
 =item check_repository
@@ -569,8 +571,7 @@
     croak "need path option" unless $args{path};
 
     croak "$args{path} seems not shipwright's own file"
-      unless -e catfile( Shipwright::Util->share_root,
-        $args{path} );
+      unless -e catfile( Shipwright::Util->share_root, $args{path} );
 
     return $self->_update_file( $args{path},
         catfile( Shipwright::Util->share_root, $args{path} ) );
@@ -612,11 +613,11 @@
         @names_to_trim = $args{name};
     }
 
-    my $order = $self->order;
-    my $map = $self->map;
+    my $order   = $self->order;
+    my $map     = $self->map;
     my $version = $self->version || {};
-    my $source  = $self->source  || {};
-    my $flags   = $self->flags   || {};
+    my $source  = $self->source || {};
+    my $flags   = $self->flags || {};
 
     for my $name (@names_to_trim) {
         $self->delete( path => "/sources/$name" );
@@ -659,23 +660,27 @@
 =cut
 
 sub update_refs {
-    my $self = shift;
+    my $self  = shift;
     my $order = $self->order;
-    my $refs = {};
+    my $refs  = {};
 
     for my $name (@$order) {
+
         # initialize here, in case we don't have $name entry in $refs
         $refs->{$name} ||= 0;
 
-        my $out = Shipwright::Util->run( $self->_cmd( 'cat', path =>
-                    "/scripts/$name/require.yml"), 1 );
+        my $out = Shipwright::Util->run(
+            $self->_cmd( 'cat', path => "/scripts/$name/require.yml" ), 1 );
 
         my $req = Shipwright::Util::Load($out) || {};
 
         my @deps;
         if ( $req->{requires} ) {
-            @deps = ( keys %{ $req->{requires} }, keys %{ $req->{recommends} },
-              keys %{ $req->{build_requires} } );
+            @deps = (
+                keys %{ $req->{requires} },
+                keys %{ $req->{recommends} },
+                keys %{ $req->{build_requires} }
+            );
         }
         else {
 
@@ -690,7 +695,7 @@
         }
     }
 
-    $self->refs( $refs );
+    $self->refs($refs);
 }
 
 =item has_branch_support
@@ -705,10 +710,8 @@
     return;
 }
 
-
 *_cmd = *_update_file = *_subclass_method;
 
-
 =back
 
 =cut



More information about the Bps-public-commit mailing list