* Some logging for evaluation.
This commit is contained in:
		
							parent
							
								
									6270aa727d
								
							
						
					
					
						commit
						581bcb986f
					
				
					 2 changed files with 16 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -4,12 +4,17 @@ use strict;
 | 
			
		|||
use readmanifest;
 | 
			
		||||
 | 
			
		||||
my $manifestDir = "@localstatedir@/nix/manifests";
 | 
			
		||||
my $logFile = "@localstatedir@/log/nix/downloads";
 | 
			
		||||
 | 
			
		||||
open LOGFILE, ">>$logFile" or die "cannot open log file $logFile";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Check the arguments.
 | 
			
		||||
die unless scalar @ARGV == 1;
 | 
			
		||||
my $targetPath = $ARGV[0];
 | 
			
		||||
 | 
			
		||||
print LOGFILE "$$ get $targetPath\n";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Load all manifests.
 | 
			
		||||
my %narFiles;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,12 +180,15 @@ while (scalar @path > 0) {
 | 
			
		|||
 | 
			
		||||
    if ($edge->{type} eq "present") {
 | 
			
		||||
        print "using already present path `$v'\n";
 | 
			
		||||
        print LOGFILE "$$ present $v\n";
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    elsif ($edge->{type} eq "patch") {
 | 
			
		||||
        my $patch = $edge->{info};
 | 
			
		||||
        print "applying patch `$patch->{url}' to `$u' to create `$v'\n";
 | 
			
		||||
 | 
			
		||||
        print LOGFILE "$$ patch $patch->{url} $patch->{size} $patch->{baseHash} $u $v\n";
 | 
			
		||||
 | 
			
		||||
        # Download the patch.
 | 
			
		||||
        print "  downloading patch...\n";
 | 
			
		||||
        my $patchPath = downloadFile "$patch->{url}", "$patch->{hash}";
 | 
			
		||||
| 
						 | 
				
			
			@ -206,6 +214,8 @@ while (scalar @path > 0) {
 | 
			
		|||
        my $narFile = $edge->{info};
 | 
			
		||||
        print "downloading `$narFile->{url}' into `$v'\n";
 | 
			
		||||
 | 
			
		||||
        print LOGFILE "$$ narfile $narFile->{url} $narFile->{size} $v\n";
 | 
			
		||||
        
 | 
			
		||||
        # Download the archive.
 | 
			
		||||
        print "  downloading archive...\n";
 | 
			
		||||
        my $narFilePath = downloadFile "$narFile->{url}", "$narFile->{hash}";
 | 
			
		||||
| 
						 | 
				
			
			@ -216,3 +226,7 @@ while (scalar @path > 0) {
 | 
			
		|||
        die "cannot unpack `$narFilePath' into `$targetPath'" if ($? != 0);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
print LOGFILE "$$ success\n";
 | 
			
		||||
close LOGFILE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -220,6 +220,8 @@ foreach my $p (keys %dstOutPaths) {
 | 
			
		|||
            next;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        print "    size $narDiffSize; full size $dstNarBz2Size\n";
 | 
			
		||||
        
 | 
			
		||||
        system("cp '$tmpdir/DIFF' '$patchesDir/$finalName.tmp'") == 0
 | 
			
		||||
            or die "cannot copy diff";
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue