* nix-copy-closure: make sure that the shell doesn't do globbing of
`+' and `?' in filenames. This is very slow if /nix/store is very large. (This is a quick hack - a cleaner solution would be to bypass the shell entirely.)
This commit is contained in:
		
							parent
							
								
									3dd02580e3
								
							
						
					
					
						commit
						f1a6b97639
					
				
					 1 changed files with 6 additions and 6 deletions
				
			
		| 
						 | 
					@ -61,7 +61,7 @@ if ($toMode) { # Copy TO the remote machine.
 | 
				
			||||||
    my @allStorePaths;
 | 
					    my @allStorePaths;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Get the closure of this path.
 | 
					    # Get the closure of this path.
 | 
				
			||||||
    my $pid = open(READ, "$binDir/nix-store --query --requisites @storePaths|") or die;
 | 
					    my $pid = open(READ, "set -f; $binDir/nix-store --query --requisites @storePaths|") or die;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    while (<READ>) {
 | 
					    while (<READ>) {
 | 
				
			||||||
        chomp;
 | 
					        chomp;
 | 
				
			||||||
| 
						 | 
					@ -73,7 +73,7 @@ if ($toMode) { # Copy TO the remote machine.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Ask the remote host which paths are invalid.
 | 
					    # Ask the remote host which paths are invalid.
 | 
				
			||||||
    open(READ, "ssh $sshHost @sshOpts nix-store --check-validity --print-invalid @allStorePaths|");
 | 
					    open(READ, "set -f; ssh $sshHost @sshOpts nix-store --check-validity --print-invalid @allStorePaths|");
 | 
				
			||||||
    my @missing = ();
 | 
					    my @missing = ();
 | 
				
			||||||
    while (<READ>) {
 | 
					    while (<READ>) {
 | 
				
			||||||
        chomp;
 | 
					        chomp;
 | 
				
			||||||
| 
						 | 
					@ -88,7 +88,7 @@ if ($toMode) { # Copy TO the remote machine.
 | 
				
			||||||
        print STDERR "  $_\n" foreach @missing;
 | 
					        print STDERR "  $_\n" foreach @missing;
 | 
				
			||||||
        my $extraOpts = "";
 | 
					        my $extraOpts = "";
 | 
				
			||||||
        $extraOpts .= "--sign" if $sign == 1;
 | 
					        $extraOpts .= "--sign" if $sign == 1;
 | 
				
			||||||
        system("nix-store --export $extraOpts @missing $compressor | ssh $sshHost @sshOpts '$decompressor nix-store --import'") == 0
 | 
					        system("set -f; nix-store --export $extraOpts @missing $compressor | ssh $sshHost @sshOpts '$decompressor nix-store --import'") == 0
 | 
				
			||||||
            or die "copying store paths to remote machine `$sshHost' failed: $?";
 | 
					            or die "copying store paths to remote machine `$sshHost' failed: $?";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -101,7 +101,7 @@ else { # Copy FROM the remote machine.
 | 
				
			||||||
    # machine.  Paths are assumed to be store paths; there is no
 | 
					    # machine.  Paths are assumed to be store paths; there is no
 | 
				
			||||||
    # resolution (following of symlinks).
 | 
					    # resolution (following of symlinks).
 | 
				
			||||||
    my $pid = open(READ,
 | 
					    my $pid = open(READ,
 | 
				
			||||||
        "ssh @sshOpts $sshHost nix-store --query --requisites @storePaths|") or die;
 | 
					        "set -f; ssh @sshOpts $sshHost nix-store --query --requisites @storePaths|") or die;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    my @allStorePaths;
 | 
					    my @allStorePaths;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ else { # Copy FROM the remote machine.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # What paths are already valid locally?
 | 
					    # What paths are already valid locally?
 | 
				
			||||||
    open(READ, "@bindir@/nix-store --check-validity --print-invalid @allStorePaths|");
 | 
					    open(READ, "set -f; @bindir@/nix-store --check-validity --print-invalid @allStorePaths|");
 | 
				
			||||||
    my @missing = ();
 | 
					    my @missing = ();
 | 
				
			||||||
    while (<READ>) {
 | 
					    while (<READ>) {
 | 
				
			||||||
        chomp;
 | 
					        chomp;
 | 
				
			||||||
| 
						 | 
					@ -130,7 +130,7 @@ else { # Copy FROM the remote machine.
 | 
				
			||||||
        print STDERR "  $_\n" foreach @missing;
 | 
					        print STDERR "  $_\n" foreach @missing;
 | 
				
			||||||
        my $extraOpts = "";
 | 
					        my $extraOpts = "";
 | 
				
			||||||
        $extraOpts .= "--sign" if $sign == 1;
 | 
					        $extraOpts .= "--sign" if $sign == 1;
 | 
				
			||||||
        system("ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor @bindir@/nix-store --import") == 0
 | 
					        system("set -f; ssh $sshHost @sshOpts 'nix-store --export $extraOpts @missing $compressor' | $decompressor @bindir@/nix-store --import") == 0
 | 
				
			||||||
            or die "copying store paths from remote machine `$sshHost' failed: $?";
 | 
					            or die "copying store paths from remote machine `$sshHost' failed: $?";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue