From 56837f26e277c3beb8f23afad551d6297badc438 Mon Sep 17 00:00:00 2001 From: Silvan Mosberger Date: Tue, 26 Mar 2024 21:37:07 +0100 Subject: [PATCH] tests.nixpkgs-check-by-name: Remove now that a separate repo is used Since https://github.com/NixOS/nixpkgs/pull/297901, the tool is fetched from https://github.com/NixOS/nixpkgs-check-by-name, so there's no need to keep it around in Nixpkgs anymore --- pkgs/test/default.nix | 2 +- pkgs/test/nixpkgs-check-by-name/.envrc | 1 - pkgs/test/nixpkgs-check-by-name/.gitignore | 2 - pkgs/test/nixpkgs-check-by-name/Cargo.lock | 643 ------------------ pkgs/test/nixpkgs-check-by-name/Cargo.toml | 23 - pkgs/test/nixpkgs-check-by-name/README.md | 102 --- pkgs/test/nixpkgs-check-by-name/default.nix | 82 --- pkgs/test/nixpkgs-check-by-name/shell.nix | 6 - pkgs/test/nixpkgs-check-by-name/src/eval.nix | 116 ---- pkgs/test/nixpkgs-check-by-name/src/eval.rs | 559 --------------- pkgs/test/nixpkgs-check-by-name/src/main.rs | 293 -------- .../nixpkgs-check-by-name/src/nix_file.rs | 555 --------------- .../src/nixpkgs_problem.rs | 425 ------------ .../test/nixpkgs-check-by-name/src/ratchet.rs | 184 ----- .../nixpkgs-check-by-name/src/references.rs | 176 ----- .../nixpkgs-check-by-name/src/structure.rs | 184 ----- pkgs/test/nixpkgs-check-by-name/src/utils.rs | 95 --- .../nixpkgs-check-by-name/src/validation.rs | 111 --- .../tests/aliases/aliases.nix | 3 - .../tests/aliases/all-packages.nix | 3 - .../tests/aliases/default.nix | 1 - .../tests/aliases/expected | 1 - .../aliases/pkgs/by-name/fo/foo/package.nix | 1 - .../tests/alt-callPackage/all-packages.nix | 7 - .../tests/alt-callPackage/default.nix | 1 - .../tests/alt-callPackage/expected | 9 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/base-fixed/base/default.nix | 1 - .../tests/base-fixed/base/pkgs/by-name/foo | 0 .../tests/base-fixed/default.nix | 1 - .../tests/base-fixed/expected | 1 - .../tests/base-fixed/pkgs/by-name/README.md | 0 .../tests/base-still-broken/base/default.nix | 1 - .../base-still-broken/base/pkgs/by-name/foo | 0 .../tests/base-still-broken/default.nix | 1 - .../tests/base-still-broken/expected | 3 - .../tests/base-still-broken/pkgs/by-name/bar | 0 .../tests/broken-autocall/default.nix | 4 - .../tests/broken-autocall/expected | 2 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/callPackage-syntax/all-packages.nix | 7 - .../tests/callPackage-syntax/default.nix | 1 - .../tests/callPackage-syntax/expected | 1 - .../callPackage-syntax/pkgs/by-name/README.md | 0 .../tests/empty-base/default.nix | 1 - .../tests/empty-base/expected | 1 - .../tests/empty-base/pkgs/by-name/README.md | 0 .../tests/incorrect-shard/default.nix | 1 - .../tests/incorrect-shard/expected | 2 - .../pkgs/by-name/aa/FOO/package.nix | 1 - .../internalCallPackage/all-packages.nix | 4 - .../tests/internalCallPackage/default.nix | 1 - .../tests/internalCallPackage/expected | 2 - .../tests/internalCallPackage/foo.nix | 1 - .../pkgs/by-name/README.md | 0 .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/invalid-package-name/default.nix | 1 - .../tests/invalid-package-name/expected | 2 - .../pkgs/by-name/fo/fo@/package.nix | 1 - .../tests/invalid-shard-name/default.nix | 1 - .../tests/invalid-shard-name/expected | 2 - .../pkgs/by-name/A/A/.git-keep | 0 .../pkgs/by-name/A/A/package.nix | 1 - .../tests/manual-definition/all-packages.nix | 10 - .../manual-definition/base/all-packages.nix | 9 - .../tests/manual-definition/base/default.nix | 1 - .../base/pkgs/by-name/README.md | 0 .../tests/manual-definition/base/some-pkg.nix | 1 - .../tests/manual-definition/default.nix | 1 - .../tests/manual-definition/expected | 21 - .../pkgs/by-name/no/noEval/package.nix | 1 - .../pkgs/by-name/on/onlyMove/package.nix | 1 - .../tests/missing-package-nix/default.nix | 1 - .../tests/missing-package-nix/expected | 2 - .../pkgs/by-name/fo/foo/.git-keep | 0 .../tests/mock-nixpkgs.nix | 110 --- .../move-to-non-by-name/all-packages.nix | 10 - .../move-to-non-by-name/base/default.nix | 1 - .../base/pkgs/by-name/fo/foo1/package.nix | 1 - .../base/pkgs/by-name/fo/foo2/package.nix | 1 - .../base/pkgs/by-name/fo/foo3/package.nix | 1 - .../base/pkgs/by-name/fo/foo4/package.nix | 1 - .../tests/move-to-non-by-name/default.nix | 1 - .../tests/move-to-non-by-name/expected | 13 - .../pkgs/by-name/README.md | 0 .../tests/move-to-non-by-name/with-config.nix | 1 - .../move-to-non-by-name/without-config.nix | 1 - .../tests/multiple-failures/default.nix | 1 - .../tests/multiple-failures/expected | 14 - .../multiple-failures/pkgs/by-name/A/fo@/foo | 1 - .../pkgs/by-name/A/fo@/package.nix | 1 - .../tests/multiple-failures/pkgs/by-name/aa | 0 .../multiple-failures/pkgs/by-name/ba/bar | 0 .../by-name/ba/baz/package.nix/default.nix | 1 - .../pkgs/by-name/ba/foo/package.nix | 6 - .../pkgs/by-name/fo/foo/.git-keep | 0 .../tests/multiple-failures/someDrv.nix | 1 - .../new-package-non-by-name/all-packages.nix | 11 - .../base/all-packages.nix | 5 - .../new-package-non-by-name/base/default.nix | 1 - .../base/pkgs/by-name/README.md | 0 .../tests/new-package-non-by-name/default.nix | 1 - .../tests/new-package-non-by-name/expected | 21 - .../pkgs/by-name/README.md | 0 .../new-package-non-by-name/with-config.nix | 1 - .../without-config.nix | 1 - .../tests/no-by-name/default.nix | 1 - .../tests/no-by-name/expected | 1 - .../tests/no-eval/all-packages.nix | 5 - .../tests/no-eval/base/all-packages.nix | 3 - .../tests/no-eval/base/default.nix | 1 - .../tests/no-eval/base/pkgs/by-name/README.md | 0 .../tests/no-eval/default.nix | 1 - .../tests/no-eval/expected | 1 - .../tests/no-eval/pkgs/by-name/README.md | 0 .../tests/non-attrs/default.nix | 1 - .../tests/non-attrs/expected | 2 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../tests/non-derivation/default.nix | 1 - .../tests/non-derivation/expected | 2 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../all-packages.nix | 6 - .../default.nix | 1 - .../expected | 9 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/one-letter/default.nix | 1 - .../tests/one-letter/expected | 1 - .../one-letter/pkgs/by-name/a/a/package.nix | 1 - .../all-packages.nix | 16 - .../only-callPackage-derivations/default.nix | 1 - .../only-callPackage-derivations/expected | 1 - .../pkgs/by-name/README.md | 0 .../override-different-file/all-packages.nix | 3 - .../tests/override-different-file/default.nix | 1 - .../tests/override-different-file/expected | 9 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../tests/override-different-file/someDrv.nix | 1 - .../all-packages.nix | 3 - .../base/all-packages.nix | 3 - .../base/default.nix | 1 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../override-empty-arg-gradual/default.nix | 1 - .../tests/override-empty-arg-gradual/expected | 1 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../tests/override-empty-arg/all-packages.nix | 3 - .../tests/override-empty-arg/base/default.nix | 1 - .../base/pkgs/by-name/README.md | 0 .../tests/override-empty-arg/default.nix | 1 - .../tests/override-empty-arg/expected | 11 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../override-no-call-package/all-packages.nix | 3 - .../override-no-call-package/default.nix | 1 - .../tests/override-no-call-package/expected | 9 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../tests/override-no-file/all-packages.nix | 3 - .../tests/override-no-file/default.nix | 1 - .../tests/override-no-file/expected | 9 - .../pkgs/by-name/no/nonDerivation/package.nix | 1 - .../tests/override-non-path/all-packages.nix | 5 - .../tests/override-non-path/default.nix | 1 - .../tests/override-non-path/expected | 9 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/override-success/all-packages.nix | 5 - .../tests/override-success/default.nix | 1 - .../tests/override-success/expected | 1 - .../pkgs/by-name/fo/foo/package.nix | 8 - .../tests/package-dir-is-file/default.nix | 1 - .../tests/package-dir-is-file/expected | 2 - .../package-dir-is-file/pkgs/by-name/fo/foo | 0 .../tests/package-nix-dir/default.nix | 1 - .../tests/package-nix-dir/expected | 2 - .../by-name/fo/foo/package.nix/default.nix | 1 - .../tests/package-variants/all-packages.nix | 5 - .../package-variants/base/all-packages.nix | 3 - .../tests/package-variants/base/default.nix | 1 - .../base/pkgs/by-name/fo/foo/package.nix | 1 - .../tests/package-variants/default.nix | 1 - .../tests/package-variants/expected | 1 - .../tests/package-variants/package.nix | 1 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/ref-absolute/default.nix | 1 - .../tests/ref-absolute/expected | 2 - .../pkgs/by-name/aa/aa/package.nix | 3 - .../tests/ref-escape/default.nix | 1 - .../tests/ref-escape/expected | 2 - .../ref-escape/pkgs/by-name/aa/aa/package.nix | 3 - .../tests/ref-nix-path/default.nix | 1 - .../tests/ref-nix-path/expected | 2 - .../pkgs/by-name/aa/aa/package.nix | 3 - .../tests/ref-path-subexpr/default.nix | 1 - .../tests/ref-path-subexpr/expected | 2 - .../pkgs/by-name/aa/aa/package.nix | 3 - .../tests/ref-success/default.nix | 1 - .../tests/ref-success/expected | 1 - .../pkgs/by-name/aa/aa/dir/default.nix | 2 - .../tests/ref-success/pkgs/by-name/aa/aa/file | 0 .../ref-success/pkgs/by-name/aa/aa/file.nix | 2 - .../pkgs/by-name/aa/aa/package.nix | 5 - .../tests/shard-file/default.nix | 1 - .../tests/shard-file/expected | 2 - .../tests/shard-file/pkgs/by-name/fo | 0 .../tests/sorted-order/all-packages.nix | 6 - .../tests/sorted-order/default.nix | 1 - .../tests/sorted-order/expected | 31 - .../sorted-order/pkgs/by-name/a/a/package.nix | 1 - .../sorted-order/pkgs/by-name/c/c/package.nix | 1 - .../tests/success/default.nix | 1 - .../tests/success/expected | 1 - .../success/pkgs/by-name/fo/foo/package.nix | 1 - .../tests/symlink-escape/default.nix | 1 - .../tests/symlink-escape/expected | 2 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/symlink-escape/someDrv.nix | 1 - .../tests/symlink-invalid/default.nix | 1 - .../tests/symlink-invalid/expected | 2 - .../symlink-invalid/pkgs/by-name/fo/foo/foo | 1 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/symlink-invalid/someDrv.nix | 1 - .../tests/unknown-location/all-packages.nix | 3 - .../tests/unknown-location/default.nix | 1 - .../tests/unknown-location/expected | 2 - .../pkgs/by-name/fo/foo/package.nix | 1 - .../tests/uppercase/default.nix | 1 - .../tests/uppercase/expected | 1 - .../uppercase/pkgs/by-name/fo/FOO/package.nix | 1 - .../tests/with-readme/default.nix | 1 - .../tests/with-readme/expected | 1 - .../tests/with-readme/pkgs/by-name/README.md | 0 228 files changed, 1 insertion(+), 4173 deletions(-) delete mode 100644 pkgs/test/nixpkgs-check-by-name/.envrc delete mode 100644 pkgs/test/nixpkgs-check-by-name/.gitignore delete mode 100644 pkgs/test/nixpkgs-check-by-name/Cargo.lock delete mode 100644 pkgs/test/nixpkgs-check-by-name/Cargo.toml delete mode 100644 pkgs/test/nixpkgs-check-by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/shell.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/eval.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/eval.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/main.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/nix_file.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/nixpkgs_problem.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/ratchet.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/references.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/structure.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/utils.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/src/validation.rs delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/aliases/aliases.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/aliases/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/aliases/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/aliases/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/aliases/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/pkgs/by-name/foo delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-fixed/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-fixed/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-fixed/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/pkgs/by-name/foo delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/pkgs/by-name/bar delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/empty-base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/empty-base/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/empty-base/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/pkgs/by-name/aa/FOO/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/foo.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/pkgs/by-name/fo/fo@/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/.git-keep delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/some-pkg.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/no/noEval/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/on/onlyMove/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/pkgs/by-name/fo/foo/.git-keep delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo3/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo4/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/with-config.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/without-config.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/expected delete mode 120000 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/foo delete mode 120000 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/aa delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/bar delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/baz/package.nix/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/fo/foo/.git-keep delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/someDrv.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/with-config.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/without-config.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-by-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-by-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/no-eval/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-attrs/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-attrs/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-attrs/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-derivation/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-derivation/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-derivation/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/one-letter/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/one-letter/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/one-letter/pkgs/by-name/a/a/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-different-file/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-different-file/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-different-file/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-different-file/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-different-file/someDrv.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/pkgs/by-name/README.md delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-file/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-file/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-file/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-no-file/pkgs/by-name/no/nonDerivation/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-non-path/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-non-path/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-non-path/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-non-path/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-success/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-success/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-success/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/override-success/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/pkgs/by-name/fo/foo delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/pkgs/by-name/fo/foo/package.nix/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/package-variants/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-escape/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-escape/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-escape/pkgs/by-name/aa/aa/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/dir/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/shard-file/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/shard-file/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/shard-file/pkgs/by-name/fo delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/sorted-order/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/sorted-order/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/sorted-order/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/a/a/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/c/c/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/success/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/success/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/success/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/expected delete mode 120000 pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/someDrv.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/expected delete mode 120000 pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/foo delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/someDrv.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/unknown-location/all-packages.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/unknown-location/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/unknown-location/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/unknown-location/pkgs/by-name/fo/foo/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/uppercase/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/uppercase/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/uppercase/pkgs/by-name/fo/FOO/package.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/with-readme/default.nix delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/with-readme/expected delete mode 100644 pkgs/test/nixpkgs-check-by-name/tests/with-readme/pkgs/by-name/README.md diff --git a/pkgs/test/default.nix b/pkgs/test/default.nix index 3fcc9d047db90..97b735676aca0 100644 --- a/pkgs/test/default.nix +++ b/pkgs/test/default.nix @@ -173,7 +173,7 @@ with pkgs; buildFHSEnv = recurseIntoAttrs (callPackages ./buildFHSEnv { }); - nixpkgs-check-by-name = callPackage ./nixpkgs-check-by-name { }; + nixpkgs-check-by-name = throw "tests.nixpkgs-check-by-name is now specified in a separate repository: https://github.com/NixOS/nixpkgs-check-by-name"; auto-patchelf-hook = callPackage ./auto-patchelf-hook { }; diff --git a/pkgs/test/nixpkgs-check-by-name/.envrc b/pkgs/test/nixpkgs-check-by-name/.envrc deleted file mode 100644 index 1d953f4bd7359..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/.envrc +++ /dev/null @@ -1 +0,0 @@ -use nix diff --git a/pkgs/test/nixpkgs-check-by-name/.gitignore b/pkgs/test/nixpkgs-check-by-name/.gitignore deleted file mode 100644 index 75e92a908987b..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -target -.direnv diff --git a/pkgs/test/nixpkgs-check-by-name/Cargo.lock b/pkgs/test/nixpkgs-check-by-name/Cargo.lock deleted file mode 100644 index 19435c2ab76e3..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/Cargo.lock +++ /dev/null @@ -1,643 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "aho-corasick" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" -dependencies = [ - "memchr", -] - -[[package]] -name = "anstream" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" -dependencies = [ - "anstyle", - "anstyle-parse", - "anstyle-query", - "anstyle-wincon", - "colorchoice", - "utf8parse", -] - -[[package]] -name = "anstyle" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" - -[[package]] -name = "anstyle-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" -dependencies = [ - "utf8parse", -] - -[[package]] -name = "anstyle-query" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" -dependencies = [ - "windows-sys", -] - -[[package]] -name = "anstyle-wincon" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" -dependencies = [ - "anstyle", - "windows-sys", -] - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clap" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d5f1946157a96594eb2d2c10eb7ad9a2b27518cb3000209dec700c35df9197d" -dependencies = [ - "clap_builder", - "clap_derive", - "once_cell", -] - -[[package]] -name = "clap_builder" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78116e32a042dd73c2901f0dc30790d20ff3447f3e3472fad359e8c3d282bcd6" -dependencies = [ - "anstream", - "anstyle", - "clap_lex", - "strsim", -] - -[[package]] -name = "clap_derive" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9fd1a5729c4548118d7d70ff234a44868d00489a4b6597b0b020918a0e91a1a" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "clap_lex" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" - -[[package]] -name = "colorchoice" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" - -[[package]] -name = "colored" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2674ec482fbc38012cf31e6c42ba0177b431a0cb6f15fe40efa5aab1bda516f6" -dependencies = [ - "is-terminal", - "lazy_static", - "windows-sys", -] - -[[package]] -name = "countme" -version = "3.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7704b5fdd17b18ae31c4c1da5a2e0305a2bf17b5249300a9ee9ed7b72114c636" - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "errno" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "fastrand" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" - -[[package]] -name = "indoc" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e186cfbae8084e513daff4240b4797e342f988cecda4fb6c939150f96315fd8" - -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix", - "windows-sys", -] - -[[package]] -name = "itertools" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "libc" -version = "0.2.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" - -[[package]] -name = "lock_api" -version = "0.4.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1cc9717a20b1bb222f333e6a92fd32f7d8a18ddc5a3191a11af45dcbf4dcd16" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" -dependencies = [ - "autocfg", -] - -[[package]] -name = "nixpkgs-check-by-name" -version = "0.1.0" -dependencies = [ - "anyhow", - "clap", - "colored", - "indoc", - "itertools", - "lazy_static", - "regex", - "relative-path", - "rnix", - "rowan", - "serde", - "serde_json", - "temp-env", - "tempfile", - "textwrap", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f00c865fe7cabf650081affecd3871070f26767e7b2070a3ffae14c654b447" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall", - "smallvec", - "windows-targets", -] - -[[package]] -name = "proc-macro2" -version = "1.0.66" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" - -[[package]] -name = "relative-path" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e898588f33fdd5b9420719948f9f2a32c922a246964576f71ba7f24f80610fbc" - -[[package]] -name = "rnix" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb35cedbeb70e0ccabef2a31bcff0aebd114f19566086300b8f42c725fc2cb5f" -dependencies = [ - "rowan", -] - -[[package]] -name = "rowan" -version = "0.15.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64449cfef9483a475ed56ae30e2da5ee96448789fb2aa240a04beb6a055078bf" -dependencies = [ - "countme", - "hashbrown", - "memoffset", - "rustc-hash", - "text-size", -] - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustix" -version = "0.38.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" -dependencies = [ - "bitflags 2.4.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys", -] - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.186" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f5db24220c009de9bd45e69fb2938f4b6d2df856aa9304ce377b3180f83b7c1" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.186" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ad697f7e0b65af4983a4ce8f56ed5b357e8d3c36651bf6a7e13639c17b8e670" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.105" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "smallvec" -version = "1.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" - -[[package]] -name = "smawk" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "syn" -version = "2.0.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "temp-env" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e010429b1f3ea1311190c658c7570100f03c1dab05c16cfab774181c648d656a" -dependencies = [ - "parking_lot", -] - -[[package]] -name = "tempfile" -version = "3.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" -dependencies = [ - "cfg-if", - "fastrand", - "redox_syscall", - "rustix", - "windows-sys", -] - -[[package]] -name = "text-size" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" - -[[package]] -name = "textwrap" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" -dependencies = [ - "smawk", - "unicode-linebreak", - "unicode-width", -] - -[[package]] -name = "unicode-ident" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" - -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "utf8parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" diff --git a/pkgs/test/nixpkgs-check-by-name/Cargo.toml b/pkgs/test/nixpkgs-check-by-name/Cargo.toml deleted file mode 100644 index 50cdabb7e2dd3..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/Cargo.toml +++ /dev/null @@ -1,23 +0,0 @@ -[package] -name = "nixpkgs-check-by-name" -version = "0.1.0" -edition = "2021" - -[dependencies] -rnix = "0.11.0" -regex = "1.9.3" -clap = { version = "4.3.23", features = ["derive"] } -serde_json = "1.0.105" -tempfile = "3.8.0" -serde = { version = "1.0.185", features = ["derive"] } -anyhow = "1.0" -lazy_static = "1.4.0" -colored = "2.0.4" -itertools = "0.11.0" -rowan = "0.15.11" -indoc = "2.0.4" -relative-path = "1.9.2" -textwrap = "0.16.1" - -[dev-dependencies] -temp-env = "0.3.5" diff --git a/pkgs/test/nixpkgs-check-by-name/README.md b/pkgs/test/nixpkgs-check-by-name/README.md deleted file mode 100644 index 1aa2569784161..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# Nixpkgs pkgs/by-name checker - -This directory implements a program to check the [validity](#validity-checks) of the `pkgs/by-name` Nixpkgs directory. -This is part of the implementation of [RFC 140](https://github.com/NixOS/rfcs/pull/140). - -A [pinned version](./scripts/pinned-tool.json) of this tool is used by [this GitHub Actions workflow](../../../.github/workflows/check-by-name.yml). -See [./scripts](./scripts/README.md#update-pinned-toolsh) for how to update the pinned version. - -The source of the tool being right inside Nixpkgs allows any Nixpkgs committer to make updates to it. - -## Interface - -The interface of the tool is shown with `--help`: -``` -cargo run -- --help -``` - -The interface may be changed over time only if the CI workflow making use of it is adjusted to deal with the change appropriately. - -## Validity checks - -These checks are performed by this tool: - -### File structure checks -- `pkgs/by-name` must only contain subdirectories of the form `${shard}/${name}`, called _package directories_. -- The `name`'s of package directories must be unique when lowercased. -- `name` is a string only consisting of the ASCII characters `a-z`, `A-Z`, `0-9`, `-` or `_`. -- `shard` is the lowercased first two letters of `name`, expressed in Nix: `shard = toLower (substring 0 2 name)`. -- Each package directory must contain a `package.nix` file and may contain arbitrary other files. - -### Nix parser checks -- Each package directory must not refer to files outside itself using symlinks or Nix path expressions. - -### Nix evaluation checks - -Evaluate Nixpkgs with `system` set to `x86_64-linux` and check that: -- For each package directory, the `pkgs.${name}` attribute must be defined as `callPackage pkgs/by-name/${shard}/${name}/package.nix args` for some `args`. -- For each package directory, `pkgs.lib.isDerivation pkgs.${name}` must be `true`. - -### Ratchet checks - -Furthermore, this tool implements certain [ratchet](https://qntm.org/ratchet) checks. -This allows gradually phasing out deprecated patterns without breaking the base branch or having to migrate it all at once. -It works by not allowing new instances of the pattern to be introduced, but allowing already existing instances. -The existing instances are coming from ``, which is then checked against `` for new instances. -Ratchets should be removed eventually once the pattern is not used anymore. - -The current ratchets are: - -- New manual definitions of `pkgs.${name}` (e.g. in `pkgs/top-level/all-packages.nix`) with `args = { }` - (see [nix evaluation checks](#nix-evaluation-checks)) must not be introduced. -- New top-level packages defined using `pkgs.callPackage` must be defined with a package directory. - - Once a top-level package uses `pkgs/by-name`, it also can't be moved back out of it. - -## Development - -Enter the development environment in this directory either automatically with `direnv` or with -``` -nix-shell -``` - -Then use `cargo`: -``` -cargo build -cargo test -cargo fmt -cargo clippy -``` - -## Tests - -Tests are declared in [`./tests`](./tests) as subdirectories imitating Nixpkgs with these files: -- `default.nix`: - Always contains - ```nix - import { root = ./.; } - ``` - which makes - ``` - nix-instantiate --eval -A --arg overlays - ``` - work very similarly to the real Nixpkgs, just enough for the program to be able to test it. -- `pkgs/by-name`: - The `pkgs/by-name` directory to check. - -- `all-packages.nix` (optional): - Contains an overlay of the form - ```nix - self: super: { - # ... - } - ``` - allowing the simulation of package overrides to the real [`pkgs/top-level/all-packages.nix`](../../top-level/all-packages.nix`). - The default is an empty overlay. - -- `base` (optional): - Contains another subdirectory imitating Nixpkgs with potentially any of the above structures. - This is used for [ratchet checks](#ratchet-checks). - -- `expected` (optional): - A file containing the expected standard output. - The default is expecting an empty standard output. diff --git a/pkgs/test/nixpkgs-check-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/default.nix deleted file mode 100644 index 8836da1f403f1..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/default.nix +++ /dev/null @@ -1,82 +0,0 @@ -{ - lib, - rustPlatform, - nix, - rustfmt, - clippy, - mkShell, - makeWrapper, - runCommand, -}: -let - runtimeExprPath = ./src/eval.nix; - nixpkgsLibPath = ../../../lib; - testNixpkgsPath = ./tests/mock-nixpkgs.nix; - - # Needed to make Nix evaluation work inside nix builds - initNix = '' - export TEST_ROOT=$(pwd)/test-tmp - export NIX_CONF_DIR=$TEST_ROOT/etc - export NIX_LOCALSTATE_DIR=$TEST_ROOT/var - export NIX_LOG_DIR=$TEST_ROOT/var/log/nix - export NIX_STATE_DIR=$TEST_ROOT/var/nix - export NIX_STORE_DIR=$TEST_ROOT/store - - # Ensure that even if tests run in parallel, we don't get an error - # We'd run into https://github.com/NixOS/nix/issues/2706 unless the store is initialised first - nix-store --init - ''; - - fs = lib.fileset; - - package = - rustPlatform.buildRustPackage { - name = "nixpkgs-check-by-name"; - src = fs.toSource { - root = ./.; - fileset = fs.unions [ - ./Cargo.lock - ./Cargo.toml - ./src - ./tests - ]; - }; - cargoLock.lockFile = ./Cargo.lock; - nativeBuildInputs = [ - nix - rustfmt - clippy - makeWrapper - ]; - env.NIX_CHECK_BY_NAME_EXPR_PATH = "${runtimeExprPath}"; - env.NIX_PATH = "test-nixpkgs=${testNixpkgsPath}:test-nixpkgs/lib=${nixpkgsLibPath}"; - preCheck = initNix; - postCheck = '' - cargo fmt --check - cargo clippy -- -D warnings - ''; - postInstall = '' - wrapProgram $out/bin/nixpkgs-check-by-name \ - --set NIX_CHECK_BY_NAME_EXPR_PATH "$NIX_CHECK_BY_NAME_EXPR_PATH" - ''; - passthru.shell = mkShell { - env.NIX_CHECK_BY_NAME_EXPR_PATH = toString runtimeExprPath; - env.NIX_PATH = "test-nixpkgs=${toString testNixpkgsPath}:test-nixpkgs/lib=${toString nixpkgsLibPath}"; - inputsFrom = [ package ]; - }; - - # Tests the tool on the current Nixpkgs tree, this is a good sanity check - passthru.tests.nixpkgs = runCommand "test-nixpkgs-check-by-name" { - nativeBuildInputs = [ - package - nix - ]; - nixpkgsPath = lib.cleanSource ../../..; - } '' - ${initNix} - nixpkgs-check-by-name --base "$nixpkgsPath" "$nixpkgsPath" - touch $out - ''; - }; -in -package diff --git a/pkgs/test/nixpkgs-check-by-name/shell.nix b/pkgs/test/nixpkgs-check-by-name/shell.nix deleted file mode 100644 index 33bcf45b8d05d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/shell.nix +++ /dev/null @@ -1,6 +0,0 @@ -let - pkgs = import ../../.. { - config = {}; - overlays = []; - }; -in pkgs.tests.nixpkgs-check-by-name.shell diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.nix b/pkgs/test/nixpkgs-check-by-name/src/eval.nix deleted file mode 100644 index ab1c41e0b1458..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.nix +++ /dev/null @@ -1,116 +0,0 @@ -# Takes a path to nixpkgs and a path to the json-encoded list of `pkgs/by-name` attributes. -# Returns a value containing information on all Nixpkgs attributes -# which is decoded on the Rust side. -# See ./eval.rs for the meaning of the returned values -{ - attrsPath, - nixpkgsPath, -}: -let - attrs = builtins.fromJSON (builtins.readFile attrsPath); - - # We need to check whether attributes are defined manually e.g. in - # `all-packages.nix`, automatically by the `pkgs/by-name` overlay, or - # neither. The only way to do so is to override `callPackage` and - # `_internalCallByNamePackageFile` with our own version that adds this - # information to the result, and then try to access it. - overlay = final: prev: { - - # Adds information to each attribute about whether it's manually defined using `callPackage` - callPackage = fn: args: - addVariantInfo (prev.callPackage fn args) { - # This is a manual definition of the attribute, and it's a callPackage, specifically a semantic callPackage - ManualDefinition.is_semantic_call_package = true; - }; - - # Adds information to each attribute about whether it's automatically - # defined by the `pkgs/by-name` overlay. This internal attribute is only - # used by that overlay. - # This overrides the above `callPackage` information (we don't need that - # one, since `pkgs/by-name` always uses `callPackage` underneath. - _internalCallByNamePackageFile = file: - addVariantInfo (prev._internalCallByNamePackageFile file) { - AutoDefinition = null; - }; - - }; - - # We can't just replace attribute values with their info in the overlay, - # because attributes can depend on other attributes, so this would break evaluation. - addVariantInfo = value: variant: - if builtins.isAttrs value then - value // { - _callPackageVariant = variant; - } - else - # It's very rare that callPackage doesn't return an attribute set, but it can occur. - # In such a case we can't really return anything sensible that would include the info, - # so just don't return the value directly and treat it as if it wasn't a callPackage. - value; - - pkgs = import nixpkgsPath { - # Don't let the users home directory influence this result - config = { }; - overlays = [ overlay ]; - # We check evaluation and callPackage only for x86_64-linux. - # Not ideal, but hard to fix - system = "x86_64-linux"; - }; - - # See AttributeInfo in ./eval.rs for the meaning of this - attrInfo = name: value: { - location = builtins.unsafeGetAttrPos name pkgs; - attribute_variant = - if ! builtins.isAttrs value then - { NonAttributeSet = null; } - else - { - AttributeSet = { - is_derivation = pkgs.lib.isDerivation value; - definition_variant = - if ! value ? _callPackageVariant then - { ManualDefinition.is_semantic_call_package = false; } - else - value._callPackageVariant; - }; - }; - }; - - # Information on all attributes that are in pkgs/by-name. - byNameAttrs = builtins.listToAttrs (map (name: { - inherit name; - value.ByName = - if ! pkgs ? ${name} then - { Missing = null; } - else - # Evaluation failures are not allowed, so don't try to catch them - { Existing = attrInfo name pkgs.${name}; }; - }) attrs); - - # Information on all attributes that exist but are not in pkgs/by-name. - # We need this to enforce pkgs/by-name for new packages - nonByNameAttrs = builtins.mapAttrs (name: value: - let - # Packages outside `pkgs/by-name` often fail evaluation, - # so we need to handle that - output = attrInfo name value; - result = builtins.tryEval (builtins.deepSeq output null); - in - { - NonByName = - if result.success then - { EvalSuccess = output; } - else - { EvalFailure = null; }; - } - ) (builtins.removeAttrs pkgs attrs); - - # All attributes - attributes = byNameAttrs // nonByNameAttrs; -in -# We output them in the form [ [ ] ]` such that the Rust side -# doesn't need to sort them again to get deterministic behavior (good for testing) -map (name: [ - name - attributes.${name} -]) (builtins.attrNames attributes) diff --git a/pkgs/test/nixpkgs-check-by-name/src/eval.rs b/pkgs/test/nixpkgs-check-by-name/src/eval.rs deleted file mode 100644 index 094508f595d8f..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/eval.rs +++ /dev/null @@ -1,559 +0,0 @@ -use crate::nix_file::CallPackageArgumentInfo; -use crate::nixpkgs_problem::NixpkgsProblem; -use crate::ratchet; -use crate::ratchet::RatchetState::Loose; -use crate::ratchet::RatchetState::Tight; -use crate::structure; -use crate::utils; -use crate::validation::ResultIteratorExt as _; -use crate::validation::{self, Validation::Success}; -use crate::NixFileStore; -use relative_path::RelativePathBuf; -use std::path::Path; - -use anyhow::Context; -use serde::Deserialize; -use std::path::PathBuf; -use std::process; -use tempfile::NamedTempFile; - -/// Attribute set of this structure is returned by eval.nix -#[derive(Deserialize)] -enum Attribute { - /// An attribute that should be defined via pkgs/by-name - ByName(ByNameAttribute), - /// An attribute not defined via pkgs/by-name - NonByName(NonByNameAttribute), -} - -#[derive(Deserialize)] -enum NonByNameAttribute { - /// The attribute doesn't evaluate - EvalFailure, - EvalSuccess(AttributeInfo), -} - -#[derive(Deserialize)] -enum ByNameAttribute { - /// The attribute doesn't exist at all - Missing, - Existing(AttributeInfo), -} - -#[derive(Deserialize)] -struct AttributeInfo { - /// The location of the attribute as returned by `builtins.unsafeGetAttrPos` - location: Option, - attribute_variant: AttributeVariant, -} - -/// The structure returned by a successful `builtins.unsafeGetAttrPos` -#[derive(Deserialize, Clone, Debug)] -struct Location { - pub file: PathBuf, - pub line: usize, - pub column: usize, -} - -impl Location { - // Returns the [file] field, but relative to Nixpkgs - fn relative_file(&self, nixpkgs_path: &Path) -> anyhow::Result { - let path = self.file.strip_prefix(nixpkgs_path).with_context(|| { - format!( - "The file ({}) is outside Nixpkgs ({})", - self.file.display(), - nixpkgs_path.display() - ) - })?; - Ok(RelativePathBuf::from_path(path).expect("relative path")) - } -} - -#[derive(Deserialize)] -pub enum AttributeVariant { - /// The attribute is not an attribute set, we're limited in the amount of information we can get - /// from it (though it's obviously not a derivation) - NonAttributeSet, - AttributeSet { - /// Whether the attribute is a derivation (`lib.isDerivation`) - is_derivation: bool, - /// The type of callPackage - definition_variant: DefinitionVariant, - }, -} - -#[derive(Deserialize)] -pub enum DefinitionVariant { - /// An automatic definition by the `pkgs/by-name` overlay - /// Though it's detected using the internal _internalCallByNamePackageFile attribute, - /// which can in theory also be used by other code - AutoDefinition, - /// A manual definition of the attribute, typically in `all-packages.nix` - ManualDefinition { - /// Whether the attribute is defined as `pkgs.callPackage ...` or something else. - is_semantic_call_package: bool, - }, -} - -/// Check that the Nixpkgs attribute values corresponding to the packages in pkgs/by-name are -/// of the form `callPackage { ... }`. -/// See the `eval.nix` file for how this is achieved on the Nix side -pub fn check_values( - nixpkgs_path: &Path, - nix_file_store: &mut NixFileStore, - package_names: Vec, - keep_nix_path: bool, -) -> validation::Result { - // Write the list of packages we need to check into a temporary JSON file. - // This can then get read by the Nix evaluation. - let attrs_file = NamedTempFile::new().with_context(|| "Failed to create a temporary file")?; - // We need to canonicalise this path because if it's a symlink (which can be the case on - // Darwin), Nix would need to read both the symlink and the target path, therefore need 2 - // NIX_PATH entries for restrict-eval. But if we resolve the symlinks then only one predictable - // entry is needed. - let attrs_file_path = attrs_file.path().canonicalize()?; - - serde_json::to_writer(&attrs_file, &package_names).with_context(|| { - format!( - "Failed to serialise the package names to the temporary path {}", - attrs_file_path.display() - ) - })?; - - let expr_path = std::env::var("NIX_CHECK_BY_NAME_EXPR_PATH") - .with_context(|| "Could not get environment variable NIX_CHECK_BY_NAME_EXPR_PATH")?; - // With restrict-eval, only paths in NIX_PATH can be accessed, so we explicitly specify the - // ones needed needed - let mut command = process::Command::new("nix-instantiate"); - command - // Inherit stderr so that error messages always get shown - .stderr(process::Stdio::inherit()) - .args([ - "--eval", - "--json", - "--strict", - "--readonly-mode", - "--restrict-eval", - "--show-trace", - ]) - // Pass the path to the attrs_file as an argument and add it to the NIX_PATH so it can be - // accessed in restrict-eval mode - .args(["--arg", "attrsPath"]) - .arg(&attrs_file_path) - .arg("-I") - .arg(&attrs_file_path) - // Same for the nixpkgs to test - .args(["--arg", "nixpkgsPath"]) - .arg(nixpkgs_path) - .arg("-I") - .arg(nixpkgs_path); - - // Clear NIX_PATH to be sure it doesn't influence the result - // But not when requested to keep it, used so that the tests can pass extra Nix files - if !keep_nix_path { - command.env_remove("NIX_PATH"); - } - - command.args(["-I", &expr_path]); - command.arg(expr_path); - - let result = command - .output() - .with_context(|| format!("Failed to run command {command:?}"))?; - - if !result.status.success() { - anyhow::bail!("Failed to run command {command:?}"); - } - // Parse the resulting JSON value - let attributes: Vec<(String, Attribute)> = serde_json::from_slice(&result.stdout) - .with_context(|| { - format!( - "Failed to deserialise {}", - String::from_utf8_lossy(&result.stdout) - ) - })?; - - let check_result = validation::sequence( - attributes - .into_iter() - .map(|(attribute_name, attribute_value)| { - let check_result = match attribute_value { - Attribute::NonByName(non_by_name_attribute) => handle_non_by_name_attribute( - nixpkgs_path, - nix_file_store, - &attribute_name, - non_by_name_attribute, - )?, - Attribute::ByName(by_name_attribute) => by_name( - nix_file_store, - nixpkgs_path, - &attribute_name, - by_name_attribute, - )?, - }; - Ok::<_, anyhow::Error>(check_result.map(|value| (attribute_name.clone(), value))) - }) - .collect_vec()?, - ); - - Ok(check_result.map(|elems| ratchet::Nixpkgs { - package_names: elems.iter().map(|(name, _)| name.to_owned()).collect(), - package_map: elems.into_iter().collect(), - })) -} - -/// Handles the evaluation result for an attribute in `pkgs/by-name`, -/// turning it into a validation result. -fn by_name( - nix_file_store: &mut NixFileStore, - nixpkgs_path: &Path, - attribute_name: &str, - by_name_attribute: ByNameAttribute, -) -> validation::Result { - use ratchet::RatchetState::*; - use ByNameAttribute::*; - - let relative_package_file = structure::relative_file_for_package(attribute_name); - - // At this point we know that `pkgs/by-name/fo/foo/package.nix` has to exists. - // This match decides whether the attribute `foo` is defined accordingly - // and whether a legacy manual definition could be removed - let manual_definition_result = match by_name_attribute { - // The attribute is missing - Missing => { - // This indicates a bug in the `pkgs/by-name` overlay, because it's supposed to - // automatically defined attributes in `pkgs/by-name` - NixpkgsProblem::UndefinedAttr { - relative_package_file: relative_package_file.to_owned(), - package_name: attribute_name.to_owned(), - } - .into() - } - // The attribute exists - Existing(AttributeInfo { - // But it's not an attribute set, which limits the amount of information we can get - // about this attribute (see ./eval.nix) - attribute_variant: AttributeVariant::NonAttributeSet, - location: _location, - }) => { - // The only thing we know is that it's definitely not a derivation, since those are - // always attribute sets. - // - // We can't know whether the attribute is automatically or manually defined for sure, - // and while we could check the location, the error seems clear enough as is. - NixpkgsProblem::NonDerivation { - relative_package_file: relative_package_file.to_owned(), - package_name: attribute_name.to_owned(), - } - .into() - } - // The attribute exists - Existing(AttributeInfo { - // And it's an attribute set, which allows us to get more information about it - attribute_variant: - AttributeVariant::AttributeSet { - is_derivation, - definition_variant, - }, - location, - }) => { - // Only derivations are allowed in `pkgs/by-name` - let is_derivation_result = if is_derivation { - Success(()) - } else { - NixpkgsProblem::NonDerivation { - relative_package_file: relative_package_file.to_owned(), - package_name: attribute_name.to_owned(), - } - .into() - }; - - // If the definition looks correct - let variant_result = match definition_variant { - // An automatic `callPackage` by the `pkgs/by-name` overlay. - // Though this gets detected by checking whether the internal - // `_internalCallByNamePackageFile` was used - DefinitionVariant::AutoDefinition => { - if let Some(_location) = location { - // Such an automatic definition should definitely not have a location - // Having one indicates that somebody is using `_internalCallByNamePackageFile`, - NixpkgsProblem::InternalCallPackageUsed { - attr_name: attribute_name.to_owned(), - } - .into() - } else { - Success(Tight) - } - } - // The attribute is manually defined, e.g. in `all-packages.nix`. - // This means we need to enforce it to look like this: - // callPackage ../pkgs/by-name/fo/foo/package.nix { ... } - DefinitionVariant::ManualDefinition { - is_semantic_call_package, - } => { - // We should expect manual definitions to have a location, otherwise we can't - // enforce the expected format - if let Some(location) = location { - // Parse the Nix file in the location - let nix_file = nix_file_store.get(&location.file)?; - - // The relative path of the Nix file, for error messages - let relative_location_file = location.relative_file(nixpkgs_path).with_context(|| { - format!("Failed to resolve the file where attribute {attribute_name} is defined") - })?; - - // Figure out whether it's an attribute definition of the form `= callPackage `, - // returning the arguments if so. - let (optional_syntactic_call_package, definition) = nix_file - .call_package_argument_info_at(location.line, location.column, nixpkgs_path) - .with_context(|| { - format!("Failed to get the definition info for attribute {attribute_name}") - })?; - - by_name_override( - attribute_name, - relative_package_file, - is_semantic_call_package, - optional_syntactic_call_package, - definition, - location, - relative_location_file, - ) - } else { - // If manual definitions don't have a location, it's likely `mapAttrs`'d - // over, e.g. if it's defined in aliases.nix. - // We can't verify whether its of the expected `callPackage`, so error out - NixpkgsProblem::CannotDetermineAttributeLocation { - attr_name: attribute_name.to_owned(), - } - .into() - } - } - }; - - // Independently report problems about whether it's a derivation and the callPackage variant - is_derivation_result.and(variant_result) - } - }; - Ok( - // Packages being checked in this function are _always_ already defined in `pkgs/by-name`, - // so instead of repeating ourselves all the time to define `uses_by_name`, just set it - // once at the end with a map - manual_definition_result.map(|manual_definition| ratchet::Package { - manual_definition, - uses_by_name: Tight, - }), - ) -} - -/// Handles the case for packages in `pkgs/by-name` that are manually overridden, e.g. in -/// all-packages.nix -fn by_name_override( - attribute_name: &str, - expected_package_file: RelativePathBuf, - is_semantic_call_package: bool, - optional_syntactic_call_package: Option, - definition: String, - location: Location, - relative_location_file: RelativePathBuf, -) -> validation::Validation> { - // At this point, we completed two different checks for whether it's a - // `callPackage` - match (is_semantic_call_package, optional_syntactic_call_package) { - // Something like ` = foo` - (_, None) => NixpkgsProblem::NonSyntacticCallPackage { - package_name: attribute_name.to_owned(), - file: relative_location_file, - line: location.line, - column: location.column, - definition, - } - .into(), - // Something like ` = pythonPackages.callPackage ...` - (false, Some(_)) => NixpkgsProblem::NonToplevelCallPackage { - package_name: attribute_name.to_owned(), - file: relative_location_file, - line: location.line, - column: location.column, - definition, - } - .into(), - // Something like ` = pkgs.callPackage ...` - (true, Some(syntactic_call_package)) => { - if let Some(actual_package_file) = syntactic_call_package.relative_path { - if actual_package_file != expected_package_file { - // Wrong path - NixpkgsProblem::WrongCallPackagePath { - package_name: attribute_name.to_owned(), - file: relative_location_file, - line: location.line, - actual_path: actual_package_file, - expected_path: expected_package_file, - } - .into() - } else { - // Manual definitions with empty arguments are not allowed - // anymore, but existing ones should continue to be allowed - let manual_definition_ratchet = if syntactic_call_package.empty_arg { - // This is the state to migrate away from - Loose(NixpkgsProblem::EmptyArgument { - package_name: attribute_name.to_owned(), - file: relative_location_file, - line: location.line, - column: location.column, - definition, - }) - } else { - // This is the state to migrate to - Tight - }; - - Success(manual_definition_ratchet) - } - } else { - // No path - NixpkgsProblem::NonPath { - package_name: attribute_name.to_owned(), - file: relative_location_file, - line: location.line, - column: location.column, - definition, - } - .into() - } - } - } -} - -/// Handles the evaluation result for an attribute _not_ in `pkgs/by-name`, -/// turning it into a validation result. -fn handle_non_by_name_attribute( - nixpkgs_path: &Path, - nix_file_store: &mut NixFileStore, - attribute_name: &str, - non_by_name_attribute: NonByNameAttribute, -) -> validation::Result { - use ratchet::RatchetState::*; - use NonByNameAttribute::*; - - // The ratchet state whether this attribute uses `pkgs/by-name`. - // This is never `Tight`, because we only either: - // - Know that the attribute _could_ be migrated to `pkgs/by-name`, which is `Loose` - // - Or we're unsure, in which case we use NonApplicable - let uses_by_name = - // This is a big ol' match on various properties of the attribute - - // First, it needs to succeed evaluation. We can't know whether an attribute could be - // migrated to `pkgs/by-name` if it doesn't evaluate, since we need to check that it's a - // derivation. - // - // This only has the minor negative effect that if a PR that breaks evaluation - // gets merged, fixing those failures won't force anything into `pkgs/by-name`. - // - // For now this isn't our problem, but in the future we - // might have another check to enforce that evaluation must not be broken. - // - // The alternative of assuming that failing attributes would have been fit for `pkgs/by-name` - // has the problem that if a package evaluation gets broken temporarily, - // fixing it requires a move to pkgs/by-name, which could happen more - // often and isn't really justified. - if let EvalSuccess(AttributeInfo { - // We're only interested in attributes that are attribute sets (which includes - // derivations). Anything else can't be in `pkgs/by-name`. - attribute_variant: AttributeVariant::AttributeSet { - // Indeed, we only care about derivations, non-derivation attribute sets can't be - // in `pkgs/by-name` - is_derivation: true, - // Of the two definition variants, really only the manual one makes sense here. - // Special cases are: - // - Manual aliases to auto-called packages are not treated as manual definitions, - // due to limitations in the semantic callPackage detection. So those should be - // ignored. - // - Manual definitions using the internal _internalCallByNamePackageFile are - // not treated as manual definitions, since _internalCallByNamePackageFile is - // used to detect automatic ones. We can't distinguish from the above case, so we - // just need to ignore this one too, even if that internal attribute should never - // be called manually. - definition_variant: DefinitionVariant::ManualDefinition { is_semantic_call_package } - }, - // We need the location of the manual definition, because otherwise - // we can't figure out whether it's a syntactic callPackage - location: Some(location), - }) = non_by_name_attribute { - - // Parse the Nix file in the location - let nix_file = nix_file_store.get(&location.file)?; - - // The relative path of the Nix file, for error messages - let relative_location_file = location.relative_file(nixpkgs_path).with_context(|| { - format!("Failed to resolve the file where attribute {attribute_name} is defined") - })?; - - // Figure out whether it's an attribute definition of the form `= callPackage `, - // returning the arguments if so. - let (optional_syntactic_call_package, _definition) = nix_file - .call_package_argument_info_at( - location.line, - location.column, - // Passing the Nixpkgs path here both checks that the is within Nixpkgs, and - // strips the absolute Nixpkgs path from it, such that - // syntactic_call_package.relative_path is relative to Nixpkgs - nixpkgs_path - ) - .with_context(|| { - format!("Failed to get the definition info for attribute {attribute_name}") - })?; - - // At this point, we completed two different checks for whether it's a - // `callPackage` - match (is_semantic_call_package, optional_syntactic_call_package) { - // Something like ` = { }` - (false, None) - // Something like ` = pythonPackages.callPackage ...` - | (false, Some(_)) - // Something like ` = bar` where `bar = pkgs.callPackage ...` - | (true, None) => { - // In all of these cases, it's not possible to migrate the package to `pkgs/by-name` - NonApplicable - } - // Something like ` = pkgs.callPackage ...` - (true, Some(syntactic_call_package)) => { - // It's only possible to migrate such a definitions if.. - match syntactic_call_package.relative_path { - Some(ref rel_path) if rel_path.starts_with(utils::BASE_SUBPATH) => { - // ..the path is not already within `pkgs/by-name` like - // - // foo-variant = callPackage ../by-name/fo/foo/package.nix { - // someFlag = true; - // } - // - // While such definitions could be moved to `pkgs/by-name` by using - // `.override { someFlag = true; }` instead, this changes the semantics in - // relation with overlays, so migration is generally not possible. - // - // See also "package variants" in RFC 140: - // https://github.com/NixOS/rfcs/blob/master/rfcs/0140-simple-package-paths.md#package-variants - NonApplicable - } - _ => { - // Otherwise, the path is outside `pkgs/by-name`, which means it can be - // migrated - Loose((syntactic_call_package, relative_location_file)) - } - } - } - } - } else { - // This catches all the cases not matched by the above `if let`, falling back to not being - // able to migrate such attributes - NonApplicable - }; - Ok(Success(ratchet::Package { - // Packages being checked in this function _always_ need a manual definition, because - // they're not using `pkgs/by-name` which would allow avoiding it. - // so instead of repeating ourselves all the time to define `manual_definition`, - // just set it once at the end here - manual_definition: Tight, - uses_by_name, - })) -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/main.rs b/pkgs/test/nixpkgs-check-by-name/src/main.rs deleted file mode 100644 index dcc9cb9e716d5..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/main.rs +++ /dev/null @@ -1,293 +0,0 @@ -use crate::nix_file::NixFileStore; -use std::panic; -mod eval; -mod nix_file; -mod nixpkgs_problem; -mod ratchet; -mod references; -mod structure; -mod utils; -mod validation; - -use crate::structure::check_structure; -use crate::validation::Validation::Failure; -use crate::validation::Validation::Success; -use anyhow::Context; -use clap::Parser; -use colored::Colorize; -use std::io; -use std::path::{Path, PathBuf}; -use std::process::ExitCode; -use std::thread; - -/// Program to check the validity of pkgs/by-name -/// -/// This CLI interface may be changed over time if the CI workflow making use of -/// it is adjusted to deal with the change appropriately. -/// -/// Exit code: -/// - `0`: If the validation is successful -/// - `1`: If the validation is not successful -/// - `2`: If an unexpected I/O error occurs -/// -/// Standard error: -/// - Informative messages -/// - Detected problems if validation is not successful -#[derive(Parser, Debug)] -#[command(about, verbatim_doc_comment)] -pub struct Args { - /// Path to the main Nixpkgs to check. - /// For PRs, this should be set to a checkout of the PR branch. - nixpkgs: PathBuf, - - /// Path to the base Nixpkgs to run ratchet checks against. - /// For PRs, this should be set to a checkout of the PRs base branch. - #[arg(long)] - base: PathBuf, -} - -fn main() -> ExitCode { - let args = Args::parse(); - match process(args.base, args.nixpkgs, false, &mut io::stderr()) { - Ok(true) => ExitCode::SUCCESS, - Ok(false) => ExitCode::from(1), - Err(e) => { - eprintln!("{} {:#}", "I/O error: ".yellow(), e); - ExitCode::from(2) - } - } -} - -/// Does the actual work. This is the abstraction used both by `main` and the tests. -/// -/// # Arguments -/// - `base_nixpkgs`: Path to the base Nixpkgs to run ratchet checks against. -/// - `main_nixpkgs`: Path to the main Nixpkgs to check. -/// - `keep_nix_path`: Whether the value of the NIX_PATH environment variable should be kept for -/// the evaluation stage, allowing its contents to be accessed. -/// This is used to allow the tests to access e.g. the mock-nixpkgs.nix file -/// - `error_writer`: An `io::Write` value to write validation errors to, if any. -/// -/// # Return value -/// - `Err(e)` if an I/O-related error `e` occurred. -/// - `Ok(false)` if there are problems, all of which will be written to `error_writer`. -/// - `Ok(true)` if there are no problems -pub fn process( - base_nixpkgs: PathBuf, - main_nixpkgs: PathBuf, - keep_nix_path: bool, - error_writer: &mut W, -) -> anyhow::Result { - // Very easy to parallelise this, since it's totally independent - let base_thread = thread::spawn(move || check_nixpkgs(&base_nixpkgs, keep_nix_path)); - let main_result = check_nixpkgs(&main_nixpkgs, keep_nix_path)?; - - let base_result = match base_thread.join() { - Ok(res) => res?, - Err(e) => panic::resume_unwind(e), - }; - - match (base_result, main_result) { - (Failure(_), Failure(errors)) => { - // Base branch fails and the PR doesn't fix it and may also introduce additional problems - for error in errors { - writeln!(error_writer, "{}", error.to_string().red())? - } - writeln!(error_writer, "{}", "The base branch is broken and still has above problems with this PR, which need to be fixed first.\nConsider reverting the PR that introduced these problems in order to prevent more failures of unrelated PRs.".yellow())?; - Ok(false) - } - (Failure(_), Success(_)) => { - writeln!( - error_writer, - "{}", - "The base branch is broken, but this PR fixes it. Nice job!".green() - )?; - Ok(true) - } - (Success(_), Failure(errors)) => { - for error in errors { - writeln!(error_writer, "{}", error.to_string().red())? - } - writeln!( - error_writer, - "{}", - "This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break." - .yellow() - )?; - Ok(false) - } - (Success(base), Success(main)) => { - // Both base and main branch succeed, check ratchet state - match ratchet::Nixpkgs::compare(base, main) { - Failure(errors) => { - for error in errors { - writeln!(error_writer, "{}", error.to_string().red())? - } - writeln!(error_writer, "{}", "This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch.".yellow())?; - - Ok(false) - } - Success(()) => { - writeln!(error_writer, "{}", "Validated successfully".green())?; - Ok(true) - } - } - } - } -} - -/// Checks whether the pkgs/by-name structure in Nixpkgs is valid. -/// -/// This does not include ratchet checks, see ../README.md#ratchet-checks -/// Instead a `ratchet::Nixpkgs` value is returned, whose `compare` method allows performing the -/// ratchet check against another result. -pub fn check_nixpkgs( - nixpkgs_path: &Path, - keep_nix_path: bool, -) -> validation::Result { - let mut nix_file_store = NixFileStore::default(); - - Ok({ - let nixpkgs_path = nixpkgs_path.canonicalize().with_context(|| { - format!( - "Nixpkgs path {} could not be resolved", - nixpkgs_path.display() - ) - })?; - - if !nixpkgs_path.join(utils::BASE_SUBPATH).exists() { - // No pkgs/by-name directory, always valid - Success(ratchet::Nixpkgs::default()) - } else { - check_structure(&nixpkgs_path, &mut nix_file_store)?.result_map(|package_names| - // Only if we could successfully parse the structure, we do the evaluation checks - eval::check_values(&nixpkgs_path, &mut nix_file_store, package_names, keep_nix_path))? - } - }) -} - -#[cfg(test)] -mod tests { - use crate::process; - use crate::utils; - use anyhow::Context; - use std::fs; - use std::path::Path; - use tempfile::{tempdir_in, TempDir}; - - #[test] - fn tests_dir() -> anyhow::Result<()> { - for entry in Path::new("tests").read_dir()? { - let entry = entry?; - let path = entry.path(); - let name = entry.file_name().to_string_lossy().into_owned(); - - if !path.is_dir() { - continue; - } - - let expected_errors = fs::read_to_string(path.join("expected")) - .expect("No expected file for test {name}"); - - test_nixpkgs(&name, &path, &expected_errors)?; - } - Ok(()) - } - - // tempfile::tempdir needs to be wrapped in temp_env lock - // because it accesses TMPDIR environment variable. - pub fn tempdir() -> anyhow::Result { - let empty_list: [(&str, Option<&str>); 0] = []; - Ok(temp_env::with_vars(empty_list, tempfile::tempdir)?) - } - - // We cannot check case-conflicting files into Nixpkgs (the channel would fail to - // build), so we generate the case-conflicting file instead. - #[test] - fn test_case_sensitive() -> anyhow::Result<()> { - let temp_nixpkgs = tempdir()?; - let path = temp_nixpkgs.path(); - - if is_case_insensitive_fs(&path)? { - eprintln!("We're on a case-insensitive filesystem, skipping case-sensitivity test"); - return Ok(()); - } - - let base = path.join(utils::BASE_SUBPATH); - - fs::create_dir_all(base.join("fo/foo"))?; - fs::write(base.join("fo/foo/package.nix"), "{ someDrv }: someDrv")?; - - fs::create_dir_all(base.join("fo/foO"))?; - fs::write(base.join("fo/foO/package.nix"), "{ someDrv }: someDrv")?; - - test_nixpkgs( - "case_sensitive", - &path, - "pkgs/by-name/fo: Duplicate case-sensitive package directories \"foO\" and \"foo\".\nThis PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break.\n", - )?; - - Ok(()) - } - - /// Tests symlinked temporary directories. - /// This is needed because on darwin, `/tmp` is a symlink to `/private/tmp`, and Nix's - /// restrict-eval doesn't also allow access to the canonical path when you allow the - /// non-canonical one. - /// - /// The error if we didn't do this would look like this: - /// error: access to canonical path '/private/var/folders/[...]/.tmpFbcNO0' is forbidden in restricted mode - #[test] - fn test_symlinked_tmpdir() -> anyhow::Result<()> { - // Create a directory with two entries: - // - actual (dir) - // - symlinked -> actual (symlink) - let temp_root = tempdir()?; - fs::create_dir(temp_root.path().join("actual"))?; - std::os::unix::fs::symlink("actual", temp_root.path().join("symlinked"))?; - let tmpdir = temp_root.path().join("symlinked"); - - temp_env::with_var("TMPDIR", Some(&tmpdir), || { - test_nixpkgs( - "symlinked_tmpdir", - Path::new("tests/success"), - "Validated successfully\n", - ) - }) - } - - fn test_nixpkgs(name: &str, path: &Path, expected_errors: &str) -> anyhow::Result<()> { - let base_path = path.join("base"); - let base_nixpkgs = if base_path.exists() { - base_path.as_path() - } else { - Path::new("tests/empty-base") - }; - - // We don't want coloring to mess up the tests - let writer = temp_env::with_var("NO_COLOR", Some("1"), || -> anyhow::Result<_> { - let mut writer = vec![]; - process(base_nixpkgs.to_owned(), path.to_owned(), true, &mut writer) - .with_context(|| format!("Failed test case {name}"))?; - Ok(writer) - })?; - - let actual_errors = String::from_utf8_lossy(&writer); - - if actual_errors != expected_errors { - panic!( - "Failed test case {name}, expected these errors:\n=======\n{}\n=======\nbut got these:\n=======\n{}\n=======", - expected_errors, actual_errors - ); - } - Ok(()) - } - - /// Check whether a path is in a case-insensitive filesystem - fn is_case_insensitive_fs(path: &Path) -> anyhow::Result { - let dir = tempdir_in(path)?; - let base = dir.path(); - fs::write(base.join("aaa"), "")?; - Ok(base.join("AAA").exists()) - } -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/nix_file.rs b/pkgs/test/nixpkgs-check-by-name/src/nix_file.rs deleted file mode 100644 index e2dc1e1961414..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/nix_file.rs +++ /dev/null @@ -1,555 +0,0 @@ -//! This is a utility module for interacting with the syntax of Nix files - -use crate::utils::LineIndex; -use anyhow::Context; -use itertools::Either::{self, Left, Right}; -use relative_path::RelativePathBuf; -use rnix::ast; -use rnix::ast::Expr; -use rnix::ast::HasEntry; -use rowan::ast::AstNode; -use rowan::TextSize; -use rowan::TokenAtOffset; -use std::collections::hash_map::Entry; -use std::collections::HashMap; -use std::fs::read_to_string; -use std::path::Path; -use std::path::PathBuf; - -/// A structure to store parse results of Nix files in memory, -/// making sure that the same file never has to be parsed twice -#[derive(Default)] -pub struct NixFileStore { - entries: HashMap, -} - -impl NixFileStore { - /// Get the store entry for a Nix file if it exists, otherwise parse the file, insert it into - /// the store, and return the value - /// - /// Note that this function only gives an anyhow::Result::Err for I/O errors. - /// A parse error is anyhow::Result::Ok(Result::Err(error)) - pub fn get(&mut self, path: &Path) -> anyhow::Result<&NixFile> { - match self.entries.entry(path.to_owned()) { - Entry::Occupied(entry) => Ok(entry.into_mut()), - Entry::Vacant(entry) => Ok(entry.insert(NixFile::new(path)?)), - } - } -} - -/// A structure for storing a successfully parsed Nix file -pub struct NixFile { - /// The parent directory of the Nix file, for more convenient error handling - pub parent_dir: PathBuf, - /// The path to the file itself, for errors - pub path: PathBuf, - pub syntax_root: rnix::Root, - pub line_index: LineIndex, -} - -impl NixFile { - /// Creates a new NixFile, failing for I/O or parse errors - fn new(path: impl AsRef) -> anyhow::Result { - let Some(parent_dir) = path.as_ref().parent() else { - anyhow::bail!("Could not get parent of path {}", path.as_ref().display()) - }; - - let contents = read_to_string(&path) - .with_context(|| format!("Could not read file {}", path.as_ref().display()))?; - let line_index = LineIndex::new(&contents); - - // NOTE: There's now another Nixpkgs CI check to make sure all changed Nix files parse - // correctly, though that uses mainline Nix instead of rnix, so it doesn't give the same - // errors. In the future we should unify these two checks, ideally moving the other CI - // check into this tool as well and checking for both mainline Nix and rnix. - rnix::Root::parse(&contents) - // rnix's ::ok returns Result<_, _> , so no error is thrown away like it would be with - // std::result's ::ok - .ok() - .map(|syntax_root| NixFile { - parent_dir: parent_dir.to_path_buf(), - path: path.as_ref().to_owned(), - syntax_root, - line_index, - }) - .with_context(|| format!("Could not parse file {} with rnix", path.as_ref().display())) - } -} - -/// Information about callPackage arguments -#[derive(Debug, PartialEq)] -pub struct CallPackageArgumentInfo { - /// The relative path of the first argument, or `None` if it's not a path. - pub relative_path: Option, - /// Whether the second argument is an empty attribute set - pub empty_arg: bool, -} - -impl NixFile { - /// Returns information about callPackage arguments for an attribute at a specific line/column - /// index. - /// If the definition at the given location is not of the form ` = callPackage ;`, - /// `Ok((None, String))` is returned, with `String` being the definition itself. - /// - /// This function only returns `Err` for problems that can't be caused by the Nix contents, - /// but rather problems in this programs code itself. - /// - /// This is meant to be used with the location returned from `builtins.unsafeGetAttrPos`, e.g.: - /// - Create file `default.nix` with contents - /// ```nix - /// self: { - /// foo = self.callPackage ./default.nix { }; - /// } - /// ``` - /// - Evaluate - /// ```nix - /// builtins.unsafeGetAttrPos "foo" (import ./default.nix { }) - /// ``` - /// results in `{ file = ./default.nix; line = 2; column = 3; }` - /// - Get the NixFile for `.file` from a `NixFileStore` - /// - Call this function with `.line`, `.column` and `relative_to` as the (absolute) current directory - /// - /// You'll get back - /// ```rust - /// Ok(( - /// Some(CallPackageArgumentInfo { path = Some("default.nix"), empty_arg: true }), - /// "foo = self.callPackage ./default.nix { };", - /// )) - /// ``` - /// - /// Note that this also returns the same for `pythonPackages.callPackage`. It doesn't make an - /// attempt at distinguishing this. - pub fn call_package_argument_info_at( - &self, - line: usize, - column: usize, - relative_to: &Path, - ) -> anyhow::Result<(Option, String)> { - Ok(match self.attrpath_value_at(line, column)? { - Left(definition) => (None, definition), - Right(attrpath_value) => { - let definition = attrpath_value.to_string(); - let attrpath_value = - self.attrpath_value_call_package_argument_info(attrpath_value, relative_to)?; - (attrpath_value, definition) - } - }) - } - - // Internal function mainly to make it independently testable - fn attrpath_value_at( - &self, - line: usize, - column: usize, - ) -> anyhow::Result> { - let index = self.line_index.fromlinecolumn(line, column); - - let token_at_offset = self - .syntax_root - .syntax() - .token_at_offset(TextSize::from(index as u32)); - - // The token_at_offset function takes indices to mean a location _between_ characters, - // which in this case is some spacing followed by the attribute name: - // - // foo = 10; - // /\ - // This is the token offset, we get both the (newline + indentation) on the left side, - // and the attribute name on the right side. - let TokenAtOffset::Between(_space, token) = token_at_offset else { - anyhow::bail!("Line {line} column {column} in {} is not the start of a token, but rather {token_at_offset:?}", self.path.display()) - }; - - // token looks like "foo" - let Some(node) = token.parent() else { - anyhow::bail!( - "Token on line {line} column {column} in {} does not have a parent node: {token:?}", - self.path.display() - ) - }; - - if ast::Attr::can_cast(node.kind()) { - // Something like `foo`, `"foo"` or `${"foo"}` - } else if ast::Inherit::can_cast(node.kind()) { - // Something like `inherit ` or `inherit () ` - // This is the only other way how `builtins.unsafeGetAttrPos` can return - // attribute positions, but we only look for ones like ` = `, so - // ignore this - return Ok(Left(node.to_string())); - } else { - // However, anything else is not expected and smells like a bug - anyhow::bail!( - "Node in {} is neither an attribute node nor an inherit node: {node:?}", - self.path.display() - ) - } - - // node looks like "foo" - let Some(attrpath_node) = node.parent() else { - anyhow::bail!( - "Node in {} does not have a parent node: {node:?}", - self.path.display() - ) - }; - - if !ast::Attrpath::can_cast(attrpath_node.kind()) { - // We know that `node` is an attribute, its parent should be an attribute path - anyhow::bail!( - "In {}, attribute parent node is not an attribute path node: {attrpath_node:?}", - self.path.display() - ) - } - - // attrpath_node looks like "foo.bar" - let Some(attrpath_value_node) = attrpath_node.parent() else { - anyhow::bail!( - "Attribute path node in {} does not have a parent node: {attrpath_node:?}", - self.path.display() - ) - }; - - if !ast::AttrpathValue::can_cast(attrpath_value_node.kind()) { - anyhow::bail!( - "Node in {} is not an attribute path value node: {attrpath_value_node:?}", - self.path.display() - ) - } - // attrpath_value_node looks like "foo.bar = 10;" - - // unwrap is fine because we confirmed that we can cast with the above check. - // We could avoid this `unwrap` for a `clone`, since `cast` consumes the argument, - // but we still need it for the error message when the cast fails. - Ok(Right( - ast::AttrpathValue::cast(attrpath_value_node).unwrap(), - )) - } - - // Internal function mainly to make attrpath_value_at independently testable - fn attrpath_value_call_package_argument_info( - &self, - attrpath_value: ast::AttrpathValue, - relative_to: &Path, - ) -> anyhow::Result> { - let Some(attrpath) = attrpath_value.attrpath() else { - anyhow::bail!("attrpath value node doesn't have an attrpath: {attrpath_value:?}") - }; - - // At this point we know it's something like `foo...bar = ...` - - if attrpath.attrs().count() > 1 { - // If the attribute path has multiple entries, the left-most entry is an attribute and - // can't be a `callPackage`. - // - // FIXME: `builtins.unsafeGetAttrPos` will return the same position for all attribute - // paths and we can't really know which one it is. We could have a case like - // `foo.bar = callPackage ... { }` and trying to determine if `bar` is a `callPackage`, - // where this is not correct. - // However, this case typically doesn't occur anyways, - // because top-level packages wouldn't be nested under an attribute set. - return Ok(None); - } - let Some(value) = attrpath_value.value() else { - anyhow::bail!("attrpath value node doesn't have a value: {attrpath_value:?}") - }; - - // At this point we know it's something like `foo = ...` - - let Expr::Apply(apply1) = value else { - // Not even a function call, instead something like `foo = null` - return Ok(None); - }; - let Some(function1) = apply1.lambda() else { - anyhow::bail!("apply node doesn't have a lambda: {apply1:?}") - }; - let Some(arg1) = apply1.argument() else { - anyhow::bail!("apply node doesn't have an argument: {apply1:?}") - }; - - // At this point we know it's something like `foo = `. - // For a callPackage, `` would be `callPackage ./file` and `` would be `{ }` - - let empty_arg = if let Expr::AttrSet(attrset) = arg1 { - // We can only statically determine whether the argument is empty if it's an attribute - // set _expression_, even though other kind of expressions could evaluate to an attribute - // set _value_. But this is what we want anyways - attrset.entries().next().is_none() - } else { - false - }; - - // Because callPackage takes two curried arguments, the first function needs to be a - // function call itself - let Expr::Apply(apply2) = function1 else { - // Not a callPackage, instead something like `foo = import ./foo` - return Ok(None); - }; - let Some(function2) = apply2.lambda() else { - anyhow::bail!("apply node doesn't have a lambda: {apply2:?}") - }; - let Some(arg2) = apply2.argument() else { - anyhow::bail!("apply node doesn't have an argument: {apply2:?}") - }; - - // At this point we know it's something like `foo = `. - // For a callPackage, `` would be `callPackage`, `` would be `./file` - - // Check that is a path expression - let path = if let Expr::Path(actual_path) = arg2 { - // Try to statically resolve the path and turn it into a nixpkgs-relative path - if let ResolvedPath::Within(p) = self.static_resolve_path(actual_path, relative_to) { - Some(p) - } else { - // We can't statically know an existing path inside Nixpkgs used as - None - } - } else { - // is not a path, but rather e.g. an inline expression - None - }; - - // Check that is an identifier, or an attribute path with an identifier at the end - let ident = match function2 { - Expr::Ident(ident) => { - // This means it's something like `foo = callPackage ` - ident - } - Expr::Select(select) => { - // This means it's something like `foo = self.callPackage `. - // We also end up here for e.g. `pythonPackages.callPackage`, but the - // callPackage-mocking method will take care of not triggering for this case. - - if select.default_expr().is_some() { - // Very odd case, but this would be `foo = self.callPackage or true ./test.nix {} - // (yes this is valid Nix code) - return Ok(None); - } - let Some(attrpath) = select.attrpath() else { - anyhow::bail!("select node doesn't have an attrpath: {select:?}") - }; - let Some(last) = attrpath.attrs().last() else { - // This case shouldn't be possible, it would be `foo = self. ./test.nix {}`, - // which shouldn't parse - anyhow::bail!("select node has an empty attrpath: {select:?}") - }; - if let ast::Attr::Ident(ident) = last { - ident - } else { - // Here it's something like `foo = self."callPackage" /test.nix {}` - // which we're not gonna bother with - return Ok(None); - } - } - // Any other expression we're not gonna treat as callPackage - _ => return Ok(None), - }; - - let Some(token) = ident.ident_token() else { - anyhow::bail!("ident node doesn't have a token: {ident:?}") - }; - - if token.text() == "callPackage" { - Ok(Some(CallPackageArgumentInfo { - relative_path: path, - empty_arg, - })) - } else { - Ok(None) - } - } -} - -/// The result of trying to statically resolve a Nix path expression -pub enum ResolvedPath { - /// Something like `./foo/${bar}/baz`, can't be known statically - Interpolated, - /// Something like ``, can't be known statically - SearchPath, - /// Path couldn't be resolved due to an IO error, - /// e.g. if the path doesn't exist or you don't have the right permissions - Unresolvable(std::io::Error), - /// The path is outside the given absolute path - Outside, - /// The path is within the given absolute path. - /// The `RelativePathBuf` is the relative path under the given absolute path. - Within(RelativePathBuf), -} - -impl NixFile { - /// Statically resolves a Nix path expression and checks that it's within an absolute path - /// - /// E.g. for the path expression `./bar.nix` in `./foo.nix` and an absolute path of the - /// current directory, the function returns `ResolvedPath::Within(./bar.nix)` - pub fn static_resolve_path(&self, node: ast::Path, relative_to: &Path) -> ResolvedPath { - if node.parts().count() != 1 { - // If there's more than 1 interpolated part, it's of the form `./foo/${bar}/baz`. - return ResolvedPath::Interpolated; - } - - let text = node.to_string(); - - if text.starts_with('<') { - // A search path like ``. There doesn't appear to be better way to detect - // these in rnix - return ResolvedPath::SearchPath; - } - - // Join the file's parent directory and the path expression, then resolve it - // FIXME: Expressions like `../../../../foo/bar/baz/qux` or absolute paths - // may resolve close to the original file, but may have left the relative_to. - // That should be checked more strictly - match self.parent_dir.join(Path::new(&text)).canonicalize() { - Err(resolution_error) => ResolvedPath::Unresolvable(resolution_error), - Ok(resolved) => { - // Check if it's within relative_to - match resolved.strip_prefix(relative_to) { - Err(_prefix_error) => ResolvedPath::Outside, - Ok(suffix) => ResolvedPath::Within( - RelativePathBuf::from_path(suffix).expect("a relative path"), - ), - } - } - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - use crate::tests; - use indoc::indoc; - - #[test] - fn detects_attributes() -> anyhow::Result<()> { - let temp_dir = tests::tempdir()?; - let file = temp_dir.path().join("file.nix"); - let contents = indoc! {r#" - toInherit: { - foo = 1; - "bar" = 2; - ${"baz"} = 3; - "${"qux"}" = 4; - - # A - quux - # B - = - # C - 5 - # D - ; - # E - - /**/quuux/**/=/**/5/**/;/*E*/ - - inherit toInherit; - inherit (toInherit) toInherit; - } - "#}; - - std::fs::write(&file, contents)?; - - let nix_file = NixFile::new(&file)?; - - // These are builtins.unsafeGetAttrPos locations for the attributes - let cases = [ - (2, 3, Right("foo = 1;")), - (3, 3, Right(r#""bar" = 2;"#)), - (4, 3, Right(r#"${"baz"} = 3;"#)), - (5, 3, Right(r#""${"qux"}" = 4;"#)), - (8, 3, Right("quux\n # B\n =\n # C\n 5\n # D\n ;")), - (17, 7, Right("quuux/**/=/**/5/**/;")), - (19, 10, Left("inherit toInherit;")), - (20, 22, Left("inherit (toInherit) toInherit;")), - ]; - - for (line, column, expected_result) in cases { - let actual_result = nix_file - .attrpath_value_at(line, column) - .context(format!("line {line}, column {column}"))? - .map_right(|node| node.to_string()); - let owned_expected_result = expected_result - .map(|x| x.to_string()) - .map_left(|x| x.to_string()); - assert_eq!( - actual_result, owned_expected_result, - "line {line}, column {column}" - ); - } - - Ok(()) - } - - #[test] - fn detects_call_package() -> anyhow::Result<()> { - let temp_dir = tests::tempdir()?; - let file = temp_dir.path().join("file.nix"); - let contents = indoc! {r#" - self: with self; { - a.sub = null; - b = null; - c = import ./file.nix; - d = import ./file.nix { }; - e = pythonPackages.callPackage ./file.nix { }; - f = callPackage ./file.nix { }; - g = callPackage ({ }: { }) { }; - h = callPackage ./file.nix { x = 0; }; - i = callPackage ({ }: { }) (let in { }); - } - "#}; - - std::fs::write(&file, contents)?; - - let nix_file = NixFile::new(&file)?; - - let cases = [ - (2, None), - (3, None), - (4, None), - (5, None), - ( - 6, - Some(CallPackageArgumentInfo { - relative_path: Some(RelativePathBuf::from("file.nix")), - empty_arg: true, - }), - ), - ( - 7, - Some(CallPackageArgumentInfo { - relative_path: Some(RelativePathBuf::from("file.nix")), - empty_arg: true, - }), - ), - ( - 8, - Some(CallPackageArgumentInfo { - relative_path: None, - empty_arg: true, - }), - ), - ( - 9, - Some(CallPackageArgumentInfo { - relative_path: Some(RelativePathBuf::from("file.nix")), - empty_arg: false, - }), - ), - ( - 10, - Some(CallPackageArgumentInfo { - relative_path: None, - empty_arg: false, - }), - ), - ]; - - for (line, expected_result) in cases { - let (actual_result, _definition) = nix_file - .call_package_argument_info_at(line, 3, temp_dir.path()) - .context(format!("line {line}"))?; - assert_eq!(actual_result, expected_result, "line {line}"); - } - - Ok(()) - } -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/nixpkgs_problem.rs b/pkgs/test/nixpkgs-check-by-name/src/nixpkgs_problem.rs deleted file mode 100644 index 7e257c0ed5d88..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/nixpkgs_problem.rs +++ /dev/null @@ -1,425 +0,0 @@ -use crate::structure; -use crate::utils::PACKAGE_NIX_FILENAME; -use indoc::writedoc; -use relative_path::RelativePath; -use relative_path::RelativePathBuf; -use std::ffi::OsString; -use std::fmt; - -/// Any problem that can occur when checking Nixpkgs -/// All paths are relative to Nixpkgs such that the error messages can't be influenced by Nixpkgs absolute -/// location -#[derive(Clone)] -pub enum NixpkgsProblem { - ShardNonDir { - relative_shard_path: RelativePathBuf, - }, - InvalidShardName { - relative_shard_path: RelativePathBuf, - shard_name: String, - }, - PackageNonDir { - relative_package_dir: RelativePathBuf, - }, - CaseSensitiveDuplicate { - relative_shard_path: RelativePathBuf, - first: OsString, - second: OsString, - }, - InvalidPackageName { - relative_package_dir: RelativePathBuf, - package_name: String, - }, - IncorrectShard { - relative_package_dir: RelativePathBuf, - correct_relative_package_dir: RelativePathBuf, - }, - PackageNixNonExistent { - relative_package_dir: RelativePathBuf, - }, - PackageNixDir { - relative_package_dir: RelativePathBuf, - }, - UndefinedAttr { - relative_package_file: RelativePathBuf, - package_name: String, - }, - EmptyArgument { - package_name: String, - file: RelativePathBuf, - line: usize, - column: usize, - definition: String, - }, - NonToplevelCallPackage { - package_name: String, - file: RelativePathBuf, - line: usize, - column: usize, - definition: String, - }, - NonPath { - package_name: String, - file: RelativePathBuf, - line: usize, - column: usize, - definition: String, - }, - WrongCallPackagePath { - package_name: String, - file: RelativePathBuf, - line: usize, - actual_path: RelativePathBuf, - expected_path: RelativePathBuf, - }, - NonSyntacticCallPackage { - package_name: String, - file: RelativePathBuf, - line: usize, - column: usize, - definition: String, - }, - NonDerivation { - relative_package_file: RelativePathBuf, - package_name: String, - }, - OutsideSymlink { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - }, - UnresolvableSymlink { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - io_error: String, - }, - PathInterpolation { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - line: usize, - text: String, - }, - SearchPath { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - line: usize, - text: String, - }, - OutsidePathReference { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - line: usize, - text: String, - }, - UnresolvablePathReference { - relative_package_dir: RelativePathBuf, - subpath: RelativePathBuf, - line: usize, - text: String, - io_error: String, - }, - MovedOutOfByNameEmptyArg { - package_name: String, - call_package_path: Option, - file: RelativePathBuf, - }, - MovedOutOfByNameNonEmptyArg { - package_name: String, - call_package_path: Option, - file: RelativePathBuf, - }, - NewPackageNotUsingByNameEmptyArg { - package_name: String, - call_package_path: Option, - file: RelativePathBuf, - }, - NewPackageNotUsingByNameNonEmptyArg { - package_name: String, - call_package_path: Option, - file: RelativePathBuf, - }, - InternalCallPackageUsed { - attr_name: String, - }, - CannotDetermineAttributeLocation { - attr_name: String, - }, -} - -impl fmt::Display for NixpkgsProblem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - NixpkgsProblem::ShardNonDir { relative_shard_path } => - write!( - f, - "{relative_shard_path}: This is a file, but it should be a directory.", - ), - NixpkgsProblem::InvalidShardName { relative_shard_path, shard_name } => - write!( - f, - "{relative_shard_path}: Invalid directory name \"{shard_name}\", must be at most 2 ASCII characters consisting of a-z, 0-9, \"-\" or \"_\".", - ), - NixpkgsProblem::PackageNonDir { relative_package_dir } => - write!( - f, - "{relative_package_dir}: This path is a file, but it should be a directory.", - ), - NixpkgsProblem::CaseSensitiveDuplicate { relative_shard_path, first, second } => - write!( - f, - "{relative_shard_path}: Duplicate case-sensitive package directories {first:?} and {second:?}.", - ), - NixpkgsProblem::InvalidPackageName { relative_package_dir, package_name } => - write!( - f, - "{relative_package_dir}: Invalid package directory name \"{package_name}\", must be ASCII characters consisting of a-z, A-Z, 0-9, \"-\" or \"_\".", - ), - NixpkgsProblem::IncorrectShard { relative_package_dir, correct_relative_package_dir } => - write!( - f, - "{relative_package_dir}: Incorrect directory location, should be {correct_relative_package_dir} instead.", - ), - NixpkgsProblem::PackageNixNonExistent { relative_package_dir } => - write!( - f, - "{relative_package_dir}: Missing required \"{PACKAGE_NIX_FILENAME}\" file.", - ), - NixpkgsProblem::PackageNixDir { relative_package_dir } => - write!( - f, - "{relative_package_dir}: \"{PACKAGE_NIX_FILENAME}\" must be a file.", - ), - NixpkgsProblem::UndefinedAttr { relative_package_file, package_name } => - write!( - f, - "pkgs.{package_name}: This attribute is not defined but it should be defined automatically as {relative_package_file}", - ), - NixpkgsProblem::EmptyArgument { package_name, file, line, column, definition } => { - let relative_package_dir = structure::relative_dir_for_package(package_name); - let relative_package_file = structure::relative_file_for_package(package_name); - let indented_definition = indent_definition(*column, definition.clone()); - writedoc!( - f, - " - - Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like - - {package_name} = callPackage ./{relative_package_file} {{ /* ... */ }}; - - However, in this PR, the second argument is empty. See the definition in {file}:{line}: - - {indented_definition} - - Such a definition is provided automatically and therefore not necessary. Please remove it. - ", - ) - } - NixpkgsProblem::NonToplevelCallPackage { package_name, file, line, column, definition } => { - let relative_package_dir = structure::relative_dir_for_package(package_name); - let relative_package_file = structure::relative_file_for_package(package_name); - let indented_definition = indent_definition(*column, definition.clone()); - writedoc!( - f, - " - - Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like - - {package_name} = callPackage ./{relative_package_file} {{ /* ... */ }}; - - However, in this PR, a different `callPackage` is used. See the definition in {file}:{line}: - - {indented_definition} - ", - ) - } - NixpkgsProblem::NonPath { package_name, file, line, column, definition } => { - let relative_package_dir = structure::relative_dir_for_package(package_name); - let relative_package_file = structure::relative_file_for_package(package_name); - let indented_definition = indent_definition(*column, definition.clone()); - writedoc!( - f, - " - - Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like - - {package_name} = callPackage ./{relative_package_file} {{ /* ... */ }}; - - However, in this PR, the first `callPackage` argument is not a path. See the definition in {file}:{line}: - - {indented_definition} - ", - ) - } - NixpkgsProblem::WrongCallPackagePath { package_name, file, line, actual_path, expected_path } => { - let relative_package_dir = structure::relative_dir_for_package(package_name); - let expected_path_expr = create_path_expr(file, expected_path); - let actual_path_expr = create_path_expr(file, actual_path); - writedoc! { - f, - " - - Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like - - {package_name} = callPackage {expected_path_expr} {{ /* ... */ }}; - - However, in this PR, the first `callPackage` argument is the wrong path. See the definition in {file}:{line}: - - {package_name} = callPackage {actual_path_expr} {{ /* ... */ }}; - ", - } - } - NixpkgsProblem::NonSyntacticCallPackage { package_name, file, line, column, definition } => { - let relative_package_dir = structure::relative_dir_for_package(package_name); - let relative_package_file = structure::relative_file_for_package(package_name); - let indented_definition = indent_definition(*column, definition.clone()); - writedoc!( - f, - " - - Because {relative_package_dir} exists, the attribute `pkgs.{package_name}` must be defined like - - {package_name} = callPackage ./{relative_package_file} {{ /* ... */ }}; - - However, in this PR, it isn't defined that way. See the definition in {file}:{line} - - {indented_definition} - ", - ) - } - NixpkgsProblem::NonDerivation { relative_package_file, package_name } => - write!( - f, - "pkgs.{package_name}: This attribute defined by {relative_package_file} is not a derivation", - ), - NixpkgsProblem::OutsideSymlink { relative_package_dir, subpath } => - write!( - f, - "{relative_package_dir}: Path {subpath} is a symlink pointing to a path outside the directory of that package.", - ), - NixpkgsProblem::UnresolvableSymlink { relative_package_dir, subpath, io_error } => - write!( - f, - "{relative_package_dir}: Path {subpath} is a symlink which cannot be resolved: {io_error}.", - ), - NixpkgsProblem::PathInterpolation { relative_package_dir, subpath, line, text } => - write!( - f, - "{relative_package_dir}: File {subpath} at line {line} contains the path expression \"{text}\", which is not yet supported and may point outside the directory of that package.", - ), - NixpkgsProblem::SearchPath { relative_package_dir, subpath, line, text } => - write!( - f, - "{relative_package_dir}: File {subpath} at line {line} contains the nix search path expression \"{text}\" which may point outside the directory of that package.", - ), - NixpkgsProblem::OutsidePathReference { relative_package_dir, subpath, line, text } => - write!( - f, - "{relative_package_dir}: File {subpath} at line {line} contains the path expression \"{text}\" which may point outside the directory of that package.", - ), - NixpkgsProblem::UnresolvablePathReference { relative_package_dir, subpath, line, text, io_error } => - write!( - f, - "{relative_package_dir}: File {subpath} at line {line} contains the path expression \"{text}\" which cannot be resolved: {io_error}.", - ), - NixpkgsProblem::MovedOutOfByNameEmptyArg { package_name, call_package_path, file } => { - let call_package_arg = - if let Some(path) = &call_package_path { - format!("./{path}") - } else { - "...".into() - }; - let relative_package_file = structure::relative_file_for_package(package_name); - writedoc!( - f, - " - - Attribute `pkgs.{package_name}` was previously defined in {relative_package_file}, but is now manually defined as `callPackage {call_package_arg} {{ /* ... */ }}` in {file}. - Please move the package back and remove the manual `callPackage`. - ", - ) - }, - NixpkgsProblem::MovedOutOfByNameNonEmptyArg { package_name, call_package_path, file } => { - let call_package_arg = - if let Some(path) = &call_package_path { - format!("./{}", path) - } else { - "...".into() - }; - let relative_package_file = structure::relative_file_for_package(package_name); - // This can happen if users mistakenly assume that for custom arguments, - // pkgs/by-name can't be used. - writedoc!( - f, - " - - Attribute `pkgs.{package_name}` was previously defined in {relative_package_file}, but is now manually defined as `callPackage {call_package_arg} {{ ... }}` in {file}. - While the manual `callPackage` is still needed, it's not necessary to move the package files. - ", - ) - }, - NixpkgsProblem::NewPackageNotUsingByNameEmptyArg { package_name, call_package_path, file } => { - let call_package_arg = - if let Some(path) = &call_package_path { - format!("./{}", path) - } else { - "...".into() - }; - let relative_package_file = structure::relative_file_for_package(package_name); - writedoc!( - f, - " - - Attribute `pkgs.{package_name}` is a new top-level package using `pkgs.callPackage {call_package_arg} {{ /* ... */ }}`. - Please define it in {relative_package_file} instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is `{{ }}`, no manual `callPackage` in {file} is needed anymore. - ", - ) - }, - NixpkgsProblem::NewPackageNotUsingByNameNonEmptyArg { package_name, call_package_path, file } => { - let call_package_arg = - if let Some(path) = &call_package_path { - format!("./{}", path) - } else { - "...".into() - }; - let relative_package_file = structure::relative_file_for_package(package_name); - writedoc!( - f, - " - - Attribute `pkgs.{package_name}` is a new top-level package using `pkgs.callPackage {call_package_arg} {{ /* ... */ }}`. - Please define it in {relative_package_file} instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is not `{{ }}`, the manual `callPackage` in {file} is still needed. - ", - ) - }, - NixpkgsProblem::InternalCallPackageUsed { attr_name } => - write!( - f, - "pkgs.{attr_name}: This attribute is defined using `_internalCallByNamePackageFile`, which is an internal function not intended for manual use.", - ), - NixpkgsProblem::CannotDetermineAttributeLocation { attr_name } => - write!( - f, - "pkgs.{attr_name}: Cannot determine the location of this attribute using `builtins.unsafeGetAttrPos`.", - ), - } - } -} - -fn indent_definition(column: usize, definition: String) -> String { - // The entire code should be indented 4 spaces - textwrap::indent( - // But first we want to strip the code's natural indentation - &textwrap::dedent( - // The definition _doesn't_ include the leading spaces, but we can - // recover those from the column - &format!("{}{definition}", " ".repeat(column - 1)), - ), - " ", - ) -} - -/// Creates a Nix path expression that when put into Nix file `from_file`, would point to the `to_file`. -fn create_path_expr( - from_file: impl AsRef, - to_file: impl AsRef, -) -> String { - // This `expect` calls should never trigger because we only call this function with files. - // That's why we `expect` them! - let from = from_file.as_ref().parent().expect("a parent for this path"); - let rel = from.relative(to_file); - format!("./{rel}") -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/ratchet.rs b/pkgs/test/nixpkgs-check-by-name/src/ratchet.rs deleted file mode 100644 index 8136d641c3515..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/ratchet.rs +++ /dev/null @@ -1,184 +0,0 @@ -//! This module implements the ratchet checks, see ../README.md#ratchet-checks -//! -//! Each type has a `compare` method that validates the ratchet checks for that item. - -use crate::nix_file::CallPackageArgumentInfo; -use crate::nixpkgs_problem::NixpkgsProblem; -use crate::validation::{self, Validation, Validation::Success}; -use relative_path::RelativePathBuf; -use std::collections::HashMap; - -/// The ratchet value for the entirety of Nixpkgs. -#[derive(Default)] -pub struct Nixpkgs { - /// Sorted list of packages in package_map - pub package_names: Vec, - /// The ratchet values for all packages - pub package_map: HashMap, -} - -impl Nixpkgs { - /// Validates the ratchet checks for Nixpkgs - pub fn compare(from: Self, to: Self) -> Validation<()> { - validation::sequence_( - // We only loop over the current attributes, - // we don't need to check ones that were removed - to.package_names.into_iter().map(|name| { - Package::compare(&name, from.package_map.get(&name), &to.package_map[&name]) - }), - ) - } -} - -/// The ratchet value for a top-level package -pub struct Package { - /// The ratchet value for the check for non-auto-called empty arguments - pub manual_definition: RatchetState, - - /// The ratchet value for the check for new packages using pkgs/by-name - pub uses_by_name: RatchetState, -} - -impl Package { - /// Validates the ratchet checks for a top-level package - pub fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { - validation::sequence_([ - RatchetState::::compare( - name, - optional_from.map(|x| &x.manual_definition), - &to.manual_definition, - ), - RatchetState::::compare( - name, - optional_from.map(|x| &x.uses_by_name), - &to.uses_by_name, - ), - ]) - } -} - -/// The ratchet state of a generic ratchet check. -pub enum RatchetState { - /// The ratchet is loose, it can be tightened more. - /// In other words, this is the legacy state we're trying to move away from. - /// Introducing new instances is not allowed but previous instances will continue to be allowed. - /// The `Context` is context for error messages in case a new instance of this state is - /// introduced - Loose(Ratchet::ToContext), - /// The ratchet is tight, it can't be tightened any further. - /// This is either because we already use the latest state, or because the ratchet isn't - /// relevant. - Tight, - /// This ratchet can't be applied. - /// State transitions from/to NonApplicable are always allowed - NonApplicable, -} - -/// A trait that can convert an attribute-specific error context into a NixpkgsProblem -pub trait ToNixpkgsProblem { - /// Context relating to the Nixpkgs that is being transitioned _to_ - type ToContext; - - /// How to convert an attribute-specific error context into a NixpkgsProblem - fn to_nixpkgs_problem( - name: &str, - optional_from: Option<()>, - to: &Self::ToContext, - ) -> NixpkgsProblem; -} - -impl RatchetState { - /// Compare the previous ratchet state of an attribute to the new state. - /// The previous state may be `None` in case the attribute is new. - fn compare(name: &str, optional_from: Option<&Self>, to: &Self) -> Validation<()> { - match (optional_from, to) { - // Loosening a ratchet is now allowed - (Some(RatchetState::Tight), RatchetState::Loose(loose_context)) => { - Context::to_nixpkgs_problem(name, Some(()), loose_context).into() - } - - // Introducing a loose ratchet is also not allowed - (None, RatchetState::Loose(loose_context)) => { - Context::to_nixpkgs_problem(name, None, loose_context).into() - } - - // Everything else is allowed, including: - // - Loose -> Loose (grandfathering policy for a loose ratchet) - // - -> Tight (always okay to keep or make the ratchet tight) - // - Anything involving NotApplicable, where we can't really make any good calls - _ => Success(()), - } - } -} - -/// The ratchet to check whether a top-level attribute has/needs -/// a manual definition, e.g. in all-packages.nix. -/// -/// This ratchet is only tight for attributes that: -/// - Are not defined in `pkgs/by-name`, and rely on a manual definition -/// - Are defined in `pkgs/by-name` without any manual definition, -/// (no custom argument overrides) -/// - Are defined with `pkgs/by-name` with a manual definition that can't be removed -/// because it provides custom argument overrides -/// -/// In comparison, this ratchet is loose for attributes that: -/// - Are defined in `pkgs/by-name` with a manual definition -/// that doesn't have any custom argument overrides -pub enum ManualDefinition {} - -impl ToNixpkgsProblem for ManualDefinition { - type ToContext = NixpkgsProblem; - - fn to_nixpkgs_problem( - _name: &str, - _optional_from: Option<()>, - to: &Self::ToContext, - ) -> NixpkgsProblem { - (*to).clone() - } -} - -/// The ratchet value of an attribute -/// for the check that new packages use pkgs/by-name -/// -/// This checks that all new package defined using callPackage must be defined via pkgs/by-name -/// It also checks that once a package uses pkgs/by-name, it can't switch back to all-packages.nix -pub enum UsesByName {} - -impl ToNixpkgsProblem for UsesByName { - type ToContext = (CallPackageArgumentInfo, RelativePathBuf); - - fn to_nixpkgs_problem( - name: &str, - optional_from: Option<()>, - (to, file): &Self::ToContext, - ) -> NixpkgsProblem { - if let Some(()) = optional_from { - if to.empty_arg { - NixpkgsProblem::MovedOutOfByNameEmptyArg { - package_name: name.to_owned(), - call_package_path: to.relative_path.clone(), - file: file.to_owned(), - } - } else { - NixpkgsProblem::MovedOutOfByNameNonEmptyArg { - package_name: name.to_owned(), - call_package_path: to.relative_path.clone(), - file: file.to_owned(), - } - } - } else if to.empty_arg { - NixpkgsProblem::NewPackageNotUsingByNameEmptyArg { - package_name: name.to_owned(), - call_package_path: to.relative_path.clone(), - file: file.to_owned(), - } - } else { - NixpkgsProblem::NewPackageNotUsingByNameNonEmptyArg { - package_name: name.to_owned(), - call_package_path: to.relative_path.clone(), - file: file.to_owned(), - } - } - } -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/references.rs b/pkgs/test/nixpkgs-check-by-name/src/references.rs deleted file mode 100644 index e2319163ccc67..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/references.rs +++ /dev/null @@ -1,176 +0,0 @@ -use crate::nixpkgs_problem::NixpkgsProblem; -use crate::utils; -use crate::validation::{self, ResultIteratorExt, Validation::Success}; -use crate::NixFileStore; -use relative_path::RelativePath; - -use anyhow::Context; -use rowan::ast::AstNode; -use std::ffi::OsStr; -use std::path::Path; - -/// Check that every package directory in pkgs/by-name doesn't link to outside that directory. -/// Both symlinks and Nix path expressions are checked. -pub fn check_references( - nix_file_store: &mut NixFileStore, - relative_package_dir: &RelativePath, - absolute_package_dir: &Path, -) -> validation::Result<()> { - // The first subpath to check is the package directory itself, which we can represent as an - // empty path, since the absolute package directory gets prepended to this. - // We don't use `./.` to keep the error messages cleaner - // (there's no canonicalisation going on underneath) - let subpath = RelativePath::new(""); - check_path( - nix_file_store, - relative_package_dir, - absolute_package_dir, - subpath, - ) - .with_context(|| { - format!( - "While checking the references in package directory {}", - relative_package_dir - ) - }) -} - -/// Checks for a specific path to not have references outside -/// -/// The subpath is the relative path within the package directory we're currently checking. -/// A relative path so that the error messages don't get absolute paths (which are messy in CI). -/// The absolute package directory gets prepended before doing anything with it though. -fn check_path( - nix_file_store: &mut NixFileStore, - relative_package_dir: &RelativePath, - absolute_package_dir: &Path, - subpath: &RelativePath, -) -> validation::Result<()> { - let path = subpath.to_path(absolute_package_dir); - - Ok(if path.is_symlink() { - // Check whether the symlink resolves to outside the package directory - match path.canonicalize() { - Ok(target) => { - // No need to handle the case of it being inside the directory, since we scan through the - // entire directory recursively anyways - if let Err(_prefix_error) = target.strip_prefix(absolute_package_dir) { - NixpkgsProblem::OutsideSymlink { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - } - .into() - } else { - Success(()) - } - } - Err(io_error) => NixpkgsProblem::UnresolvableSymlink { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - io_error: io_error.to_string(), - } - .into(), - } - } else if path.is_dir() { - // Recursively check each entry - validation::sequence_( - utils::read_dir_sorted(&path)? - .into_iter() - .map(|entry| { - check_path( - nix_file_store, - relative_package_dir, - absolute_package_dir, - // TODO: The relative_path crate doesn't seem to support OsStr - &subpath.join(entry.file_name().to_string_lossy().to_string()), - ) - }) - .collect_vec() - .with_context(|| format!("Error while recursing into {}", subpath))?, - ) - } else if path.is_file() { - // Only check Nix files - if let Some(ext) = path.extension() { - if ext == OsStr::new("nix") { - check_nix_file( - nix_file_store, - relative_package_dir, - absolute_package_dir, - subpath, - ) - .with_context(|| format!("Error while checking Nix file {}", subpath))? - } else { - Success(()) - } - } else { - Success(()) - } - } else { - // This should never happen, git doesn't support other file types - anyhow::bail!("Unsupported file type for path {}", subpath); - }) -} - -/// Check whether a nix file contains path expression references pointing outside the package -/// directory -fn check_nix_file( - nix_file_store: &mut NixFileStore, - relative_package_dir: &RelativePath, - absolute_package_dir: &Path, - subpath: &RelativePath, -) -> validation::Result<()> { - let path = subpath.to_path(absolute_package_dir); - - let nix_file = nix_file_store.get(&path)?; - - Ok(validation::sequence_( - nix_file.syntax_root.syntax().descendants().map(|node| { - let text = node.text().to_string(); - let line = nix_file.line_index.line(node.text_range().start().into()); - - // We're only interested in Path expressions - let Some(path) = rnix::ast::Path::cast(node) else { - return Success(()); - }; - - use crate::nix_file::ResolvedPath; - - match nix_file.static_resolve_path(path, absolute_package_dir) { - ResolvedPath::Interpolated => NixpkgsProblem::PathInterpolation { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - line, - text, - } - .into(), - ResolvedPath::SearchPath => NixpkgsProblem::SearchPath { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - line, - text, - } - .into(), - ResolvedPath::Outside => NixpkgsProblem::OutsidePathReference { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - line, - text, - } - .into(), - ResolvedPath::Unresolvable(e) => NixpkgsProblem::UnresolvablePathReference { - relative_package_dir: relative_package_dir.to_owned(), - subpath: subpath.to_owned(), - line, - text, - io_error: e.to_string(), - } - .into(), - ResolvedPath::Within(..) => { - // No need to handle the case of it being inside the directory, since we scan through the - // entire directory recursively anyways - Success(()) - } - } - }), - )) -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/structure.rs b/pkgs/test/nixpkgs-check-by-name/src/structure.rs deleted file mode 100644 index 09806bc3d4dc3..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/structure.rs +++ /dev/null @@ -1,184 +0,0 @@ -use crate::nixpkgs_problem::NixpkgsProblem; -use crate::references; -use crate::utils; -use crate::utils::{BASE_SUBPATH, PACKAGE_NIX_FILENAME}; -use crate::validation::{self, ResultIteratorExt, Validation::Success}; -use crate::NixFileStore; -use itertools::concat; -use lazy_static::lazy_static; -use regex::Regex; -use relative_path::RelativePathBuf; -use std::fs::DirEntry; -use std::path::Path; - -lazy_static! { - static ref SHARD_NAME_REGEX: Regex = Regex::new(r"^[a-z0-9_-]{1,2}$").unwrap(); - static ref PACKAGE_NAME_REGEX: Regex = Regex::new(r"^[a-zA-Z0-9_-]+$").unwrap(); -} - -// Some utility functions for the basic structure - -pub fn shard_for_package(package_name: &str) -> String { - package_name.to_lowercase().chars().take(2).collect() -} - -pub fn relative_dir_for_shard(shard_name: &str) -> RelativePathBuf { - RelativePathBuf::from(format!("{BASE_SUBPATH}/{shard_name}")) -} - -pub fn relative_dir_for_package(package_name: &str) -> RelativePathBuf { - relative_dir_for_shard(&shard_for_package(package_name)).join(package_name) -} - -pub fn relative_file_for_package(package_name: &str) -> RelativePathBuf { - relative_dir_for_package(package_name).join(PACKAGE_NIX_FILENAME) -} - -/// Check the structure of Nixpkgs, returning the attribute names that are defined in -/// `pkgs/by-name` -pub fn check_structure( - path: &Path, - nix_file_store: &mut NixFileStore, -) -> validation::Result> { - let base_dir = path.join(BASE_SUBPATH); - - let shard_results = utils::read_dir_sorted(&base_dir)? - .into_iter() - .map(|shard_entry| -> validation::Result<_> { - let shard_path = shard_entry.path(); - let shard_name = shard_entry.file_name().to_string_lossy().into_owned(); - let relative_shard_path = relative_dir_for_shard(&shard_name); - - Ok(if shard_name == "README.md" { - // README.md is allowed to be a file and not checked - - Success(vec![]) - } else if !shard_path.is_dir() { - NixpkgsProblem::ShardNonDir { - relative_shard_path: relative_shard_path.clone(), - } - .into() - // we can't check for any other errors if it's a file, since there's no subdirectories to check - } else { - let shard_name_valid = SHARD_NAME_REGEX.is_match(&shard_name); - let result = if !shard_name_valid { - NixpkgsProblem::InvalidShardName { - relative_shard_path: relative_shard_path.clone(), - shard_name: shard_name.clone(), - } - .into() - } else { - Success(()) - }; - - let entries = utils::read_dir_sorted(&shard_path)?; - - let duplicate_results = entries - .iter() - .zip(entries.iter().skip(1)) - .filter(|(l, r)| { - l.file_name().to_ascii_lowercase() == r.file_name().to_ascii_lowercase() - }) - .map(|(l, r)| { - NixpkgsProblem::CaseSensitiveDuplicate { - relative_shard_path: relative_shard_path.clone(), - first: l.file_name(), - second: r.file_name(), - } - .into() - }); - - let result = result.and(validation::sequence_(duplicate_results)); - - let package_results = entries - .into_iter() - .map(|package_entry| { - check_package( - nix_file_store, - path, - &shard_name, - shard_name_valid, - package_entry, - ) - }) - .collect_vec()?; - - result.and(validation::sequence(package_results)) - }) - }) - .collect_vec()?; - - // Combine the package names conatained within each shard into a longer list - Ok(validation::sequence(shard_results).map(concat)) -} - -fn check_package( - nix_file_store: &mut NixFileStore, - path: &Path, - shard_name: &str, - shard_name_valid: bool, - package_entry: DirEntry, -) -> validation::Result { - let package_path = package_entry.path(); - let package_name = package_entry.file_name().to_string_lossy().into_owned(); - let relative_package_dir = - RelativePathBuf::from(format!("{BASE_SUBPATH}/{shard_name}/{package_name}")); - - Ok(if !package_path.is_dir() { - NixpkgsProblem::PackageNonDir { - relative_package_dir: relative_package_dir.clone(), - } - .into() - } else { - let package_name_valid = PACKAGE_NAME_REGEX.is_match(&package_name); - let result = if !package_name_valid { - NixpkgsProblem::InvalidPackageName { - relative_package_dir: relative_package_dir.clone(), - package_name: package_name.clone(), - } - .into() - } else { - Success(()) - }; - - let correct_relative_package_dir = relative_dir_for_package(&package_name); - let result = result.and(if relative_package_dir != correct_relative_package_dir { - // Only show this error if we have a valid shard and package name - // Because if one of those is wrong, you should fix that first - if shard_name_valid && package_name_valid { - NixpkgsProblem::IncorrectShard { - relative_package_dir: relative_package_dir.clone(), - correct_relative_package_dir: correct_relative_package_dir.clone(), - } - .into() - } else { - Success(()) - } - } else { - Success(()) - }); - - let package_nix_path = package_path.join(PACKAGE_NIX_FILENAME); - let result = result.and(if !package_nix_path.exists() { - NixpkgsProblem::PackageNixNonExistent { - relative_package_dir: relative_package_dir.clone(), - } - .into() - } else if package_nix_path.is_dir() { - NixpkgsProblem::PackageNixDir { - relative_package_dir: relative_package_dir.clone(), - } - .into() - } else { - Success(()) - }); - - let result = result.and(references::check_references( - nix_file_store, - &relative_package_dir, - &relative_package_dir.to_path(path), - )?); - - result.map(|_| package_name.clone()) - }) -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/utils.rs b/pkgs/test/nixpkgs-check-by-name/src/utils.rs deleted file mode 100644 index 9a5d12748918a..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/utils.rs +++ /dev/null @@ -1,95 +0,0 @@ -use anyhow::Context; -use std::fs; -use std::io; -use std::path::Path; - -pub const BASE_SUBPATH: &str = "pkgs/by-name"; -pub const PACKAGE_NIX_FILENAME: &str = "package.nix"; - -/// Deterministic file listing so that tests are reproducible -pub fn read_dir_sorted(base_dir: &Path) -> anyhow::Result> { - let listing = base_dir - .read_dir() - .with_context(|| format!("Could not list directory {}", base_dir.display()))?; - let mut shard_entries = listing - .collect::>>() - .with_context(|| format!("Could not list directory {}", base_dir.display()))?; - shard_entries.sort_by_key(|entry| entry.file_name()); - Ok(shard_entries) -} - -/// A simple utility for calculating the line for a string offset. -/// This doesn't do any Unicode handling, though that probably doesn't matter -/// because newlines can't split up Unicode characters. Also this is only used -/// for error reporting -pub struct LineIndex { - /// Stores the indices of newlines - newlines: Vec, -} - -impl LineIndex { - pub fn new(s: &str) -> LineIndex { - let mut newlines = vec![]; - let mut index = 0; - // Iterates over all newline-split parts of the string, adding the index of the newline to - // the vec - for split in s.split_inclusive('\n') { - index += split.len(); - newlines.push(index - 1); - } - LineIndex { newlines } - } - - /// Returns the line number for a string index. - /// If the index points to a newline, returns the line number before the newline - pub fn line(&self, index: usize) -> usize { - match self.newlines.binary_search(&index) { - // +1 because lines are 1-indexed - Ok(x) => x + 1, - Err(x) => x + 1, - } - } - - /// Returns the string index for a line and column. - pub fn fromlinecolumn(&self, line: usize, column: usize) -> usize { - // If it's the 1th line, the column is the index - if line == 1 { - // But columns are 1-indexed - column - 1 - } else { - // For the nth line, we add the index of the (n-1)st newline to the column, - // and remove one more from the index since arrays are 0-indexed. - // Then add the 1-indexed column to get not the newline index itself, - // but rather the index of the position on the next line - self.newlines[line - 2] + column - } - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn line_index() { - let line_index = LineIndex::new("a\nbc\n\ndef\n"); - - let pairs = [ - (0, 1, 1), - (1, 1, 2), - (2, 2, 1), - (3, 2, 2), - (4, 2, 3), - (5, 3, 1), - (6, 4, 1), - (7, 4, 2), - (8, 4, 3), - (9, 4, 4), - ]; - - for (index, line, column) in pairs { - assert_eq!(line_index.line(index), line); - assert_eq!(line_index.fromlinecolumn(line, column), index); - } - } -} diff --git a/pkgs/test/nixpkgs-check-by-name/src/validation.rs b/pkgs/test/nixpkgs-check-by-name/src/validation.rs deleted file mode 100644 index b14bfb92eb2e3..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/src/validation.rs +++ /dev/null @@ -1,111 +0,0 @@ -use crate::nixpkgs_problem::NixpkgsProblem; -use itertools::concat; -use itertools::{ - Either::{Left, Right}, - Itertools, -}; -use Validation::*; - -/// The validation result of a check. -/// Instead of exiting at the first failure, -/// this type can accumulate multiple failures. -/// This can be achieved using the functions `and`, `sequence` and `sequence_` -/// -/// This leans on https://hackage.haskell.org/package/validation -pub enum Validation { - Failure(Vec), - Success(A), -} - -impl From for Validation { - /// Create a `Validation` from a single check problem - fn from(value: NixpkgsProblem) -> Self { - Failure(vec![value]) - } -} - -/// A type alias representing the result of a check, either: -/// - Err(anyhow::Error): A fatal failure, typically I/O errors. -/// Such failures are not caused by the files in Nixpkgs. -/// This hints at a bug in the code or a problem with the deployment. -/// - Ok(Failure(Vec)): A non-fatal validation problem with the Nixpkgs files. -/// Further checks can be run even with this result type. -/// Such problems can be fixed by changing the Nixpkgs files. -/// - Ok(Success(A)): A successful (potentially intermediate) result with an arbitrary value. -/// No fatal errors have occurred and no validation problems have been found with Nixpkgs. -pub type Result = anyhow::Result>; - -pub trait ResultIteratorExt: Sized + Iterator> { - fn collect_vec(self) -> std::result::Result, E>; -} - -impl ResultIteratorExt for I -where - I: Sized + Iterator>, -{ - /// A convenience version of `collect` specialised to a vector - fn collect_vec(self) -> std::result::Result, E> { - self.collect() - } -} - -impl Validation { - /// Map a `Validation` to a `Validation` by applying a function to the - /// potentially contained value in case of success. - pub fn map(self, f: impl FnOnce(A) -> B) -> Validation { - match self { - Failure(err) => Failure(err), - Success(value) => Success(f(value)), - } - } - - /// Map a `Validation` to a `Result` by applying a function `A -> Result` - /// only if there is a `Success` value - pub fn result_map(self, f: impl FnOnce(A) -> Result) -> Result { - match self { - Failure(err) => Ok(Failure(err)), - Success(value) => f(value), - } - } -} - -impl Validation<()> { - /// Combine two validations, both of which need to be successful for the return value to be successful. - /// The `NixpkgsProblem`s of both sides are returned concatenated. - pub fn and(self, other: Validation) -> Validation { - match (self, other) { - (Success(_), Success(right_value)) => Success(right_value), - (Failure(errors), Success(_)) => Failure(errors), - (Success(_), Failure(errors)) => Failure(errors), - (Failure(errors_l), Failure(errors_r)) => Failure(concat([errors_l, errors_r])), - } - } -} - -/// Combine many validations into a single one. -/// All given validations need to be successful in order for the returned validation to be successful, -/// in which case the returned validation value contains a `Vec` of each individual value. -/// Otherwise the `NixpkgsProblem`s of all validations are returned concatenated. -pub fn sequence(check_results: impl IntoIterator>) -> Validation> { - let (errors, values): (Vec>, Vec) = check_results - .into_iter() - .partition_map(|validation| match validation { - Failure(err) => Left(err), - Success(value) => Right(value), - }); - - // To combine the errors from the results we flatten all the error Vec's into a new Vec - // This is not very efficient, but doesn't matter because generally we should have no errors - let flattened_errors = errors.into_iter().concat(); - - if flattened_errors.is_empty() { - Success(values) - } else { - Failure(flattened_errors) - } -} - -/// Like `sequence`, but without any containing value, for convenience -pub fn sequence_(validations: impl IntoIterator>) -> Validation<()> { - sequence(validations).map(|_| ()) -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/aliases/aliases.nix b/pkgs/test/nixpkgs-check-by-name/tests/aliases/aliases.nix deleted file mode 100644 index c70ec23478eaf..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/aliases/aliases.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - baz = self.foo; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/aliases/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/aliases/all-packages.nix deleted file mode 100644 index 2cdfcef08fa61..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/aliases/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - bar = self.foo; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/aliases/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/aliases/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/aliases/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/aliases/expected b/pkgs/test/nixpkgs-check-by-name/tests/aliases/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/aliases/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/aliases/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/aliases/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/aliases/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/all-packages.nix deleted file mode 100644 index 399f8eee0a186..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/all-packages.nix +++ /dev/null @@ -1,7 +0,0 @@ -self: super: { - - alt.callPackage = self.lib.callPackageWith {}; - - foo = self.alt.callPackage ({ }: self.someDrv) { }; - -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/expected b/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/expected deleted file mode 100644 index 1d92e652200e4..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/fo/foo exists, the attribute `pkgs.foo` must be defined like - - foo = callPackage ./pkgs/by-name/fo/foo/package.nix { /* ... */ }; - - However, in this PR, a different `callPackage` is used. See the definition in all-packages.nix:5: - - foo = self.alt.callPackage ({ }: self.someDrv) { }; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/alt-callPackage/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/pkgs/by-name/foo b/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/base/pkgs/by-name/foo deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/expected b/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/expected deleted file mode 100644 index e209e18553147..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/expected +++ /dev/null @@ -1 +0,0 @@ -The base branch is broken, but this PR fixes it. Nice job! diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/base-fixed/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/pkgs/by-name/foo b/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/base/pkgs/by-name/foo deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/expected b/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/expected deleted file mode 100644 index c25f06b4150ea..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/expected +++ /dev/null @@ -1,3 +0,0 @@ -pkgs/by-name/bar: This is a file, but it should be a directory. -The base branch is broken and still has above problems with this PR, which need to be fixed first. -Consider reverting the PR that introduced these problems in order to prevent more failures of unrelated PRs. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/pkgs/by-name/bar b/pkgs/test/nixpkgs-check-by-name/tests/base-still-broken/pkgs/by-name/bar deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/default.nix deleted file mode 100644 index bd4825f8bad8a..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/default.nix +++ /dev/null @@ -1,4 +0,0 @@ -args: -builtins.removeAttrs - (import { root = ./.; } args) - [ "foo" ] diff --git a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/expected b/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/expected deleted file mode 100644 index 15b3e3ff6ede9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs.foo: This attribute is not defined but it should be defined automatically as pkgs/by-name/fo/foo/package.nix -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/broken-autocall/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/all-packages.nix deleted file mode 100644 index 306d719c9e9d6..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/all-packages.nix +++ /dev/null @@ -1,7 +0,0 @@ -self: super: { - set = self.callPackages ({ callPackage }: { - foo = callPackage ({ someDrv }: someDrv) { }; - }) { }; - - inherit (self.set) foo; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/expected b/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/callPackage-syntax/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/empty-base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/empty-base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/empty-base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/empty-base/expected b/pkgs/test/nixpkgs-check-by-name/tests/empty-base/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/empty-base/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/empty-base/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/empty-base/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/expected b/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/expected deleted file mode 100644 index 3b0146cdc146c..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/aa/FOO: Incorrect directory location, should be pkgs/by-name/fo/FOO instead. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/pkgs/by-name/aa/FOO/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/pkgs/by-name/aa/FOO/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/incorrect-shard/pkgs/by-name/aa/FOO/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/all-packages.nix deleted file mode 100644 index 3fbe2d5e51dc7..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/all-packages.nix +++ /dev/null @@ -1,4 +0,0 @@ -self: super: { - foo = self._internalCallByNamePackageFile ./foo.nix; - bar = self._internalCallByNamePackageFile ./foo.nix; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/expected b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/expected deleted file mode 100644 index b3d0c6fc1a401..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs.foo: This attribute is defined using `_internalCallByNamePackageFile`, which is an internal function not intended for manual use. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/foo.nix b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/foo.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/foo.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/internalCallPackage/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/expected deleted file mode 100644 index 80f6e7dd59983..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/fo@: Invalid package directory name "fo@", must be ASCII characters consisting of a-z, A-Z, 0-9, "-" or "_". -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/pkgs/by-name/fo/fo@/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/pkgs/by-name/fo/fo@/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-package-name/pkgs/by-name/fo/fo@/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/expected deleted file mode 100644 index 7ca9ff8565bd2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters consisting of a-z, 0-9, "-" or "_". -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/.git-keep b/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/.git-keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/invalid-shard-name/pkgs/by-name/A/A/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/all-packages.nix deleted file mode 100644 index 07b2caaab4e71..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/all-packages.nix +++ /dev/null @@ -1,10 +0,0 @@ -self: super: { - nonAttributeSet = self.callPackage ({ someDrv }: someDrv) { }; - nonCallPackage = self.callPackage ({ someDrv }: someDrv) { }; - internalCallByName = self.callPackage ({ someDrv }: someDrv) { }; - nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; - - onlyMove = self.callPackage ./pkgs/by-name/on/onlyMove/package.nix { }; - - noEval = self.callPackage ./pkgs/by-name/no/noEval/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/all-packages.nix deleted file mode 100644 index 75efb5952e7a6..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/all-packages.nix +++ /dev/null @@ -1,9 +0,0 @@ -self: super: { - nonAttributeSet = null; - nonCallPackage = self.someDrv; - internalCallByName = self._internalCallByNamePackageFile ./some-pkg.nix; - nonDerivation = self.callPackage ({ }: { }) { }; - - onlyMove = self.callPackage ({ someDrv }: someDrv) { }; - noEval = throw "foo"; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/some-pkg.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/some-pkg.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/base/some-pkg.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/expected b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/expected deleted file mode 100644 index 4d906ec0d086a..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/expected +++ /dev/null @@ -1,21 +0,0 @@ -- Because pkgs/by-name/no/noEval exists, the attribute `pkgs.noEval` must be defined like - - noEval = callPackage ./pkgs/by-name/no/noEval/package.nix { /* ... */ }; - - However, in this PR, the second argument is empty. See the definition in all-packages.nix:9: - - noEval = self.callPackage ./pkgs/by-name/no/noEval/package.nix { }; - - Such a definition is provided automatically and therefore not necessary. Please remove it. - -- Because pkgs/by-name/on/onlyMove exists, the attribute `pkgs.onlyMove` must be defined like - - onlyMove = callPackage ./pkgs/by-name/on/onlyMove/package.nix { /* ... */ }; - - However, in this PR, the second argument is empty. See the definition in all-packages.nix:7: - - onlyMove = self.callPackage ./pkgs/by-name/on/onlyMove/package.nix { }; - - Such a definition is provided automatically and therefore not necessary. Please remove it. - -This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/no/noEval/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/no/noEval/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/no/noEval/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/on/onlyMove/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/on/onlyMove/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/manual-definition/pkgs/by-name/on/onlyMove/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/expected b/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/expected deleted file mode 100644 index 1b67704817cfe..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/foo: Missing required "package.nix" file. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/pkgs/by-name/fo/foo/.git-keep b/pkgs/test/nixpkgs-check-by-name/tests/missing-package-nix/pkgs/by-name/fo/foo/.git-keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix b/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix deleted file mode 100644 index fbd51f656138d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/mock-nixpkgs.nix +++ /dev/null @@ -1,110 +0,0 @@ -/* -This file returns a mocked version of Nixpkgs' default.nix for testing purposes. -It does not depend on Nixpkgs itself for the sake of simplicity. - -It takes one attribute as an argument: -- `root`: The root of Nixpkgs to read other files from, including: - - `./pkgs/by-name`: The `pkgs/by-name` directory to test - - `./all-packages.nix`: A file containing an overlay to mirror the real `pkgs/top-level/all-packages.nix`. - This allows adding overrides on top of the auto-called packages in `pkgs/by-name`. - -It returns a Nixpkgs-like function that can be auto-called and evaluates to an attribute set. -*/ -{ - root, -}: -# The arguments for the Nixpkgs function -{ - # Passed by the checker to modify `callPackage` - overlays ? [], - # Passed by the checker to make sure a real Nixpkgs isn't influenced by impurities - config ? {}, - # Passed by the checker to make sure a real Nixpkgs isn't influenced by impurities - system ? null, -}: -let - - # Simplified versions of lib functions - lib = import ; - - # The base fixed-point function to populate the resulting attribute set - pkgsFun = - self: { - inherit lib; - newScope = extra: lib.callPackageWith (self // extra); - callPackage = self.newScope { }; - callPackages = lib.callPackagesWith self; - } - # This mapAttrs is a very hacky workaround necessary because for all attributes defined in Nixpkgs, - # the files that define them are verified to be within Nixpkgs. - # This is usually a very safe assumption, but it fails in these tests for someDrv, - # because it's technically defined outside the Nixpkgs directories of each test case. - # By using `mapAttrs`, `builtins.unsafeGetAttrPos` just returns `null`, - # which then doesn't trigger this check - // lib.mapAttrs (name: value: value) { - someDrv = { type = "derivation"; }; - }; - - baseDirectory = root + "/pkgs/by-name"; - - # Generates { = ; } entries mapping package names to their `package.nix` files in `pkgs/by-name`. - # Could be more efficient, but this is only for testing. - autoCalledPackageFiles = - let - entries = builtins.readDir baseDirectory; - - namesForShard = shard: - if entries.${shard} != "directory" then - # Only README.md is allowed to be a file, but it's not this code's job to check for that - { } - else - builtins.mapAttrs - (name: _: baseDirectory + "/${shard}/${name}/package.nix") - (builtins.readDir (baseDirectory + "/${shard}")); - - in - builtins.foldl' - (acc: el: acc // el) - { } - (map namesForShard (builtins.attrNames entries)); - - # Turns autoCalledPackageFiles into an overlay that `callPackage`'s all of them - autoCalledPackages = self: super: - { - # Needed to be able to detect empty arguments in all-packages.nix - # See a more detailed description in pkgs/top-level/by-name-overlay.nix - _internalCallByNamePackageFile = file: self.callPackage file { }; - } - // builtins.mapAttrs - (name: self._internalCallByNamePackageFile) - autoCalledPackageFiles; - - # A list optionally containing the `all-packages.nix` file from the test case as an overlay - optionalAllPackagesOverlay = - if builtins.pathExists (root + "/all-packages.nix") then - [ (import (root + "/all-packages.nix")) ] - else - [ ]; - - # A list optionally containing the `aliases.nix` file from the test case as an overlay - # But only if config.allowAliases is not false - optionalAliasesOverlay = - if (config.allowAliases or true) && builtins.pathExists (root + "/aliases.nix") then - [ (import (root + "/aliases.nix")) ] - else - [ ]; - - # All the overlays in the right order, including the user-supplied ones - allOverlays = - [ - autoCalledPackages - ] - ++ optionalAllPackagesOverlay - ++ optionalAliasesOverlay - ++ overlays; - - # Apply all the overlays in order to the base fixed-point function pkgsFun - f = builtins.foldl' (f: overlay: lib.extends overlay f) pkgsFun allOverlays; -in -# Evaluate the fixed-point -lib.fix f diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/all-packages.nix deleted file mode 100644 index 16834c4f78568..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/all-packages.nix +++ /dev/null @@ -1,10 +0,0 @@ -self: super: { - foo1 = self.callPackage ({ someDrv }: someDrv) { }; - foo2 = self.callPackage ./without-config.nix { }; - foo3 = self.callPackage ({ someDrv, enableFoo }: someDrv) { - enableFoo = null; - }; - foo4 = self.callPackage ./with-config.nix { - enableFoo = null; - }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo1/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo2/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo3/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo3/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo3/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo4/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo4/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/base/pkgs/by-name/fo/foo4/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/expected deleted file mode 100644 index 123e24daab8a4..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/expected +++ /dev/null @@ -1,13 +0,0 @@ -- Attribute `pkgs.foo1` was previously defined in pkgs/by-name/fo/foo1/package.nix, but is now manually defined as `callPackage ... { /* ... */ }` in all-packages.nix. - Please move the package back and remove the manual `callPackage`. - -- Attribute `pkgs.foo2` was previously defined in pkgs/by-name/fo/foo2/package.nix, but is now manually defined as `callPackage ./without-config.nix { /* ... */ }` in all-packages.nix. - Please move the package back and remove the manual `callPackage`. - -- Attribute `pkgs.foo3` was previously defined in pkgs/by-name/fo/foo3/package.nix, but is now manually defined as `callPackage ... { ... }` in all-packages.nix. - While the manual `callPackage` is still needed, it's not necessary to move the package files. - -- Attribute `pkgs.foo4` was previously defined in pkgs/by-name/fo/foo4/package.nix, but is now manually defined as `callPackage ./with-config.nix { ... }` in all-packages.nix. - While the manual `callPackage` is still needed, it's not necessary to move the package files. - -This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/with-config.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/with-config.nix deleted file mode 100644 index 7cca53882ea54..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/with-config.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv, enableFoo }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/without-config.nix b/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/without-config.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/move-to-non-by-name/without-config.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/expected b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/expected deleted file mode 100644 index 0105b19078c75..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/expected +++ /dev/null @@ -1,14 +0,0 @@ -pkgs/by-name/A: Invalid directory name "A", must be at most 2 ASCII characters consisting of a-z, 0-9, "-" or "_". -pkgs/by-name/A/fo@: Invalid package directory name "fo@", must be ASCII characters consisting of a-z, A-Z, 0-9, "-" or "_". -pkgs/by-name/A/fo@: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2). -pkgs/by-name/A/fo@: Path package.nix is a symlink pointing to a path outside the directory of that package. -pkgs/by-name/aa: This is a file, but it should be a directory. -pkgs/by-name/ba/bar: This path is a file, but it should be a directory. -pkgs/by-name/ba/baz: "package.nix" must be a file. -pkgs/by-name/ba/foo: Incorrect directory location, should be pkgs/by-name/fo/foo instead. -pkgs/by-name/ba/foo: File package.nix at line 2 contains the path expression "/bar" which cannot be resolved: No such file or directory (os error 2). -pkgs/by-name/ba/foo: File package.nix at line 3 contains the path expression "../." which may point outside the directory of that package. -pkgs/by-name/ba/foo: File package.nix at line 4 contains the nix search path expression "" which may point outside the directory of that package. -pkgs/by-name/ba/foo: File package.nix at line 5 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. -pkgs/by-name/fo/foo: Missing required "package.nix" file. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/foo b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/foo deleted file mode 120000 index c86c3f3551ecf..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/foo +++ /dev/null @@ -1 +0,0 @@ -none \ No newline at end of file diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/package.nix deleted file mode 120000 index f079163d158a2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/A/fo@/package.nix +++ /dev/null @@ -1 +0,0 @@ -../../../../someDrv.nix \ No newline at end of file diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/aa b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/aa deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/bar b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/bar deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/baz/package.nix/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/baz/package.nix/default.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/baz/package.nix/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix deleted file mode 100644 index 31b4742f5914f..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/ba/foo/package.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ someDrv }: someDrv // { - escapeAbsolute = /bar; - escapeRelative = ../.; - nixPath = ; - pathWithSubexpr = ./${"test"}; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/fo/foo/.git-keep b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/pkgs/by-name/fo/foo/.git-keep deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/someDrv.nix b/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/someDrv.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/multiple-failures/someDrv.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/all-packages.nix deleted file mode 100644 index 069119ad4c7b4..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/all-packages.nix +++ /dev/null @@ -1,11 +0,0 @@ -self: super: { - before = self.callPackage ({ someDrv }: someDrv) { }; - new1 = self.callPackage ({ someDrv }: someDrv) { }; - new2 = self.callPackage ./without-config.nix { }; - new3 = self.callPackage ({ someDrv, enableNew }: someDrv) { - enableNew = null; - }; - new4 = self.callPackage ./with-config.nix { - enableNew = null; - }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/all-packages.nix deleted file mode 100644 index c2665d04d5f2c..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/all-packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -self: super: { - - before = self.callPackage ({ someDrv }: someDrv) { }; - -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/base/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/expected deleted file mode 100644 index 92668a231b48e..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/expected +++ /dev/null @@ -1,21 +0,0 @@ -- Attribute `pkgs.new1` is a new top-level package using `pkgs.callPackage ... { /* ... */ }`. - Please define it in pkgs/by-name/ne/new1/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is `{ }`, no manual `callPackage` in all-packages.nix is needed anymore. - -- Attribute `pkgs.new2` is a new top-level package using `pkgs.callPackage ./without-config.nix { /* ... */ }`. - Please define it in pkgs/by-name/ne/new2/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is `{ }`, no manual `callPackage` in all-packages.nix is needed anymore. - -- Attribute `pkgs.new3` is a new top-level package using `pkgs.callPackage ... { /* ... */ }`. - Please define it in pkgs/by-name/ne/new3/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is not `{ }`, the manual `callPackage` in all-packages.nix is still needed. - -- Attribute `pkgs.new4` is a new top-level package using `pkgs.callPackage ./with-config.nix { /* ... */ }`. - Please define it in pkgs/by-name/ne/new4/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is not `{ }`, the manual `callPackage` in all-packages.nix is still needed. - -This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/with-config.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/with-config.nix deleted file mode 100644 index 65bcbf9928a2c..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/with-config.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv, enableNew }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/without-config.nix b/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/without-config.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/new-package-non-by-name/without-config.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-by-name/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/all-packages.nix deleted file mode 100644 index 38762c6de1cc9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/all-packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -self: super: { - iDontEval = throw "I don't eval"; - - futureEval = self.callPackage ({ someDrv }: someDrv) { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/all-packages.nix deleted file mode 100644 index ac763b454eb08..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - futureEval = throw "foo"; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/base/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/expected b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/no-eval/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/no-eval/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/expected b/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/expected deleted file mode 100644 index 1705d22be7984..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs.nonDerivation: This attribute defined by pkgs/by-name/no/nonDerivation/package.nix is not a derivation -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index bd68dba1ded5d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-attrs/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ }: null diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/expected b/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/expected deleted file mode 100644 index 1705d22be7984..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs.nonDerivation: This attribute defined by pkgs/by-name/no/nonDerivation/package.nix is not a derivation -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index b021e28c21453..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-derivation/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ }: { } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/all-packages.nix deleted file mode 100644 index 3e0ea20c22810..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/all-packages.nix +++ /dev/null @@ -1,6 +0,0 @@ -self: super: { - - bar = (x: x) self.callPackage ./pkgs/by-name/fo/foo/package.nix { someFlag = true; }; - foo = self.bar; - -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/expected b/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/expected deleted file mode 100644 index e09e931bb658e..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/fo/foo exists, the attribute `pkgs.foo` must be defined like - - foo = callPackage ./pkgs/by-name/fo/foo/package.nix { /* ... */ }; - - However, in this PR, it isn't defined that way. See the definition in all-packages.nix:4 - - foo = self.bar; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index 5ad6ea5e24d66..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/non-syntactical-callPackage-by-name/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv, someFlag }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/one-letter/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/expected b/pkgs/test/nixpkgs-check-by-name/tests/one-letter/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/pkgs/by-name/a/a/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/one-letter/pkgs/by-name/a/a/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/one-letter/pkgs/by-name/a/a/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/all-packages.nix deleted file mode 100644 index 5b1ed9d2ccda6..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/all-packages.nix +++ /dev/null @@ -1,16 +0,0 @@ -self: super: { - alternateCallPackage = self.myScope.callPackage ({ myScopeValue, someDrv }: - assert myScopeValue; - someDrv - ) { }; - - myScope = self.lib.makeScope self.newScope (self: { - myScopeValue = true; - }); - - myPackages = self.callPackages ({ someDrv }: { - a = someDrv; - b = someDrv; - }) { }; - inherit (self.myPackages) a b; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/expected b/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/only-callPackage-derivations/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/all-packages.nix deleted file mode 100644 index 8bedb90d89a70..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.callPackage ./someDrv.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/expected deleted file mode 100644 index 16292c0c0eb14..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/no/nonDerivation exists, the attribute `pkgs.nonDerivation` must be defined like - - nonDerivation = callPackage ./pkgs/by-name/no/nonDerivation/package.nix { /* ... */ }; - - However, in this PR, the first `callPackage` argument is the wrong path. See the definition in all-packages.nix:2: - - nonDerivation = callPackage ./someDrv.nix { /* ... */ }; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index bd68dba1ded5d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ }: null diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/someDrv.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/someDrv.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-different-file/someDrv.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/all-packages.nix deleted file mode 100644 index d369dd7228dca..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/all-packages.nix deleted file mode 100644 index d369dd7228dca..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/base/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg-gradual/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/all-packages.nix deleted file mode 100644 index d369dd7228dca..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/base/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/expected deleted file mode 100644 index f3306aadbbb77..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/expected +++ /dev/null @@ -1,11 +0,0 @@ -- Because pkgs/by-name/no/nonDerivation exists, the attribute `pkgs.nonDerivation` must be defined like - - nonDerivation = callPackage ./pkgs/by-name/no/nonDerivation/package.nix { /* ... */ }; - - However, in this PR, the second argument is empty. See the definition in all-packages.nix:2: - - nonDerivation = self.callPackage ./pkgs/by-name/no/nonDerivation/package.nix { }; - - Such a definition is provided automatically and therefore not necessary. Please remove it. - -This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-empty-arg/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/all-packages.nix deleted file mode 100644 index 853c3a87db561..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.someDrv; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/expected deleted file mode 100644 index d91d58d629f2b..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/no/nonDerivation exists, the attribute `pkgs.nonDerivation` must be defined like - - nonDerivation = callPackage ./pkgs/by-name/no/nonDerivation/package.nix { /* ... */ }; - - However, in this PR, it isn't defined that way. See the definition in all-packages.nix:2 - - nonDerivation = self.someDrv; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index bd68dba1ded5d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-call-package/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ }: null diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/all-packages.nix deleted file mode 100644 index dc07f69b40ee4..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/expected deleted file mode 100644 index 807c440dd3d26..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/no/nonDerivation exists, the attribute `pkgs.nonDerivation` must be defined like - - nonDerivation = callPackage ./pkgs/by-name/no/nonDerivation/package.nix { /* ... */ }; - - However, in this PR, the first `callPackage` argument is not a path. See the definition in all-packages.nix:2: - - nonDerivation = self.callPackage ({ someDrv }: someDrv) { }; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/pkgs/by-name/no/nonDerivation/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/pkgs/by-name/no/nonDerivation/package.nix deleted file mode 100644 index bd68dba1ded5d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-no-file/pkgs/by-name/no/nonDerivation/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ }: null diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/all-packages.nix deleted file mode 100644 index f07e7a42744a4..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/all-packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -self: super: { - - foo = self.callPackage ({ someDrv, someFlag }: someDrv) { someFlag = true; }; - -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/expected deleted file mode 100644 index 4adbaf66edc0e..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/expected +++ /dev/null @@ -1,9 +0,0 @@ -- Because pkgs/by-name/fo/foo exists, the attribute `pkgs.foo` must be defined like - - foo = callPackage ./pkgs/by-name/fo/foo/package.nix { /* ... */ }; - - However, in this PR, the first `callPackage` argument is not a path. See the definition in all-packages.nix:3: - - foo = self.callPackage ({ someDrv, someFlag }: someDrv) { someFlag = true; }; - -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-non-path/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-success/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-success/all-packages.nix deleted file mode 100644 index 6b323756ae412..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-success/all-packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -self: super: { - foo = self.callPackage ./pkgs/by-name/fo/foo/package.nix { - enableBar = true; - }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-success/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-success/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-success/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-success/expected b/pkgs/test/nixpkgs-check-by-name/tests/override-success/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-success/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/override-success/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/override-success/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index c811a7215a286..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/override-success/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ - someDrv, - enableBar ? false, -}: -if enableBar then - someDrv -else - {} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/expected b/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/expected deleted file mode 100644 index adee1d0137fab..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/foo: This path is a file, but it should be a directory. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/pkgs/by-name/fo/foo b/pkgs/test/nixpkgs-check-by-name/tests/package-dir-is-file/pkgs/by-name/fo/foo deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/expected b/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/expected deleted file mode 100644 index d03e1eceea266..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/foo: "package.nix" must be a file. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/pkgs/by-name/fo/foo/package.nix/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/pkgs/by-name/fo/foo/package.nix/default.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-nix-dir/pkgs/by-name/fo/foo/package.nix/default.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/all-packages.nix deleted file mode 100644 index 85f8c6138c5c2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/all-packages.nix +++ /dev/null @@ -1,5 +0,0 @@ -self: super: { - foo-variant-unvarianted = self.callPackage ./package.nix { }; - - foo-variant-new = self.callPackage ./pkgs/by-name/fo/foo/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/all-packages.nix deleted file mode 100644 index 734604360073b..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: { - foo-variant-unvarianted = self.callPackage ./pkgs/by-name/fo/foo/package.nix { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/base/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/expected b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/package-variants/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/package-variants/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/expected b/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/expected deleted file mode 100644 index 0bdb00f20cb99..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "/foo" which cannot be resolved: No such file or directory (os error 2). -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix deleted file mode 100644 index 7a51ba1ec719f..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-absolute/pkgs/by-name/aa/aa/package.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ someDrv }: someDrv // { - escape = /foo; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/expected b/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/expected deleted file mode 100644 index 2e4338ccc7ae1..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "../." which may point outside the directory of that package. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/pkgs/by-name/aa/aa/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/pkgs/by-name/aa/aa/package.nix deleted file mode 100644 index 5989f52eb8990..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-escape/pkgs/by-name/aa/aa/package.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ someDrv }: someDrv // { - escape = ../.; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/expected b/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/expected deleted file mode 100644 index 30125570794ae..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the nix search path expression "" which may point outside the directory of that package. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix deleted file mode 100644 index 864fdce13319a..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-nix-path/pkgs/by-name/aa/aa/package.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ someDrv }: someDrv // { - nixPath = ; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/expected b/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/expected deleted file mode 100644 index 6567439b77f8d..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/aa/aa: File package.nix at line 2 contains the path expression "./${"test"}", which is not yet supported and may point outside the directory of that package. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix deleted file mode 100644 index a94ba75412638..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-path-subexpr/pkgs/by-name/aa/aa/package.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ someDrv }: someDrv // { - pathWithSubexpr = ./${"test"}; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/expected b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/dir/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/dir/default.nix deleted file mode 100644 index 7e4a7548fec7a..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/dir/default.nix +++ /dev/null @@ -1,2 +0,0 @@ -# Recursive -../package.nix diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file.nix deleted file mode 100644 index bd55e601bf645..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/file.nix +++ /dev/null @@ -1,2 +0,0 @@ -# Recursive test -import ./file.nix diff --git a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/package.nix deleted file mode 100644 index 474db5b0ebfcc..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/ref-success/pkgs/by-name/aa/aa/package.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ someDrv }: someDrv // { - nixFile = ./file.nix; - nonNixFile = ./file; - directory = ./dir; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/shard-file/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/shard-file/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/shard-file/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/shard-file/expected b/pkgs/test/nixpkgs-check-by-name/tests/shard-file/expected deleted file mode 100644 index 689cee41f1e3b..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/shard-file/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo: This is a file, but it should be a directory. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/shard-file/pkgs/by-name/fo b/pkgs/test/nixpkgs-check-by-name/tests/shard-file/pkgs/by-name/fo deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/all-packages.nix deleted file mode 100644 index 688f52b9358fd..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/all-packages.nix +++ /dev/null @@ -1,6 +0,0 @@ -self: super: { - a = self.callPackage ./pkgs/by-name/a/a/package.nix { }; - b = self.callPackage ({ someDrv }: someDrv) { }; - c = self.callPackage ./pkgs/by-name/c/c/package.nix { }; - d = self.callPackage ({ someDrv }: someDrv) { }; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/expected b/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/expected deleted file mode 100644 index 8a8104b737209..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/expected +++ /dev/null @@ -1,31 +0,0 @@ -- Because pkgs/by-name/a/a exists, the attribute `pkgs.a` must be defined like - - a = callPackage ./pkgs/by-name/a/a/package.nix { /* ... */ }; - - However, in this PR, the second argument is empty. See the definition in all-packages.nix:2: - - a = self.callPackage ./pkgs/by-name/a/a/package.nix { }; - - Such a definition is provided automatically and therefore not necessary. Please remove it. - -- Attribute `pkgs.b` is a new top-level package using `pkgs.callPackage ... { /* ... */ }`. - Please define it in pkgs/by-name/b/b/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is `{ }`, no manual `callPackage` in all-packages.nix is needed anymore. - -- Because pkgs/by-name/c/c exists, the attribute `pkgs.c` must be defined like - - c = callPackage ./pkgs/by-name/c/c/package.nix { /* ... */ }; - - However, in this PR, the second argument is empty. See the definition in all-packages.nix:4: - - c = self.callPackage ./pkgs/by-name/c/c/package.nix { }; - - Such a definition is provided automatically and therefore not necessary. Please remove it. - -- Attribute `pkgs.d` is a new top-level package using `pkgs.callPackage ... { /* ... */ }`. - Please define it in pkgs/by-name/d/d/package.nix instead. - See `pkgs/by-name/README.md` for more details. - Since the second `callPackage` argument is `{ }`, no manual `callPackage` in all-packages.nix is needed anymore. - -This PR introduces additional instances of discouraged patterns as listed above. Merging is discouraged but would not break the base branch. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/a/a/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/a/a/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/a/a/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/c/c/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/c/c/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/sorted-order/pkgs/by-name/c/c/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/success/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/success/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/success/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/success/expected b/pkgs/test/nixpkgs-check-by-name/tests/success/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/success/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/success/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/success/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/success/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/expected b/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/expected deleted file mode 100644 index cd555c658a09c..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/foo: Path package.nix is a symlink pointing to a path outside the directory of that package. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/pkgs/by-name/fo/foo/package.nix deleted file mode 120000 index f079163d158a2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -../../../../someDrv.nix \ No newline at end of file diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/someDrv.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/someDrv.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-escape/someDrv.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/expected b/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/expected deleted file mode 100644 index 1b06bcf4972be..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs/by-name/fo/foo: Path foo is a symlink which cannot be resolved: No such file or directory (os error 2). -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/foo b/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/foo deleted file mode 120000 index c86c3f3551ecf..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/foo +++ /dev/null @@ -1 +0,0 @@ -none \ No newline at end of file diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/someDrv.nix b/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/someDrv.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/symlink-invalid/someDrv.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/all-packages.nix b/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/all-packages.nix deleted file mode 100644 index 3398e974cb6bb..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/all-packages.nix +++ /dev/null @@ -1,3 +0,0 @@ -self: super: builtins.mapAttrs (name: value: value) { - foo = self.someDrv; -} diff --git a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/expected b/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/expected deleted file mode 100644 index 608843d939037..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/expected +++ /dev/null @@ -1,2 +0,0 @@ -pkgs.foo: Cannot determine the location of this attribute using `builtins.unsafeGetAttrPos`. -This PR introduces the problems listed above. Please fix them before merging, otherwise the base branch would break. diff --git a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/pkgs/by-name/fo/foo/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/pkgs/by-name/fo/foo/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/unknown-location/pkgs/by-name/fo/foo/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/uppercase/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/expected b/pkgs/test/nixpkgs-check-by-name/tests/uppercase/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/pkgs/by-name/fo/FOO/package.nix b/pkgs/test/nixpkgs-check-by-name/tests/uppercase/pkgs/by-name/fo/FOO/package.nix deleted file mode 100644 index a1b92efbbadb9..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/uppercase/pkgs/by-name/fo/FOO/package.nix +++ /dev/null @@ -1 +0,0 @@ -{ someDrv }: someDrv diff --git a/pkgs/test/nixpkgs-check-by-name/tests/with-readme/default.nix b/pkgs/test/nixpkgs-check-by-name/tests/with-readme/default.nix deleted file mode 100644 index 861260cdca4b2..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/with-readme/default.nix +++ /dev/null @@ -1 +0,0 @@ -import { root = ./.; } diff --git a/pkgs/test/nixpkgs-check-by-name/tests/with-readme/expected b/pkgs/test/nixpkgs-check-by-name/tests/with-readme/expected deleted file mode 100644 index defae2634c343..0000000000000 --- a/pkgs/test/nixpkgs-check-by-name/tests/with-readme/expected +++ /dev/null @@ -1 +0,0 @@ -Validated successfully diff --git a/pkgs/test/nixpkgs-check-by-name/tests/with-readme/pkgs/by-name/README.md b/pkgs/test/nixpkgs-check-by-name/tests/with-readme/pkgs/by-name/README.md deleted file mode 100644 index e69de29bb2d1d..0000000000000