Author: eelco
Date: Mon Apr 11 08:21:30 2011
New Revision: 26774
URL: https://svn.nixos.org/websvn/nix/?rev=26774&sc=1

Log:
* Subtle bug: if you import File::stat in one module, it affects other
  modules as well.  So use symbolic field names everywhere (which is
  nicer anyway).

Modified:
   nix/trunk/scripts/GeneratePatches.pm.in
   nix/trunk/scripts/nix-push.in

Modified: nix/trunk/scripts/GeneratePatches.pm.in
==============================================================================
--- nix/trunk/scripts/GeneratePatches.pm.in     Mon Apr 11 08:06:14 2011        
(r26773)
+++ nix/trunk/scripts/GeneratePatches.pm.in     Mon Apr 11 08:21:30 2011        
(r26774)
@@ -2,6 +2,7 @@
 
 use strict;
 use File::Temp qw(tempdir);
+use File::stat;
 
 
 # Some patch generations options.
@@ -205,7 +206,7 @@
             system("@bunzip2@ < $srcNarBz2 > $tmpDir/A") == 0
                 or die "cannot unpack $srcNarBz2";
 
-            if ((stat "$tmpDir/A")[7] >= $maxNarSize) {
+            if (stat("$tmpDir/A")->size >= $maxNarSize) {
                 print "    skipping, source is too large\n";
                 next;
             }
@@ -213,7 +214,7 @@
             system("@bunzip2@ < $dstNarBz2 > $tmpDir/B") == 0
                 or die "cannot unpack $dstNarBz2";
 
-            if ((stat "$tmpDir/B")[7] >= $maxNarSize) {
+            if (stat("$tmpDir/B")->size >= $maxNarSize) {
                 print "    skipping, destination is too large\n";
                 next;
             }
@@ -235,8 +236,8 @@
             my $narDiffHash = `@bindir@/nix-hash --flat --type $hashAlgo 
--base32 $tmpDir/DIFF` or die;
             chomp $narDiffHash;
 
-            my $narDiffSize = (stat "$tmpDir/DIFF")[7];
-            my $dstNarBz2Size = (stat $dstNarBz2)[7];
+            my $narDiffSize = stat("$tmpDir/DIFF")->size;
+            my $dstNarBz2Size = stat($dstNarBz2)->size;
 
             print "    size $narDiffSize; full size $dstNarBz2Size; ", $time2 
- $time1, " seconds\n";
         

Modified: nix/trunk/scripts/nix-push.in
==============================================================================
--- nix/trunk/scripts/nix-push.in       Mon Apr 11 08:06:14 2011        (r26773)
+++ nix/trunk/scripts/nix-push.in       Mon Apr 11 08:21:30 2011        (r26774)
@@ -2,6 +2,7 @@
 
 use strict;
 use File::Temp qw(tempdir);
+use File::stat;
 use NixManifest;
 
 my $hashAlgo = "sha256";
@@ -178,7 +179,7 @@
     (-f $narFile) or die "narfile for $storePath not found";
     push @narArchives, $narFile;
 
-    my $narbz2Size = (stat $narFile)[7];
+    my $narbz2Size = stat($narFile)->size;
 
     my $references = `$binDir/nix-store --query --references '$storePath'`;
     die "cannot query references for `$storePath'" if $? != 0;
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to