[svk-commit] r2451 - trunk/pkg

nobody at bestpractical.com nobody at bestpractical.com
Sun Jul 15 17:46:19 EDT 2007


Author: clkao
Date: Sun Jul 15 17:46:19 2007
New Revision: 2451

Modified:
   trunk/pkg/buildsvk.pl

Log:
File::chdir is the future.

Modified: trunk/pkg/buildsvk.pl
==============================================================================
--- trunk/pkg/buildsvk.pl	(original)
+++ trunk/pkg/buildsvk.pl	Sun Jul 15 17:46:19 2007
@@ -189,19 +189,19 @@
 sub build_archive {
     my $self = shift;
     my $path = shift;
-    my $olddir = `pwd`;
-    chomp($olddir);
-    chdir($self->build_base);
-    warn "In ".$self->build_base . " looking for ". $path;
-    my @cmd = ( 'tar', 'czvf' , "$olddir/$path.tgz", $path);
-    system( @cmd);
-    if ($!) { die "Failed to create tarball: ". $! .  join (' ', at cmd);}
-    chdir($olddir);
+    my $olddir = $CWD;
+    {
+	local $CWD = $self->build_base;
+	warn "In ".$self->build_base . " looking for ". $path;
+	my @cmd = ( 'tar', 'czvf' , "$olddir/$path.tgz", $path);
+	system( @cmd);
+	if ($!) { die "Failed to create tarball: ". $! .  join (' ', at cmd);}
+    }
     if (-f "$path.tgz" ) {
 
         print "Congratulations! You have a new build of $path in ".$olddir."/".$path.".tgz\n";
     } else { 
-        print "Couldn't build ".$self->build_base."/$path into a tarball\n";
+        warn "Couldn't build ".$self->build_base."/$path into a tarball\n";
     }
 }
 


More information about the svk-commit mailing list