* Cleanup.
This commit is contained in:
parent
f789ea1d09
commit
f106868110
1 changed files with 9 additions and 5 deletions
|
@ -224,13 +224,14 @@ writeManifest $manifest, \%narFiles, \%patches;
|
||||||
sub copyFile {
|
sub copyFile {
|
||||||
my $src = shift;
|
my $src = shift;
|
||||||
my $dst = shift;
|
my $dst = shift;
|
||||||
system("@coreutils@/cp", $src, "$dst.tmp") == 0 or die "cannot copy file";
|
my $tmp = "$dst.tmp.$$";
|
||||||
rename("$dst.tmp", "$dst") or die "cannot rename file";
|
system("@coreutils@/cp", $src, $tmp) == 0 or die "cannot copy file";
|
||||||
|
rename($tmp, $dst) or die "cannot rename file: $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Upload the archives.
|
# Upload/copy the archives.
|
||||||
print STDERR "uploading archives...\n";
|
print STDERR "uploading/copying archives...\n";
|
||||||
|
|
||||||
sub archiveExists {
|
sub archiveExists {
|
||||||
my $name = shift;
|
my $name = shift;
|
||||||
|
@ -244,9 +245,12 @@ foreach my $narArchive (@narArchives) {
|
||||||
my $basename = $1;
|
my $basename = $1;
|
||||||
|
|
||||||
if ($localCopy) {
|
if ($localCopy) {
|
||||||
|
# Since nix-push creates $dst atomically, if it exists we
|
||||||
|
# don't have to copy again.
|
||||||
|
my $dst = "$localArchivesDir/$basename";
|
||||||
if (! -f "$localArchivesDir/$basename") {
|
if (! -f "$localArchivesDir/$basename") {
|
||||||
print STDERR " $narArchive\n";
|
print STDERR " $narArchive\n";
|
||||||
copyFile $narArchive, "$localArchivesDir/$basename";
|
copyFile $narArchive, $dst;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue