Test the fake derivations channel, asserting nested packages are properly represented.

This is a breaking change. Previously, packages named `packageset.foo`
would be exposed in the fake derivation channel as `packageset-foo`.

Presumably this was done to avoid needing to track attribute sets, and
to avoid the complexity. I think this now correctly handles the
complexity and properly mirrors the input expressions layout.
This commit is contained in:
Graham Christensen
2021-03-17 11:20:19 -04:00
parent 88e0198a8e
commit 019aef3d41
3 changed files with 109 additions and 5 deletions

View File

@ -4,10 +4,11 @@ use strict;
use base qw/Catalyst::View/;
use Hydra::Helper::Nix;
use Hydra::Helper::Escape;
use Hydra::Helper::AttributeSet;
use Archive::Tar;
use IO::Compress::Bzip2 qw(bzip2);
use Encode;
use Data::Dumper;
sub process {
@ -56,14 +57,15 @@ EOF
foreach my $system (keys %perSystem) {
$res .= "else " if !$first;
$res .= "if system == ${\escapeString $system} then {\n\n";
my $attrsets = Hydra::Helper::AttributeSet->new();
foreach my $job (keys %{$perSystem{$system}}) {
my $pkg = $perSystem{$system}->{$job};
my $build = $pkg->{build};
$res .= " # Hydra build ${\$build->id}\n";
my $attr = $build->get_column('job');
$attr =~ s/\./-/g;
$res .= " ${\escapeString $attr} = (mkFakeDerivation {\n";
$attrsets->registerValue($attr);
$res .= " # Hydra build ${\$build->id}\n";
$res .= " ${\escapeAttributePath $attr} = (mkFakeDerivation {\n";
$res .= " type = \"derivation\";\n";
$res .= " name = ${\escapeString ($build->get_column('releasename') or $build->nixname)};\n";
$res .= " system = ${\escapeString $build->system};\n";
@ -82,6 +84,10 @@ EOF
$res .= " }).$out;\n\n";
}
for my $attrset ($attrsets->enumerate()) {
$res .= " ${\escapeAttributePath $attrset}.recurseForDerivations = true;\n\n";
}
$res .= "}\n\n";
$first = 0;
}