From cfdd3331999b5223e2db908784eb37ee6dca5301 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 17 Apr 2009 13:48:30 +0000 Subject: [PATCH] * 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 --- mirror-channel.pl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mirror-channel.pl b/mirror-channel.pl index e72e647..83a6bcb 100644 --- a/mirror-channel.pl +++ b/mirror-channel.pl @@ -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";