diff --git a/scripts/nix-push.in b/scripts/nix-push.in index 35ad43d283..45a0695a64 100755 --- a/scripts/nix-push.in +++ b/scripts/nix-push.in @@ -24,22 +24,15 @@ $curl = "$curl $extraCurlFlags" if defined $extraCurlFlags; # Parse the command line. my $compressionType = "xz"; my $force = 0; - -my $localCopy; -my $localArchivesDir; - -my $archivesPutURL; -my $archivesGetURL; - +my $destDir; my @roots; sub showSyntax { print STDERR <) { close READ or die "nix-build failed: $?"; -# Upload the archives and the corresponding info files. -print STDERR "uploading/copying archives...\n"; +# Copy the archives and the corresponding info files. +print STDERR "copying archives...\n"; my $totalNarSize = 0; my $totalCompressedSize = 0; @@ -183,24 +169,15 @@ for (my $n = 0; $n < scalar @storePaths; $n++) { printf STDERR "%s [%.2f MiB, %.1f%%]\n", $storePath, $compressedSize / (1024 * 1024), $compressedSize / $narSize * 100; - # Upload the compressed NAR. - if ($localCopy) { - my $dst = "$localArchivesDir/$narName"; - if (! -f $dst) { - my $tmp = "$localArchivesDir/.tmp.$$.$narName"; - copy($narFile, $tmp) or die "cannot copy $narFile to $tmp: $!\n"; - rename($tmp, $dst) or die "cannot rename $tmp to $dst: $!\n"; - } - } else { - die "unimplemented"; - #if (!archiveExists("$basename")) { - # system("$curl --show-error --upload-file " . - # "'$narArchive' '$archivesPutURL/$basename' > /dev/null") == 0 or - # die "curl failed on $narArchive: $?"; - #} + # Copy the compressed NAR. + my $dst = "$destDir/$narName"; + if (! -f $dst) { + my $tmp = "$destDir/.tmp.$$.$narName"; + copy($narFile, $tmp) or die "cannot copy $narFile to $tmp: $!\n"; + rename($tmp, $dst) or die "cannot rename $tmp to $dst: $!\n"; } - # Upload the info file. + # Write the info file. my $info; $info .= "StorePath: $storePath\n"; $info .= "URL: $narName\n"; @@ -220,17 +197,13 @@ for (my $n = 0; $n < scalar @storePaths; $n++) { my $pathHash = substr(basename($storePath), 0, 32); - if ($localCopy) { - my $dst = "$localArchivesDir/$pathHash.narinfo"; - if ($force || ! -f $dst) { - my $tmp = "$localArchivesDir/.tmp.$$.$pathHash.narinfo"; - open INFO, ">$tmp" or die; - print INFO "$info" or die; - close INFO or die; - rename($tmp, $dst) or die "cannot rename $tmp to $dst: $!\n"; - } - } else { - die "unimplemented"; + $dst = "$destDir/$pathHash.narinfo"; + if ($force || ! -f $dst) { + my $tmp = "$destDir/.tmp.$$.$pathHash.narinfo"; + open INFO, ">$tmp" or die; + print INFO "$info" or die; + close INFO or die; + rename($tmp, $dst) or die "cannot rename $tmp to $dst: $!\n"; } }