* Copy nixexprs.tar.bz2.

* Don't do anything if we get a server error.  Otherwise we might end
  up destroying the target channel.


git-svn-id: https://nixos.org/repos/nix/release/trunk/channels@15115 70bd8c7a-acb8-0310-9f0d-9cc1c95dcdbb
This commit is contained in:
Eelco Dolstra 2009-04-17 13:48:30 +00:00
parent a5c419b725
commit cfdd333199

View file

@ -16,8 +16,7 @@ my $dstChannelPath = $ARGV[2];
die "$dstChannelPath doesn't exist\n" unless -d $dstChannelPath;
my ($fh, $tmpManifest) = tempfile(UNLINK => 1);
print "$tmpManifest\n";
system("curl '$srcChannelURL/MANIFEST' > $tmpManifest") == 0 or die;
system("curl --fail '$srcChannelURL/MANIFEST' > $tmpManifest") == 0 or die;
# Read the manifest.
my %narFiles;
@ -47,7 +46,7 @@ while (my ($storePath, $files) = each %narFiles) {
if (! -e $dstFile) {
print "downloading $srcURL\n";
my $dstFileTmp = "$dstChannelPath/.tmp.$$.nar.$dstName";
system("curl '$srcURL' > $dstFileTmp") == 0 or die;
system("curl --fail '$srcURL' > $dstFileTmp") == 0 or die;
rename($dstFileTmp, $dstFile) or die "cannot rename $dstFileTmp";
}
@ -72,3 +71,8 @@ while (my ($storePath, $files) = each %narFiles) {
# Write the new manifest.
writeManifest("$dstChannelPath/MANIFEST", \%narFiles, \%patches);
# Mirror nixexprs.tar.bz2.
my $tmpFile = "$dstChannelPath/.tmp.$$.nixexprs.tar.bz2";
system("curl --fail '$srcChannelURL/nixexprs.tar.bz2' > $tmpFile") == 0 or die;
rename($tmpFile, "$dstChannelPath/nixexprs.tar.bz2") or die "cannot rename $tmpFile";