about summary refs log tree commit diff
diff options
context:
space:
mode:
-rwxr-xr-xscripts/GeneratePatches.pm.in9
-rw-r--r--scripts/nix-push.in3
2 files changed, 7 insertions, 5 deletions
diff --git a/scripts/GeneratePatches.pm.in b/scripts/GeneratePatches.pm.in
index 2d2653255e54..9d404e34001c 100755
--- a/scripts/GeneratePatches.pm.in
+++ b/scripts/GeneratePatches.pm.in
@@ -2,6 +2,7 @@
 
 use strict;
 use File::Temp qw(tempdir);
+use File::stat;
 
 
 # Some patch generations options.
@@ -205,7 +206,7 @@ sub generatePatches {
             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 @@ sub generatePatches {
             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 @@ sub generatePatches {
             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";
         
diff --git a/scripts/nix-push.in b/scripts/nix-push.in
index 7b9d521617d5..2d43031a47ff 100644
--- a/scripts/nix-push.in
+++ b/scripts/nix-push.in
@@ -2,6 +2,7 @@
 
 use strict;
 use File::Temp qw(tempdir);
+use File::stat;
 use NixManifest;
 
 my $hashAlgo = "sha256";
@@ -178,7 +179,7 @@ for (my $n = 0; $n < scalar @storePaths; $n++) {
     (-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;