In particular the /pkg action is now O(lg n) instead of O(n) in the number of packages in the channel, and listing the channel contents no longer requires calling isValidPath() on all packages.
Derivations (and thus build time dependencies) are no longer included in the channel, because they're not GC roots. Thus they could disappear unexpectedly.
HXBXDEFK2VLXZIWUXAQ765NHKYQ5FYS43IKMU2DJ755L26TQ6IFQC
HGVQUIUXTE3UIM43KQKIDYFVWT3HHU4RC2OX2NFMNJ5PXS5YVGAQC
JO6L3MIJMRNHBSRRWNF54XIMUZ45QEYOUSAEWVKFTAMM53N5WVUQC
7G5RWHB7MRELVG2X5VXQE2T2JROZQNUQPTUIIVOHUQIIXBZIDZOAC
N45RZUQ6E7XXUPVWMR2SSZZB57ZD236PEMBCCOCAQOUOYFVJDBXQC
AKAZKCR6GFCZQBR2ZJSZEI3SXW4S25V7X7JGHUYNUITQQSAVAF5AC
Z4KRJX4QVMQ5F233DC3XMSE5ZJYHKX3UF5QWAGHDC54EC5NUBXUQC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
5NO7NCKTMM5ZW7JYOETUFOSWK2ACTXWDZGJAFXZN6L3OF6BFTNOQC
MVB7RRLTOLZALMUVUNSCMXDB76QLICJAV2GYQQZO7E6S327LHMSQC
XHVZXX6NVBQCZQ2GL2AQ6QDIJMERIY6OF74KSTQL67BGXG3TFIXQC
BHZXGT2HWAMFNVBUDG7VR5HNA2SUJBUSMWB7EHTECB4QJ5HVYANAC
UXVDOUBJHQF3MB2GDKHJYRZ6PWHZE3R2JEZYQBT5NQXUYSZW56LAC
LBNVQXUBEZ45SOTGVXK5UEZXIAIZTJLWZNUYFI4JZ6J65N3KPDVQC
2JQ7WEFMU5IPCUKLGRLVVT4MYMKVHJDZVMOOOPL6K5RLEZ532LGQC
TPDJL4TYC537S67K7T4FOVOIWOB7VPTN4ZPMG2SL2ZPILR42VIOQC
A52HEFHQNVNF2OUSWDSUYVVXLYR2UFCGOORPCN27CJJYA4UDJA3AC
RI4S7SYT3QKWCR2OBQ3RGVHWHRBGB6PKIEVGZYITV3FF6PF3CT6QC
7UJ5YV4VUSXMKB57KKXDG6KLIXMQXO45VO5UTOT46BHQJBFZ7XKQC
SJN2QPWHFYKX7CJMW4XZHI2P2THH7MECZZIHQMCH6EKBZ45G3DOAC
2I2ZX6JBPIM5D57G52MGHKUD66CJMOYAYNYN6CSHNUHAFA46A5YQC
HPEG2RHVNHOPB5T4ZRXANIRBMVOVY3B5GFETJRYOTDJFVAYH2TQAC
7DWCXNC72OO3M4YGNVV4KM775CUSPBHEFFNMRIA2XAZTQCXYHBRQC
FM4O2L4MNPCHWRDRHKGKSH5TFFX6R2RMCPEQ3XCECA6UVLJPLUVQC
getChannelData($c, scalar($c->stash->{latestSucceeded}));
$c->stash->{channelBuilds} = $c->stash->{latestSucceeded}
->search_literal("exists (select 1 from buildproducts where build = me.id and type = 'nix-build')")
->search({}, { columns => [@buildListColumns, 'drvpath', 'outpath', 'description', 'homepage'] });
sub getChannelData {
my ($c, $checkValidity) = @_;
my @storePaths = ();
foreach my $build ($c->stash->{channelBuilds}->all) {
next if $checkValidity && !isValidPath($build->outpath);
#if (isValidPath($build->drvpath)) {
# # Adding `drvpath' implies adding `outpath' because of the
# # `--include-outputs' flag passed to `nix-store'.
# push @storePaths, $build->drvpath;
#} else {
# push @storePaths, $build->outpath;
#}
push @storePaths, $build->outpath;
my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id;
$c->stash->{nixPkgs}->{"${pkgName}.nixpkg"} = {build => $build, name => $pkgName};
# Put the system type in the manifest (for top-level paths) as
# a hint to the binary patch generator. (It shouldn't try to
# generate patches between builds for different systems.) It
# would be nice if Nix stored this info for every path but it
# doesn't.
$c->stash->{systemForPath}->{$build->outpath} = $build->system;
};
my $pkg = $c->stash->{nixPkgs}->{$pkgName};
if (!$c->stash->{build}) {
$pkgName =~ /-(\d+)\.nixpkg$/ or notFound($c, "Bad package name.");
$c->stash->{build} = $c->stash->{channelBuilds}->find({ id => $1 })
|| notFound($c, "No such package in this channel.");
}
notFound($c, "Unknown Nix package `$pkgName'.")
unless defined $pkg;
$c->stash->{build} = $pkg->{build};
if (!isValidPath($c->stash->{build}->outpath)) {
$c->response->status(410); # "Gone"
error($c, "Build " . $c->stash->{build}->id . " is no longer available.");
}
$c->stash->{storePaths} = [$build->outpath];
my $pkgName = $build->nixname . "-" . $build->system;
$c->stash->{nixPkgs} = {"${pkgName}.nixpkg" => {build => $build, name => $pkgName}};
$c->stash->{channelBuilds} = $c->model('DB::Builds')->search({id => $build->id});
my @builds2 = $builds
->search_literal("exists (select 1 from buildproducts where build = me.id and type = 'nix-build')")
->search({}, { columns => [@buildListColumns, 'drvpath', 'outpath', 'description', 'homepage'] });
my @storePaths = ();
foreach my $build (@builds2) {
next unless isValidPath($build->outpath);
if (isValidPath($build->drvpath)) {
# Adding `drvpath' implies adding `outpath' because of the
# `--include-outputs' flag passed to `nix-store'.
push @storePaths, $build->drvpath;
} else {
push @storePaths, $build->outpath;
}
my $pkgName = $build->nixname . "-" . $build->system . "-" . $build->id;
$c->stash->{nixPkgs}->{"${pkgName}.nixpkg"} = {build => $build, name => $pkgName};
# Put the system type in the manifest (for top-level paths) as
# a hint to the binary patch generator. (It shouldn't try to
# generate patches between builds for different systems.) It
# would be nice if Nix stored this info for every path but it
# doesn't.
$c->stash->{systemForPath}->{$build->outpath} = $build->system;
};
$c->stash->{storePaths} = [@storePaths];
}