diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-17T20·45-0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-17T20·58-0400 |
commit | 167e36a5c3127da63d120d9fdaf5e046b829f287 (patch) | |
tree | d396fefa5dd8e3d1d35b82722bce385dd734766c /scripts/nix-prefetch-url.in | |
parent | ac238d619c2469ea89b8707ae340d3f19c77eadf (diff) |
nix-push: Only generate and copy a NAR if it doesn't already exist
This prevents unnecessary and slow rebuilds of NARs that already exist in the binary cache.
Diffstat (limited to 'scripts/nix-prefetch-url.in')
-rwxr-xr-x | scripts/nix-prefetch-url.in | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/scripts/nix-prefetch-url.in b/scripts/nix-prefetch-url.in index eea2b814b733..64102e8ae84a 100755 --- a/scripts/nix-prefetch-url.in +++ b/scripts/nix-prefetch-url.in @@ -6,6 +6,7 @@ use File::Temp qw(tempdir); use File::stat; use Nix::Store; use Nix::Config; +use Nix::Utils; my $url = shift; my $expHash = shift; @@ -20,22 +21,6 @@ EOF exit 1; } -sub writeFile { - my ($fn, $s) = @_; - open TMP, ">$fn" or die; - print TMP "$s" or die; - close TMP or die; -} - -sub readFile { - local $/ = undef; - my ($fn) = @_; - open TMP, "<$fn" or die; - my $s = <TMP>; - close TMP or die; - return $s; -} - my $tmpDir = tempdir("nix-prefetch-url.XXXXXX", CLEANUP => 1, TMPDIR => 1) or die "cannot create a temporary directory"; |