From 60340ce3e2f793caf1704997a4d7a5a066e9ef24 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 9 Apr 2015 11:42:04 +0200 Subject: Implement caching of fetchurl/fetchTarball results ETags are used to prevent redownloading unchanged files. --- src/nix-env/profiles.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src/nix-env/profiles.cc') diff --git a/src/nix-env/profiles.cc b/src/nix-env/profiles.cc index d8eb0ef5269c..d93d7fd80920 100644 --- a/src/nix-env/profiles.cc +++ b/src/nix-env/profiles.cc @@ -116,16 +116,7 @@ void switchLink(Path link, Path target) /* Hacky. */ if (dirOf(target) == dirOf(link)) target = baseNameOf(target); - Path tmp = canonPath(dirOf(link) + "/.new_" + baseNameOf(link)); - createSymlink(target, tmp); - /* The rename() system call is supposed to be essentially atomic - on Unix. That is, if we have links `current -> X' and - `new_current -> Y', and we rename new_current to current, a - process accessing current will see X or Y, but never a - file-not-found or other error condition. This is sufficient to - atomically switch user environments. */ - if (rename(tmp.c_str(), link.c_str()) != 0) - throw SysError(format("renaming ‘%1%’ to ‘%2%’") % tmp % link); + replaceSymlink(target, link); } -- cgit 1.4.1