From 13154f8e8611e76a19a532813ff4fe82389edbae Mon Sep 17 00:00:00 2001 From: Samuel Dionne-Riel Date: Tue, 24 Mar 2020 20:05:59 -0400 Subject: [PATCH] mirror: Convert all `system` use to `run*` --- mirror-nixos-branch.pl | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/mirror-nixos-branch.pl b/mirror-nixos-branch.pl index f773a84..1501330 100755 --- a/mirror-nixos-branch.pl +++ b/mirror-nixos-branch.pl @@ -159,7 +159,7 @@ if ($bucketReleases && $bucketReleases->head_key("$releasePrefix")) { if (! -e $dstFile) { print STDERR "downloading $srcFile to $dstFile...\n"; write_file("$dstFile.sha256", "$sha256_expected $dstName"); - system("NIX_REMOTE=https://cache.nixos.org/ nix --experimental-features nix-command cat-store '$srcFile' > '$dstFile.tmp'") == 0 + runAllowFailure("NIX_REMOTE=https://cache.nixos.org/ nix --experimental-features nix-command cat-store '$srcFile' > '$dstFile.tmp'") == 0 or die "unable to fetch $srcFile\n"; rename("$dstFile.tmp", $dstFile) or die; } @@ -201,18 +201,18 @@ if ($bucketReleases && $bucketReleases->head_key("$releasePrefix")) { # https://cache.nixos.org/debuginfo. if ($channelName =~ /nixos/ && -e "$tmpDir/store-paths") { File::Path::make_path("$tmpDir/unpack"); - system("tar", "xfJ", "$tmpDir/nixexprs.tar.xz", "-C", "$tmpDir/unpack") == 0 or die; + run("tar", "xfJ", "$tmpDir/nixexprs.tar.xz", "-C", "$tmpDir/unpack"); my $exprDir = glob("$tmpDir/unpack/*"); - system("generate-programs-index $filesCache $exprDir/programs.sqlite http://nix-cache.s3.amazonaws.com/ $tmpDir/store-paths $exprDir/nixpkgs") == 0 or die; - system("index-debuginfo $filesCache s3://nix-cache $tmpDir/store-paths") == 0 or die; - system("rm -f $tmpDir/nixexprs.tar.xz $exprDir/programs.sqlite-journal") == 0 or die; + run("generate-programs-index $filesCache $exprDir/programs.sqlite http://nix-cache.s3.amazonaws.com/ $tmpDir/store-paths $exprDir/nixpkgs"); + run("index-debuginfo $filesCache s3://nix-cache $tmpDir/store-paths"); + run("rm -f $tmpDir/nixexprs.tar.xz $exprDir/programs.sqlite-journal"); unlink("$tmpDir/nixexprs.tar.xz.sha256"); - system("tar", "cfJ", "$tmpDir/nixexprs.tar.xz", "-C", "$tmpDir/unpack", basename($exprDir)) == 0 or die; - system("rm -rf $tmpDir/unpack") == 0 or die; + run("tar", "cfJ", "$tmpDir/nixexprs.tar.xz", "-C", "$tmpDir/unpack", basename($exprDir)); + run("rm -rf $tmpDir/unpack"); } if (-e "$tmpDir/store-paths") { - system("xz", "$tmpDir/store-paths") == 0 or die; + run("xz", "$tmpDir/store-paths"); } my $now = strftime("%F %T", localtime); @@ -268,9 +268,9 @@ if ($dryRun) { # Update the nixos-* branch in the nixpkgs repo. Also update the # nixpkgs-channels repo for compatibility. -system("git remote update origin >&2") == 0 or die; -system("git push origin $rev:refs/heads/$channelName >&2") == 0 or die; -system("git push channels $rev:refs/heads/$channelName >&2") == 0 or die; +run("git remote update origin >&2"); +run("git push origin $rev:refs/heads/$channelName >&2"); +run("git push channels $rev:refs/heads/$channelName >&2"); sub redirect { my ($from, $to) = @_;