diff --git a/delete-old-releases.sh b/delete-old-releases.sh index 4243bbd..b065daa 100755 --- a/delete-old-releases.sh +++ b/delete-old-releases.sh @@ -12,13 +12,15 @@ find /data/releases/nixos/ /data/releases/nixpkgs/ -maxdepth 1 -name ".tmp*" -mt done # Remove old NixOS releases. -find /data/releases/nixos/unstable/ /data/releases/nixos/??.??/ -maxdepth 1 -name "nixos-*pre*" -mtime +7 | sort | while read rel; do +find /data/releases/nixos/unstable/ /data/releases/nixos/unstable-small/ /data/releases/nixos/??.??/ /data/releases/nixos/??.??-small/ -maxdepth 1 -name "nixos-*pre*" -mtime +7 | sort | while read rel; do if [ -e $rel/keep ]; then echo "keeping NixOS release $rel" >&2 continue fi echo "removing old NixOS release $rel" >&2 - mv $rel $trash/ + dst=$trash/$(basename $(dirname $rel)) + mkdir -p $dst + mv $rel $dst/ done # Remove old Nixpkgs releases. diff --git a/generate-programs-index.pl b/generate-programs-index.pl index 3d3d921..af68382 100755 --- a/generate-programs-index.pl +++ b/generate-programs-index.pl @@ -3,9 +3,14 @@ use strict; use DBI; use DBD::SQLite; +use Nix::Manifest; my $nixExprs = $ARGV[0] or die; my $dbPath = $ARGV[1] or die; +my $manifestPath = $ARGV[2] or die; + +my (%narFiles, %patches); +readManifest("$manifestPath", \%narFiles, \%patches); my $dbh = DBI->connect("dbi:SQLite:dbname=$dbPath", "", "") or die "cannot open database `$dbPath'"; @@ -46,6 +51,7 @@ for my $system ("x86_64-linux", "i686-linux") { foreach my $line (split "\n", $out) { my ($name, $outPath) = split ' ', $line; die unless $name && $outPath; + next unless defined $narFiles{$outPath}; next unless -d $outPath; my $pkgname = $name; $pkgname =~ s/-\d.*//; diff --git a/mirror-nixos-branch.sh b/mirror-nixos-branch.sh index 412db28..32d480e 100755 --- a/mirror-nixos-branch.sh +++ b/mirror-nixos-branch.sh @@ -37,6 +37,8 @@ else tmpDir="$(dirname $releaseDir)/.tmp-$release-$$" mkdir -p $tmpDir + trap 'rm -rf -- "$tmpDir"' EXIT + echo $url > $tmpDir/src-url # Copy the manual. @@ -47,30 +49,35 @@ else ln -s manual.html $tmpDir/manual/index.html fi - $wget --directory=$tmpDir $url/job/nixos.iso_minimal.i686-linux/download $wget --directory=$tmpDir $url/job/nixos.iso_minimal.x86_64-linux/download - $wget --directory=$tmpDir $url/job/nixos.iso_graphical.i686-linux/download - $wget --directory=$tmpDir $url/job/nixos.iso_graphical.x86_64-linux/download - $wget --directory=$tmpDir $url/job/nixos.ova.i686-linux/download - $wget --directory=$tmpDir $url/job/nixos.ova.x86_64-linux/download + if ! [[ $branch =~ small ]]; then + $wget --directory=$tmpDir $url/job/nixos.iso_minimal.i686-linux/download + $wget --directory=$tmpDir $url/job/nixos.iso_graphical.x86_64-linux/download + $wget --directory=$tmpDir $url/job/nixos.iso_graphical.i686-linux/download + $wget --directory=$tmpDir $url/job/nixos.ova.x86_64-linux/download + $wget --directory=$tmpDir $url/job/nixos.ova.i686-linux/download + fi + shopt -s nullglob for i in $tmpDir/*.iso $tmpDir/*.ova; do nix-hash --type sha256 --flat $i > $i.sha256 done + shopt -u nullglob perl -w ./mirror-channel.pl "$url/channel" "$tmpDir" \ - nix-cache http://cache.nixos.org \ + nix-cache https://cache.nixos.org \ "$url/job/nixos.channel/download/1" # Generate the programs.sqlite database and put it in nixexprs.tar.xz. mkdir $tmpDir/unpack tar xfJ $tmpDir/nixexprs.tar.xz -C $tmpDir/unpack exprDir=$(echo $tmpDir/unpack/*) - ./generate-programs-index.pl "$exprDir" "$exprDir/programs.sqlite" + ./generate-programs-index.pl "$exprDir" "$exprDir/programs.sqlite" "$tmpDir/MANIFEST" tar cfJ $tmpDir/nixexprs.tar.xz -C $tmpDir/unpack "$(basename "$exprDir")" rm -rf $tmpDir/unpack mv $tmpDir $releaseDir + trap '' EXIT fi # Copy over to nixos.org.