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.
MQLCUSZLZWVUI6OE4TVYRJWEGBF3GF4MWWSZGF4WLC35TIOKE3IAC VMBIK4GUIS6M2PSRMHH63QECOLLWVEQWT6EQZLT5RPWX6MTID62QC S2KNQCPB22URM7BLFSMADPWPQGBOZWMYHBPIW4N6PNEFVDUTYWWQC UZENK33PYWZIWNJMLE2IIXKA6KOCGKGOWUMVBNXAYBOKT2H6ZT6AC LVJKRTIK5WOWWAZ454B4DCCGETOIQJK5TLOWMZVNY2B4AEGF2GMAC I42G2Z7PKDALZKM526VU253MZORF54KFJ3VNGXVE76LRH2RGNORQC FG4JZPWS76SM2UQ7CJWO54S7SXRWPZPK4ZBIGLOVHWSJTOSCZFOQC L5Z6CN7MHFGRL2QPLCVQJSDECT35EW52INUV5RVI4CXH2YSDJGNAC PDZXZZPZX3GUJGYUNAKB5ISRNF3ED4K4I63XJA2GZQNGSTQNMPAAC 2JJP76737U2JWJWQ6UDFEAQCGWRAQH46HC6OCIKWMB5QYRXF6DQQC use feature 'unicode_strings';use strict;use Setup;use IO::Uncompress::Bunzip2 qw(bunzip2);use Archive::Tar;use JSON qw(decode_json);use Data::Dumper;my %ctx = test_init();require Hydra::Schema;require Hydra::Model::DB;require Hydra::Helper::Nix;use Test2::V0;require Catalyst::Test;Catalyst::Test->import('Hydra');my $db = Hydra::Model::DB->new;hydra_setup($db);my $project = $db->resultset('Projects')->create({name => "tests", displayname => "", owner => "root"});# Most basic test case, no parametersmy $jobset = createBaseJobset("nested-attributes", "nested-attributes.nix", $ctx{jobsdir});ok(evalSucceeds($jobset));is(nrQueuedBuildsForJobset($jobset), 4);for my $build (queuedBuildsForJobset($jobset)) {ok(runBuild($build), "Build '".$build->job."' should exit with code 0");my $newbuild = $db->resultset('Builds')->find($build->id);is($newbuild->finished, 1, "Build '".$build->job."' should be finished.");is($newbuild->buildstatus, 0, "Build '".$build->job."' should have buildstatus 0.");}my $compressed = get('/jobset/tests/nested-attributes/channel/latest/nixexprs.tar.bz2');my $tarcontent;bunzip2(\$compressed => \$tarcontent);open(my $tarfh, "<", \$tarcontent);my $tar = Archive::Tar->new($tarfh);my $defaultnix = $ctx{"tmpdir"} . "/channel-default.nix";$tar->extract_file("channel/default.nix", $defaultnix);print STDERR $tar->get_content("channel/default.nix");(my $status, my $stdout, my $stderr) = Hydra::Helper::Nix::captureStdoutStderr(5, "nix-env", "--json", "--query", "--available", "--attr-path", "--file", $defaultnix);is($stderr, "", "Stderr should be empty");is($status, 0, "Querying the packages should succeed");my $packages = decode_json($stdout);my $keys = [sort keys %$packages];is($keys, ["packageset-nested","packageset.deeper.deeper.nested","packageset.nested","packageset.nested2",]);is($packages->{"packageset-nested"}->{"name"}, "actually-top-level");is($packages->{"packageset.nested"}->{"name"}, "actually-nested");done_testing;
with import ./config.nix;rec {# Given a jobset containing a package set named X with an interior member Y,# expose the interior member Y with the name X-Y. This is to exercise a bug# in the NixExprs view's generated Nix expression which flattens the# package set namespace from `X.Y` to `X-Y`. If the bug is present, the# resulting expression incorrectly renders two `X-Y` packages.packageset = {recurseForDerivations = true;deeper = {recurseForDerivations = true;deeper = {recurseForDerivations = true;nested = mkDerivation {name = "much-too-deep";builder = ./empty-dir-builder.sh;};};};nested = mkDerivation {name = "actually-nested";builder = ./empty-dir-builder.sh;};nested2 = mkDerivation {name = "actually-nested2";builder = ./empty-dir-builder.sh;};};packageset-nested = mkDerivation {name = "actually-top-level";builder = ./empty-dir-builder.sh;};}