t testing
authorHeiko Schlittermann (JUMPER) <hs@schlittermann.de>
Sun, 31 Jul 2011 23:54:57 +0200
branchtesting
changeset 46 8b655cc9bd27
parent 45 9362fac2a7c8
child 47 9a717ec183a2
child 59 e842a330ae51
t
bin/imager.save
--- a/bin/imager.save	Sun Jul 31 23:47:09 2011 +0200
+++ b/bin/imager.save	Sun Jul 31 23:54:57 2011 +0200
@@ -51,9 +51,9 @@
                 -noperldoc => system("perldoc -V >/dev/null 2>&1")
             );
         },
-	"t|threads:i"   => sub { $o{threads} = $_[1] ? $_[1] : 2 },
-        "c|comment=s"   => \$o{comment},
-        "z|compress:i"  => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED },
+        "t|threads:i"  => sub { $o{threads}  = $_[1] ? $_[1] : 2 },
+        "c|comment=s"  => \$o{comment},
+        "z|compress:i" => sub { $o{compress} = $_[1] ? $_[1] : Z_BEST_SPEED },
         "p|pass=s"      => \$o{pass},
         "b|blocksize=s" => sub {
             given ($_[1]) {
@@ -105,15 +105,15 @@
 
     my %index;
     $index{META} = {
-	format => 1,
-	host => hostname,
-	filesystem => $src,
-	blocksize => $o{blocksize},
-	devsize => $size,
-	timestamp => NOW,
-	datetime => DATETIME,
-	(defined $o{comment} ? (comment => $o{comment}) : ()),
-	encryption => $o{pass} ? CIPHER : "none",
+        format     => 1,
+        host       => hostname,
+        filesystem => $src,
+        blocksize  => $o{blocksize},
+        devsize    => $size,
+        timestamp  => NOW,
+        datetime   => DATETIME,
+        (defined $o{comment} ? (comment => $o{comment}) : ()),
+        encryption => $o{pass} ? CIPHER : "none",
     };
 
     open(my $in => $src);
@@ -151,8 +151,8 @@
         $ext .= $o{pass}     ? ".x"  : "";
 
         # the extension we do not put into the index
-	push @{$index{BLOCKS}},
-	    sprintf "%12d %s %s" => ($. - 1), $cs, $file;
+        push @{ $index{BLOCKS} }, sprintf "%12d %s %s" => ($. - 1),
+          $cs,                    $file;
 
         if (
             not(   -e "$data/$file"
@@ -183,7 +183,7 @@
             else { print {$out} $buffer }
             close($out);
             rename($out => "$data/$file$ext");
-	    $index{BLOCKS}[$. - 1] .= " *";
+            $index{BLOCKS}[$. - 1] .= " *";
             $stats{written}++;
         }
         else {
@@ -193,15 +193,14 @@
     $SIG{ALRM}->();
     alarm 0;
 
-    $index{META}{blocks} = @{$index{BLOCKS}};
+    $index{META}{blocks}  = @{ $index{BLOCKS} };
     $index{META}{runtime} = time() - $^T . "s";
 
     my $index = File::Temp->new(DIR => $idx);
-    say $index join "\n" =>
-	"# imager",
-	(map { "$_: $index{META}{$_}" } sort(keys %{$index{META}})),
-	"",
-	@{$index{BLOCKS}};
+    say $index join "\n" => "# imager",
+      (map { "$_: $index{META}{$_}" } sort(keys %{ $index{META} })),
+      "",
+      @{ $index{BLOCKS} };
     close($index);
     rename $index->filename => "$idx/" . DATETIME;