[Bps-public-commit] r10242 - in bpsbuilder/BPB/lib/BPB: Backend

sunnavy at bestpractical.com sunnavy at bestpractical.com
Thu Jan 3 13:47:39 EST 2008


Author: sunnavy
Date: Thu Jan  3 13:47:39 2008
New Revision: 10242

Modified:
   bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
   bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
   bpsbuilder/BPB/lib/BPB/Source/Compressed.pm

Log:
substitute `` to run in Util.pm

Modified: bpsbuilder/BPB/lib/BPB/Backend/SVK.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVK.pm	Thu Jan  3 13:47:39 2008
@@ -204,18 +204,21 @@
 sub update_order {
     my $self = shift;
     $self->log->info( "update order for " . $self->repository );
-    my $cmd   = 'svk ls ' . $self->repository . '/scripts';
-    my @dists = `$cmd`;
+
+    my ($out) =
+      BPB::Util->run( [ 'svk', 'ls', $self->repository . '/scripts' ] );
+    my $sep = $/;
+    my @dists = split /$sep/, $out;
+
     chomp @dists;
 
     my $require;
 
     for (@dists) {
         s{/$}{};
-        my $cmd    = 'svk cat ' . $self->repository . "/scripts/$_/require.yml";
-        my $string = `$cmd`;
+        my ($string) = BPB::Util->run(
+            [ 'svk', 'cat', $self->repository . "/scripts/$_/require.yml" ] );
         my $req    = BPB::Config::Load($string);
-        use Data::Dumper;
         $require->{$_} = [ keys %$req ];
     }
 
@@ -247,9 +250,9 @@
         $self->checkout( detach => 1, target => $file );
     }
     else {
-        my $cmd    = 'svk cat ' . $self->repository . '/bpb/order.yml';
-        my $string = `$cmd`;
-        return BPB::Config::Load($string);
+        my ($out) = BPB::Util->run(
+            [ 'svk', 'cat', $self->repository . '/bpb/order.yml' ] );
+        return BPB::Config::Load($out);
     }
 }
 

Modified: bpsbuilder/BPB/lib/BPB/Backend/SVN.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Backend/SVN.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Backend/SVN.pm	Thu Jan  3 13:47:39 2008
@@ -200,18 +200,20 @@
 sub update_order {
     my $self = shift;
     $self->log->info( "update order for " . $self->repository );
-    my $cmd   = 'svn ls ' . $self->repository . '/scripts';
-    my @dists = `$cmd`;
+
+    my ($out) =
+      BPB::Util->run( [ 'svn', 'ls', $self->repository . '/scripts' ] );
+    my $sep = $/;
+    my @dists = split /$sep/, $out;
     chomp @dists;
 
     my $require;
 
     for (@dists) {
         s{/$}{};
-        my $cmd    = 'svn cat ' . $self->repository . "/scripts/$_/require.yml";
-        my $string = `$cmd`;
+        my ($string) = BPB::Util->run(
+            [ 'svn', 'cat', $self->repository . "/scripts/$_/require.yml" ] );
         my $req    = BPB::Config::Load($string);
-        use Data::Dumper;
         $require->{$_} = [ keys %$req ];
     }
 
@@ -243,9 +245,9 @@
 
     }
     else {
-        my $cmd    = 'svn cat ' . $self->repository . '/bpb/order.yml';
-        my $string = `$cmd`;
-        return BPB::Config::Load($string);
+        my ($out) = BPB::Util->run(
+            [ 'svn', 'cat', $self->repository . '/bpb/order.yml' ] );
+        return BPB::Config::Load($out);
     }
 }
 

Modified: bpsbuilder/BPB/lib/BPB/Source/Compressed.pm
==============================================================================
--- bpsbuilder/BPB/lib/BPB/Source/Compressed.pm	(original)
+++ bpsbuilder/BPB/lib/BPB/Source/Compressed.pm	Thu Jan  3 13:47:39 2008
@@ -15,7 +15,7 @@
     my $self = shift;
     $self->log->info(
         'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
-    my $ret  = $self->SUPER::run(@_);
+    my $ret = $self->SUPER::run(@_);
     $self->_follow(
         File::Spec->catfile( $self->directory, $self->name || $self->path ) )
       if $self->follow;
@@ -29,9 +29,11 @@
 =cut
 
 sub path {
-    my $self     = shift;
-    my $source   = $self->source;
-    my @contents = `tar -t -f $source`;
+    my $self   = shift;
+    my $source = $self->source;
+    my ($out) = BPB::Util->run( [ 'tar', '-t', '-f', $source ] );
+    my $sep = $/;
+    my @contents = split /$sep/, $out;
     my %path;
 
     for (@contents) {



More information about the Bps-public-commit mailing list