From 312bab008d835dd9c8939b803d2bc7af4f82a811 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 7 Sep 2016 15:34:54 +0200 Subject: upload-release.pl: Update Nixpkgs --- maintainers/upload-release.pl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'maintainers') diff --git a/maintainers/upload-release.pl b/maintainers/upload-release.pl index 5c6bb5685fcc..6c9a724dd6a8 100755 --- a/maintainers/upload-release.pl +++ b/maintainers/upload-release.pl @@ -12,6 +12,7 @@ use LWP::UserAgent; my $evalId = $ARGV[0] or die "Usage: $0 EVAL-ID\n"; my $releasesDir = "/home/eelco/mnt/releases"; +my $nixpkgsDir = "/home/eelco/Dev/nixpkgs-pristine"; # FIXME: cut&paste from nixos-channel-scripts. sub fetch { @@ -84,6 +85,36 @@ my ($tarball_i686_linux, $tarball_i686_linux_hash) = downloadFile("binaryTarball my ($tarball_x86_64_linux, $tarball_x86_64_linux_hash) = downloadFile("binaryTarball.x86_64-linux", "1"); my ($tarball_x86_64_darwin, $tarball_x86_64_darwin_hash) = downloadFile("binaryTarball.x86_64-darwin", "1"); +# Update Nixpkgs in a very hacky way. +my $oldName = `nix-instantiate --eval $nixpkgsDir -A nix.name`; chomp $oldName; +my $oldHash = `nix-instantiate --eval $nixpkgsDir -A nix.src.outputHash`; chomp $oldHash; +print STDERR "old stable version in Nixpkgs = $oldName / $oldHash\n"; + +my $fn = "$nixpkgsDir/pkgs/tools/package-management/nix/default.nix"; +my $oldFile = read_file($fn); +$oldFile =~ s/$oldName/"$releaseName"/g; +$oldFile =~ s/$oldHash/"$tarballHash"/g; +write_file($fn, $oldFile); + +$oldName =~ s/nix-//g; +$oldName =~ s/"//g; + +sub getStorePath { + my ($jobName) = @_; + my $buildInfo = decode_json(fetch("$evalUrl/job/$jobName", 'application/json')); + die unless $buildInfo->{buildproducts}->{1}->{type} eq "nix-build"; + return $buildInfo->{buildproducts}->{1}->{path}; +} + +write_file("$nixpkgsDir/nixos/modules/installer/tools/nix-fallback-paths.nix", + "{\n" . + " x86_64-linux = \"" . getStorePath("build.x86_64-linux") . "\";\n" . + " i686-linux = \"" . getStorePath("build.i686-linux") . "\";\n" . + " x86_64-darwin = \"" . getStorePath("build.x86_64-darwin") . "\";\n" . + "}\n"); + +system("cd $nixpkgsDir && git commit -a -m 'nix: $oldName -> $version'") == 0 or die; + # Extract the HTML manual. File::Path::make_path("$releaseDir/manual"); -- cgit 1.4.1